-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathmetrics_pending.go
More file actions
38 lines (33 loc) · 922 Bytes
/
metrics_pending.go
File metadata and controls
38 lines (33 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package cmd
import (
"context"
"fmt"
"github.com/spf13/cobra"
)
type metricsPendingCmd struct {
cmd *cobra.Command
flags metricsCommonFlags
}
func newMetricsPendingCmd() *metricsPendingCmd {
c := &metricsPendingCmd{}
c.cmd = &cobra.Command{
Use: "pending",
Args: cobra.NoArgs,
Short: ShortBeta("Query events pending timeseries"),
Long: LongBeta(`Query events pending over time (timeseries). Measures: count.`),
RunE: c.runE,
}
addMetricsCommonFlags(c.cmd, &c.flags)
return c
}
func (c *metricsPendingCmd) runE(cmd *cobra.Command, args []string) error {
if err := Config.Profile.ValidateAPIKey(); err != nil {
return err
}
params := metricsParamsFromFlags(&c.flags)
data, err := Config.GetAPIClient().QueryEventsPendingTimeseries(context.Background(), params)
if err != nil {
return fmt.Errorf("query events pending: %w", err)
}
return printMetricsResponse(data, c.flags.output)
}