single

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = cli.Command{
	Name:  "single-metrics",
	Usage: "Query single metrics defined in backend OAL",
	Flags: flags.Flags(
		flags.DurationFlags,
		[]cli.Flag{
			cli.StringFlag{
				Name:     "name",
				Usage:    "metrics `NAME`, which should be defined in OAL script",
				Required: true,
			},
			cli.StringSliceFlag{
				Name:     "ids",
				Usage:    "`IDs`, IDs that are required by the given metric type",
				Required: false,
			},
		},
	),
	Before: interceptor.BeforeChain([]cli.BeforeFunc{
		interceptor.DurationInterceptor,
	}),
	Action: func(ctx *cli.Context) error {
		end := ctx.String("end")
		start := ctx.String("start")
		step := ctx.Generic("step")
		metricsName := ctx.String("name")
		idsString := ctx.StringSlice("ids")

		var ids []string

		for _, id := range idsString {
			ids = append(ids, strings.Split(id, ",")...)
		}

		metricsValues := client.IntValues(ctx, schema.BatchMetricConditions{
			Name: metricsName,
			Ids:  ids,
		}, schema.Duration{
			Start: start,
			End:   end,
			Step:  step.(*model.StepEnumValue).Selected,
		})

		return display.Display(ctx, metricsValues)
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL