Skip to content

Commit

Permalink
[SPM] Deprecate support for Spanmetrics Processor naming convention (j…
Browse files Browse the repository at this point in the history
…aegertracing#4741)

## Which problem is this PR solving?
- Part 1 of jaegertracing#4736

## Description of the changes
- Add deprecation notice to CLI flag
- Add log message when using span metrics processor notation

## How was this change tested?
```
$ go run ./cmd/all-in-one help
      --prometheus.query.support-spanmetrics-connector            (deprecated, will be removed after 2024-01-01 or in release v1.53.0, whichever is later)  Controls whether the metrics queries should match the OpenTelemetry Collector's spanmetrics connector naming (when true) or spanmetrics processor naming (when false). (default true)

$ PROMETHEUS_QUERY_SUPPORT_SPANMETRICS_CONNECTOR=false METRICS_STORAGE_TYPE=prometheus go run ./cmd/all-in-one
2023/09/09 20:29:19 using Spanmetrics Processor's metrics naming conventions (deprecated, will be removed after 2024-01-01 or in release v1.53.0, whichever is later)
```

cc @albertteoh

Signed-off-by: Yuri Shkuro <[email protected]>
  • Loading branch information
yurishkuro authored Sep 10, 2023
1 parent 770b60e commit a15f3a3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions plugin/metrics/prometheus/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package prometheus
import (
"flag"
"fmt"
"log"
"strings"
"time"

Expand Down Expand Up @@ -47,6 +48,8 @@ const (
defaultLatencyUnit = "ms"
defaultNormalizeCalls = false
defaultNormalizeDuration = false

deprecatedSpanMetricsProcessor = "(deprecated, will be removed after 2024-01-01 or in release v1.53.0, whichever is later) "
)

type namespaceConfig struct {
Expand Down Expand Up @@ -91,9 +94,10 @@ func (opt *Options) AddFlags(flagSet *flag.FlagSet) {
"The path to a file containing the bearer token which will be included when executing queries against the Prometheus API.")
flagSet.Bool(nsConfig.namespace+suffixOverrideFromContext, true,
"Whether the bearer token should be overridden from context (incoming request)")

flagSet.Bool(nsConfig.namespace+suffixSupportSpanmetricsConnector, defaultSupportSpanmetricsConnector,
`Whether if queries should be adjusted for OpenTelemetry Collector's spanmetrics connector.'`)
flagSet.Bool(
nsConfig.namespace+suffixSupportSpanmetricsConnector,
defaultSupportSpanmetricsConnector,
deprecatedSpanMetricsProcessor+" Controls whether the metrics queries should match the OpenTelemetry Collector's spanmetrics connector naming (when true) or spanmetrics processor naming (when false).")
flagSet.String(nsConfig.namespace+suffixMetricNamespace, defaultMetricNamespace,
`The metric namespace that is prefixed to the metric name. A '.' separator will be added between `+
`the namespace and the metric name.`)
Expand Down Expand Up @@ -124,6 +128,9 @@ func (opt *Options) InitFromViper(v *viper.Viper) error {
cfg.TokenFilePath = v.GetString(cfg.namespace + suffixTokenFilePath)

cfg.SupportSpanmetricsConnector = v.GetBool(cfg.namespace + suffixSupportSpanmetricsConnector)
if !cfg.SupportSpanmetricsConnector {
log.Printf("using Spanmetrics Processor's metrics naming conventions " + deprecatedSpanMetricsProcessor)
}
cfg.MetricNamespace = v.GetString(cfg.namespace + suffixMetricNamespace)
cfg.LatencyUnit = v.GetString(cfg.namespace + suffixLatencyUnit)
cfg.NormalizeCalls = v.GetBool(cfg.namespace + suffixNormalizeCalls)
Expand Down

0 comments on commit a15f3a3

Please sign in to comment.