Skip to content

Commit

Permalink
Deprecate JAEGER tracing exporter
Browse files Browse the repository at this point in the history
Deprecated the JAEGER exporter type and added DEFAULT to the list of supported types.
Also fixed the BDD test to work with the latest version of otel.

Signed-off-by: Bob Stasyszyn <[email protected]>
  • Loading branch information
bstasyszyn committed Oct 28, 2024
1 parent e3a5f2a commit ad33110
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
7 changes: 1 addition & 6 deletions cmd/vc-rest/startcmd/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -1110,12 +1110,7 @@ func getTracingParams(cmd *cobra.Command) (*tracingParams, error) {
serviceName: serviceName,
}

switch params.exporter {
case tracing.None:
case tracing.Jaeger:
case tracing.Stdout:
return params, nil
default:
if !tracing.IsExportedSupported(params.exporter) {
return nil, fmt.Errorf("unsupported otel span exporter: %s", params.exporter)
}

Expand Down
15 changes: 13 additions & 2 deletions pkg/observability/tracing/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ var logger = log.New("tracing")
type SpanExporterType = string

const (
None SpanExporterType = ""
// None is the noop span exporter.
None SpanExporterType = ""
// Default is the default span exporter to be used with any Open Telemetry-compatible agent.
Default SpanExporterType = "DEFAULT"
// Jaeger is the Jaeger span exporter.
//Deprecated: use Default instead.
Jaeger SpanExporterType = "JAEGER"
// Stdout is the stdout span exporter.
Stdout SpanExporterType = "STDOUT"
)

Expand All @@ -56,7 +62,7 @@ func Initialize(exporter SpanExporterType, serviceName string) (func(), trace.Tr
)

switch exporter {
case Jaeger:
case Default, Jaeger:
spanExporter, err = otlptracehttp.New(context.Background())
if err != nil {
return nil, nil, fmt.Errorf("create OTLP HTTP exporter: %w", err)
Expand Down Expand Up @@ -92,3 +98,8 @@ func Initialize(exporter SpanExporterType, serviceName string) (func(), trace.Tr
}
}, tracerProvider.Tracer(tracerName), nil
}

// IsExportedSupported returns true if the given exporter is supported.
func IsExportedSupported(exporter SpanExporterType) bool {
return exporter == None || exporter == Default || exporter == Jaeger || exporter == Stdout
}
13 changes: 10 additions & 3 deletions pkg/observability/tracing/tracing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ func TestInitialize(t *testing.T) {
require.NotPanics(t, shutdown)
})

t.Run("Provider JAEGER", func(t *testing.T) {
t.Setenv("OTEL_EXPORTER_OTLP_ENDPOINT", "OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost")
t.Run("Provider DEFAULT", func(t *testing.T) {
t.Setenv("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost")

shutdown, tracer, err := Initialize("JAEGER", "service1")
shutdown, tracer, err := Initialize("DEFAULT", "service1")
require.NoError(t, err)
require.NotNil(t, shutdown)
require.NotNil(t, tracer)
Expand All @@ -47,3 +47,10 @@ func TestInitialize(t *testing.T) {
require.Nil(t, tracer)
})
}

func TestIsExportedSupported(t *testing.T) {
require.True(t, IsExportedSupported("DEFAULT"))
require.True(t, IsExportedSupported("STDOUT"))
require.True(t, IsExportedSupported("JAEGER"))
require.False(t, IsExportedSupported("unsupported"))
}
9 changes: 4 additions & 5 deletions test/bdd/fixtures/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ services:
- VC_METRICS_PROVIDER_NAME=prometheus
- VC_PROM_HTTP_URL=vc-rest-echo.trustbloc.local:48127
- VC_OAUTH_CLIENTS_FILE_PATH=/oauth-clients/clients.json
- OTEL_EXPORTER_TYPE=JAEGER
- OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger.example.com:14268
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://jaeger.example.com:14268
- OTEL_EXPORTER_TYPE=DEFAULT
- OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger.example.com:4318
- VC_OIDC4VP_RECEIVED_CLAIMS_DATA_TTL=10s
- VC_SYSTEM_VERSION=v1.0.0
- VC_REST_DATA_ENCRYPTION_KEY_ID=bc436485-5092-42b8-92a3-0aa8b93536dc
Expand Down Expand Up @@ -278,11 +277,11 @@ services:

jaeger.example.com:
container_name: jaeger.example.com
image: jaegertracing/all-in-one:1.41
image: jaegertracing/all-in-one:1.62.0
ports:
- 6831:6831/udp
- 16686:16686
- 14268:14268
- 4318:4318
networks:
- bdd_net

Expand Down

0 comments on commit ad33110

Please sign in to comment.