Skip to content

Commit

Permalink
Deprecate jaeger-thrift-splunk trace exporter (#2690)
Browse files Browse the repository at this point in the history
  • Loading branch information
pellared authored Dec 18, 2023
1 parent 6361675 commit 0ee17a2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Deprecated

- `jaeger-thrift-splunk` trace exporter is deprecated and may be removed
in a future release. Use the default OTLP exporter instead,
or set the `SPLUNK_REALM` and `SPLUNK_ACCESS_TOKEN` environment variables
to send telemetry directly to Splunk Observability Cloud. (#2690)

## [1.11.0] - 2023-11-16

The release adds support for sending metrics directly to Splunk Observability Cloud.
Expand Down
8 changes: 5 additions & 3 deletions distro/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"google.golang.org/grpc/credentials/insecure"
)

type traceExporterFunc func(*exporterConfig) (trace.SpanExporter, error)
type traceExporterFunc func(logr.Logger, *exporterConfig) (trace.SpanExporter, error)

// traceExporters maps environment variable values to trace exporter creation
// functions.
Expand All @@ -57,7 +57,7 @@ func tracesExporter(log logr.Logger) traceExporterFunc {
return tef
}

func newOTLPTracesExporter(c *exporterConfig) (trace.SpanExporter, error) {
func newOTLPTracesExporter(_ logr.Logger, c *exporterConfig) (trace.SpanExporter, error) {
ctx := context.Background()

splunkEndpoint := otlpRealmTracesEndpoint()
Expand Down Expand Up @@ -135,7 +135,9 @@ func otlpRealmMetricsEndpoint() string {
return ""
}

func newJaegerThriftExporter(c *exporterConfig) (trace.SpanExporter, error) {
func newJaegerThriftExporter(log logr.Logger, c *exporterConfig) (trace.SpanExporter, error) {
log.Info("OTEL_TRACES_EXPORTER=jaeger-thrift-splunk is deprecated and may be removed in a future release. Use the default OTLP exporter instead, or set the SPLUNK_REALM and SPLUNK_ACCESS_TOKEN environment variables to send telemetry directly to Splunk Observability Cloud.")

var opts []jaeger.CollectorEndpointOption

if e := jaegerEndpoint(); e != "" {
Expand Down
2 changes: 1 addition & 1 deletion distro/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func runTraces(c *config, res *resource.Resource) (shutdownFunc, error) {
return nil, nil
}

exp, err := c.TracesExporterFunc(c.ExportConfig)
exp, err := c.TracesExporterFunc(c.Logger, c.ExportConfig)
if err != nil {
return nil, err
}
Expand Down
15 changes: 15 additions & 0 deletions distro/otel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,21 @@ func TestNoServiceWarn(t *testing.T) {
assert.Contains(t, buf.String(), `INFO service.name attribute is not set. Your service is unnamed and might be difficult to identify. Set your service name using the OTEL_SERVICE_NAME environment variable. For example, OTEL_SERVICE_NAME="<YOUR_SERVICE_NAME_HERE>")`)
}

func TestJaegerThriftSplunkWarn(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}))
defer srv.Close()
t.Setenv("OTEL_TRACES_EXPORTER", "jaeger-thrift-splunk")
t.Setenv("OTEL_EXPORTER_JAEGER_ENDPOINT", srv.URL)

var buf bytes.Buffer
sdk, err := distro.Run(distro.WithLogger(buflogr.NewWithBuffer(&buf)))

require.NoError(t, sdk.Shutdown(context.Background()))
require.NoError(t, err)
// INFO prefix for buflogr is verbosity level 0, our warn level.
assert.Contains(t, buf.String(), `INFO OTEL_TRACES_EXPORTER=jaeger-thrift-splunk is deprecated and may be removed in a future release. Use the default OTLP exporter instead, or set the SPLUNK_REALM and SPLUNK_ACCESS_TOKEN environment variables to send telemetry directly to Splunk Observability Cloud.`)
}

// setenv sets the value of the environment variable named by the key.
// It returns a function that rollbacks the setting.
func setenv(key, val string) func() {
Expand Down

0 comments on commit 0ee17a2

Please sign in to comment.