-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: yeya24 <yb532204897@gmail.com> add changelog Signed-off-by: yeya24 <yb532204897@gmail.com>
- Loading branch information
Showing
8 changed files
with
111 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package seriesquery | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"time" | ||
|
||
"github.com/grafana/loki/pkg/logcli/client" | ||
"github.com/grafana/loki/pkg/loghttp" | ||
) | ||
|
||
// SeriesQuery contains all necessary fields to execute label queries and print out the results | ||
type SeriesQuery struct { | ||
Matchers []string | ||
Start time.Time | ||
End time.Time | ||
Quiet bool | ||
} | ||
|
||
// DoSeries prints out series results | ||
func (q *SeriesQuery) DoSeries(c *client.Client) { | ||
values := q.GetSeries(c) | ||
|
||
for _, value := range values { | ||
fmt.Println(value) | ||
} | ||
} | ||
|
||
// GetSeries returns an array of label sets | ||
func (q *SeriesQuery) GetSeries(c *client.Client) []loghttp.LabelSet { | ||
seriesResponse, err := c.Series(q.Matchers, q.Start, q.End, q.Quiet) | ||
if err != nil { | ||
log.Fatalf("Error doing request: %+v", err) | ||
} | ||
return seriesResponse.Data | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters