File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ require (
1212require (
1313 github.com/itchyny/gojq v0.12.19
1414 github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
15+ github.com/spf13/pflag v1.0.9
1516 github.com/stretchr/testify v1.11.1
1617 github.com/tetratelabs/wazero v1.11.0
1718 go.opentelemetry.io/otel v1.43.0
@@ -34,7 +35,6 @@ require (
3435 github.com/pmezard/go-difflib v1.0.0 // indirect
3536 github.com/segmentio/asm v1.1.3 // indirect
3637 github.com/segmentio/encoding v0.5.4 // indirect
37- github.com/spf13/pflag v1.0.9 // indirect
3838 github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
3939 go.opentelemetry.io/auto/sdk v1.2.1 // indirect
4040 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 // indirect
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import (
1010 "github.com/github/gh-aw-mcpg/internal/config"
1111)
1212
13- func TestRegisterTracingFlags_DefaultsFromEnvAndConfig (t * testing.T ) {
13+ func TestRegisterTracingFlags_DefaultsFromEnv (t * testing.T ) {
1414 t .Setenv ("OTEL_EXPORTER_OTLP_ENDPOINT" , "http://collector:4318" )
1515 t .Setenv ("OTEL_SERVICE_NAME" , "test-service" )
1616
@@ -41,4 +41,14 @@ func TestRegisterTracingFlags_DefaultsFromEnvAndConfig(t *testing.T) {
4141 actualSampleRate , err := cmd .Flags ().GetFloat64 ("otlp-sample-rate" )
4242 require .NoError (t , err )
4343 assert .Equal (t , config .DefaultTracingSampleRate , actualSampleRate )
44+
45+ err = cmd .ParseFlags ([]string {
46+ "--otlp-endpoint=http://override:4318" ,
47+ "--otlp-service-name=override-service" ,
48+ "--otlp-sample-rate=0.25" ,
49+ })
50+ require .NoError (t , err )
51+ assert .Equal (t , "http://override:4318" , endpoint )
52+ assert .Equal (t , "override-service" , service )
53+ assert .Equal (t , 0.25 , sampleRate )
4454}
You can’t perform that action at this time.
0 commit comments