From 9d20e830a1164e445a1be49837de017b0e814332 Mon Sep 17 00:00:00 2001 From: Kristof Kowalski Date: Sun, 2 Oct 2022 13:24:31 +1100 Subject: [PATCH] Moving delta-temporality as a metrics option --- internal/cli/flags.go | 5 ----- internal/cli/metrics_counter.go | 7 +++++++ internal/cli/metrics_counter_observer.go | 9 ++++++++- internal/cli/metrics_counter_observer_advanced.go | 7 +++++++ internal/cli/metrics_counter_with_labels.go | 9 ++++++++- internal/cli/metrics_gauge_observer.go | 9 ++++++++- internal/cli/metrics_histogram.go | 7 +++++++ internal/cli/metrics_up_down_counter.go | 7 +++++++ internal/cli/metrics_up_down_counter_observer.go | 9 ++++++++- 9 files changed, 60 insertions(+), 9 deletions(-) diff --git a/internal/cli/flags.go b/internal/cli/flags.go index ef97d10..64251d8 100644 --- a/internal/cli/flags.go +++ b/internal/cli/flags.go @@ -57,10 +57,5 @@ func getGlobalFlags() []cli.Flag { // EnvVars: []string{"OTEL_SERVICE_NAME"}, Value: "otelgen", }), - altsrc.NewBoolFlag(&cli.BoolFlag{ - Name: "delta-temporality", - Usage: "Use delta temporality when exporting metrics (cumulative temporality is the default)", - Value: false, - }), } } diff --git a/internal/cli/metrics_counter.go b/internal/cli/metrics_counter.go index 14e58c8..eab2974 100644 --- a/internal/cli/metrics_counter.go +++ b/internal/cli/metrics_counter.go @@ -24,6 +24,13 @@ var generateMetricsCounterCommand = &cli.Command{ Usage: "generate metrics of type counter", Description: "Counter demonstrates how to measure non-decreasing numbers", Aliases: []string{"c"}, + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "delta-temporality", + Usage: "Use delta temporality when exporting metrics (cumulative temporality is the default)", + Value: false, + }, + }, Action: func(c *cli.Context) error { return generateMetricsCounterAction(c) }, diff --git a/internal/cli/metrics_counter_observer.go b/internal/cli/metrics_counter_observer.go index 3a4c0cb..b31c3b8 100644 --- a/internal/cli/metrics_counter_observer.go +++ b/internal/cli/metrics_counter_observer.go @@ -24,7 +24,14 @@ var generateMetricsCounterObserverCommand = &cli.Command{ Usage: "generate metrics of type counter, using observer", Description: "CounterObserver demonstrates how to measure monotonic (non-decreasing) numbers", Aliases: []string{"co"}, - Hidden: true, + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "delta-temporality", + Usage: "Use delta temporality when exporting metrics (cumulative temporality is the default)", + Value: false, + }, + }, + Hidden: true, Action: func(c *cli.Context) error { return generateMetricsCounterObserverAction(c) }, diff --git a/internal/cli/metrics_counter_observer_advanced.go b/internal/cli/metrics_counter_observer_advanced.go index 885cbe2..5266248 100644 --- a/internal/cli/metrics_counter_observer_advanced.go +++ b/internal/cli/metrics_counter_observer_advanced.go @@ -23,6 +23,13 @@ var generateMetricsCounterObserverAdvancedCommand = &cli.Command{ Usage: "generate metrics of type counter, using observer advanced pattern", Description: "CounterObserverAdvanced demonstrates how to measure monotonic (non-decreasing) numbers", Aliases: []string{"coa"}, + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "delta-temporality", + Usage: "Use delta temporality when exporting metrics (cumulative temporality is the default)", + Value: false, + }, + }, Action: func(c *cli.Context) error { return generateMetricsCounterObserverAdvancedAction(c) }, diff --git a/internal/cli/metrics_counter_with_labels.go b/internal/cli/metrics_counter_with_labels.go index 4e38b44..d402d50 100644 --- a/internal/cli/metrics_counter_with_labels.go +++ b/internal/cli/metrics_counter_with_labels.go @@ -24,7 +24,14 @@ var generateMetricsCounterWithLabelsCommand = &cli.Command{ Usage: "generate metrics of type counter with labels", Description: "CounterWithLabels demonstrates how to add different labels (\"hits\" and \"misses\")", Aliases: []string{"cwl"}, - Hidden: true, + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "delta-temporality", + Usage: "Use delta temporality when exporting metrics (cumulative temporality is the default)", + Value: false, + }, + }, + Hidden: true, Action: func(c *cli.Context) error { return generateMetricsCounterWithLabelsAction(c) }, diff --git a/internal/cli/metrics_gauge_observer.go b/internal/cli/metrics_gauge_observer.go index 14239a2..239ea89 100644 --- a/internal/cli/metrics_gauge_observer.go +++ b/internal/cli/metrics_gauge_observer.go @@ -24,7 +24,14 @@ var generateMetricsGaugeObserverCommand = &cli.Command{ Usage: "generate metrics of type gauge, using observer", Description: "GaugeObserver demonstrates how to measure non-additive numbers that can go up and down", Aliases: []string{"go"}, - Hidden: true, + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "delta-temporality", + Usage: "Use delta temporality when exporting metrics (cumulative temporality is the default)", + Value: false, + }, + }, + Hidden: true, Action: func(c *cli.Context) error { return generateMetricsGaugeObserverAction(c) }, diff --git a/internal/cli/metrics_histogram.go b/internal/cli/metrics_histogram.go index 63fe7e7..9970fd5 100644 --- a/internal/cli/metrics_histogram.go +++ b/internal/cli/metrics_histogram.go @@ -24,6 +24,13 @@ var generateMetricsHistogramCommand = &cli.Command{ Usage: "generate metrics of type histogram", Description: "Histogram demonstrates how to record a distribution of individual values", Aliases: []string{"h"}, + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "delta-temporality", + Usage: "Use delta temporality when exporting metrics (cumulative temporality is the default)", + Value: false, + }, + }, Action: func(c *cli.Context) error { return generateMetricsHistogramAction(c) }, diff --git a/internal/cli/metrics_up_down_counter.go b/internal/cli/metrics_up_down_counter.go index 15c9e03..452286d 100644 --- a/internal/cli/metrics_up_down_counter.go +++ b/internal/cli/metrics_up_down_counter.go @@ -24,6 +24,13 @@ var generateMetricsUpDownCounterCommand = &cli.Command{ Usage: "generate metrics of type up down counter", Description: "UpDownCounter demonstrates how to measure numbers that can go up and down", Aliases: []string{"udc"}, + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "delta-temporality", + Usage: "Use delta temporality when exporting metrics (cumulative temporality is the default)", + Value: false, + }, + }, Action: func(c *cli.Context) error { return generateMetricsUpDownCounterAction(c) }, diff --git a/internal/cli/metrics_up_down_counter_observer.go b/internal/cli/metrics_up_down_counter_observer.go index 4b5348b..09c032b 100644 --- a/internal/cli/metrics_up_down_counter_observer.go +++ b/internal/cli/metrics_up_down_counter_observer.go @@ -24,7 +24,14 @@ var generateMetricsUpDownCounterObserverCommand = &cli.Command{ Usage: "generate metrics of type up down counter, using observer", Description: "UpDownCounterObserver demonstrates how to measure numbers that can go up and down", Aliases: []string{"udco"}, - Hidden: true, + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "delta-temporality", + Usage: "Use delta temporality when exporting metrics (cumulative temporality is the default)", + Value: false, + }, + }, + Hidden: true, Action: func(c *cli.Context) error { return generateMetricsUpDownCounterObserverAction(c) },