From 240e48d8b6b5c4feefae1695eb8095f989fdcf8f Mon Sep 17 00:00:00 2001 From: Mark Phelps <209477+markphelps@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:02:06 -0400 Subject: [PATCH] fix: sampling ratio yaml config --- internal/config/testdata/tracing/otlp.yml | 2 +- internal/config/testdata/tracing/wrong_sampling_ratio.yml | 2 +- internal/config/tracing.go | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/config/testdata/tracing/otlp.yml b/internal/config/testdata/tracing/otlp.yml index 15a1125ee7..942098392b 100644 --- a/internal/config/testdata/tracing/otlp.yml +++ b/internal/config/testdata/tracing/otlp.yml @@ -1,7 +1,7 @@ tracing: enabled: true exporter: otlp - samplingRatio: 0.5 + sampling_ratio: 0.5 otlp: endpoint: http://localhost:9999 headers: diff --git a/internal/config/testdata/tracing/wrong_sampling_ratio.yml b/internal/config/testdata/tracing/wrong_sampling_ratio.yml index 12d40e4a00..f52714ac7c 100644 --- a/internal/config/testdata/tracing/wrong_sampling_ratio.yml +++ b/internal/config/testdata/tracing/wrong_sampling_ratio.yml @@ -1,3 +1,3 @@ tracing: enabled: true - samplingRatio: 1.1 + sampling_ratio: 1.1 diff --git a/internal/config/tracing.go b/internal/config/tracing.go index f771ddde81..aaacca142f 100644 --- a/internal/config/tracing.go +++ b/internal/config/tracing.go @@ -17,7 +17,7 @@ type TracingConfig struct { Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` Exporter TracingExporter `json:"exporter,omitempty" mapstructure:"exporter" yaml:"exporter,omitempty"` Propagators []TracingPropagator `json:"propagators,omitempty" mapstructure:"propagators" yaml:"propagators,omitempty"` - SamplingRatio float64 `json:"samplingRatio,omitempty" mapstructure:"samplingRatio" yaml:"samplingRatio,omitempty"` + SamplingRatio float64 `json:"samplingRatio,omitempty" mapstructure:"samplingRatio" yaml:"sampling_ratio,omitempty"` Jaeger JaegerTracingConfig `json:"jaeger,omitempty" mapstructure:"jaeger" yaml:"jaeger,omitempty"` Zipkin ZipkinTracingConfig `json:"zipkin,omitempty" mapstructure:"zipkin" yaml:"zipkin,omitempty"` OTLP OTLPTracingConfig `json:"otlp,omitempty" mapstructure:"otlp" yaml:"otlp,omitempty"` @@ -25,9 +25,9 @@ type TracingConfig struct { func (c *TracingConfig) setDefaults(v *viper.Viper) error { v.SetDefault("tracing", map[string]any{ - "enabled": false, - "exporter": TracingJaeger, - "samplingRatio": 1, + "enabled": false, + "exporter": TracingJaeger, + "sampling_ratio": 1, "propagators": []TracingPropagator{ TracingPropagatorTraceContext, TracingPropagatorBaggage,