Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"service.name" not picked up by Jaeger exporter #5944

Closed
indexKevinBoak opened this issue Oct 27, 2023 · 4 comments
Closed

"service.name" not picked up by Jaeger exporter #5944

indexKevinBoak opened this issue Oct 27, 2023 · 4 comments
Labels
Bug Something isn't working needs author feedback Waiting for additional feedback from the author Stale

Comments

@indexKevinBoak
Copy link

Describe the bug

  • Using io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk.
  • "OTEL_SERVICE_NAME" is set as an environment variable (along with many others)
  • Traces from the application are properly being exported to jaeger, but the service.name is showing up as "unknown_service:java"

What did you expect to see?
I expected the service.name to match what was set in the environment variable

What version and what artifacts are you using?
Version 1.31.0 for

@indexKevinBoak indexKevinBoak added the Bug Something isn't working label Oct 27, 2023
@jack-berg
Copy link
Member

This should not be the case and I'm unable to reproduce this behavior myself. Can you create a small sample app reproducing the behavior?

@indexKevinBoak
Copy link
Author

I know it shouldn't be the case.

All of the other variables are being set properly from the environment. I have tried to set the service name via the OTEL_SERVICE_NAME, as well as with OTEL_RESOURCE_ATTRIBUTES, as well as setting System.setProperty("otel.service.name")...

No matter what I do, the jaeger traces just say "unknown_service:java"

Mainly I'm just wondering if there is something I'm not seeing. I've been scouring the github repository for like 2 days, and everything I see leads me to think this should be working.

Env variables set in the image:

export OTEL_TRACES_EXPORTER="jaeger"
export OTEL_EXPORTER_JAEGER_ENDPOINT="http://jaeger-collector.jaeger:14250"
export OTEL_PROPAGATORS="jaeger"
export OTEL_TRACES_SAMPLER="parentbased_traceidratio"
export OTEL_TRACES_SAMPLER_ARG="1"
export OTEL_METRICS_EXPORTER="none"
export OTEL_LOGS_EXPORTER="none"
export OTEL_SERVICE_NAME="my-service"
export OTEL_RESOURCE_ATTRIBUTES="service.name=my-service"

In the code:

try {
      otelsdk = AutoConfiguredOpenTelemetrySdk
        .initialize()
        .getOpenTelemetrySdk()
      tracer = otelsdk.getTracer("my-tracer")
      span = tracer.spanBuilder(s"my-span").startSpan()
    } catch {
      case e: Throwable => {
        logError(s"failed to initialize open-telemetry: ${e.getMessage}")
        throw e
      }
    }

I then proceed to create custom spans, and they are properly exported... but for some ungodly reason, the "service.name" is not being recognized by the jaeger exporter.

@jack-berg
Copy link
Member

Can you try printing out the string representation of OpenTelemetrySdk? E.g. System.out.println(otelSdk).

Should yield something like this, which tells which configuration is being picked up:

OpenTelemetrySdk{tracerProvider=SdkTracerProvider{clock=SystemClock{}, idGenerator=RandomIdGenerator{}, resource=Resource{schemaUrl=null, attributes={animal="cat", cat="meow", color="blue", service.name="test", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.32.0-SNAPSHOT"}}, spanLimitsSupplier=SpanLimitsValue{maxNumberOfAttributes=2, maxNumberOfEvents=128, maxNumberOfLinks=128, maxNumberOfAttributesPerEvent=128, maxNumberOfAttributesPerLink=128, maxAttributeValueLength=2147483647}, sampler=ParentBased{root:AlwaysOnSampler,remoteParentSampled:AlwaysOnSampler,remoteParentNotSampled:AlwaysOffSampler,localParentSampled:AlwaysOnSampler,localParentNotSampled:AlwaysOffSampler}, spanProcessor=MultiSpanProcessor{spanProcessorsStart=[io.opentelemetry.sdk.autoconfigure.provider.TestTracerProviderConfigurer$1@4fbbfea6], spanProcessorsEnd=[BatchSpanProcessor{spanExporter=io.opentelemetry.sdk.autoconfigure.provider.SpanExporterCustomizer$1@1bf8ea44, scheduleDelayNanos=5000000000, maxExportBatchSize=512, exporterTimeoutNanos=30000000000}], spanProcessorsAll=[BatchSpanProcessor{spanExporter=io.opentelemetry.sdk.autoconfigure.provider.SpanExporterCustomizer$1@1bf8ea44, scheduleDelayNanos=5000000000, maxExportBatchSize=512, exporterTimeoutNanos=30000000000}, io.opentelemetry.sdk.autoconfigure.provider.TestTracerProviderConfigurer$1@4fbbfea6]}}, meterProvider=SdkMeterProvider{clock=SystemClock{}, resource=Resource{schemaUrl=null, attributes={animal="cat", cat="meow", color="blue", service.name="test", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.32.0-SNAPSHOT"}}, metricReaders=[PeriodicMetricReader{exporter=io.opentelemetry.sdk.autoconfigure.provider.MetricCustomizer$1@4a6ac443, intervalNanos=60000000000}], metricProducers=[], views=[RegisteredView{instrumentSelector=InstrumentSelector{instrumentName=my-metric}, view=View{aggregation=DefaultAggregation, attributesProcessor=AttributeKeyFilteringProcessor{nameFilter=io.opentelemetry.sdk.autoconfigure.provider.MetricCustomizer$$Lambda$794/0x00000008005d9df8@5ab45d66}, cardinalityLimit=2000}}]}, loggerProvider=SdkLoggerProvider{clock=SystemClock{}, resource=Resource{schemaUrl=null, attributes={animal="cat", cat="meow", color="blue", service.name="test", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.32.0-SNAPSHOT"}}, logLimits=LogLimits{maxNumberOfAttributes=128, maxAttributeValueLength=2147483647}, logRecordProcessor=BatchLogRecordProcessor{logRecordExporter=io.opentelemetry.sdk.autoconfigure.provider.LogRecordExporterCustomizer$1@113a7d12, scheduleDelayNanos=60000000000, maxExportBatchSize=512, exporterTimeoutNanos=30000000000}}, propagators=DefaultContextPropagators{textMapPropagator=MultiTextMapPropagator{textMapPropagators=[W3CTraceContextPropagator, W3CBaggagePropagator, B3Propagator{b3PropagatorInjector=B3PropagatorInjectorSingleHeader}, B3Propagator{b3PropagatorInjector=B3PropagatorInjectorMultipleHeaders}, JaegerPropagator, OtTracePropagator, io.opentelemetry.sdk.autoconfigure.provider.TestConfigurablePropagatorProvider$1@173e4b75]}}}

@jack-berg jack-berg added the needs author feedback Waiting for additional feedback from the author label Nov 3, 2023
Copy link
Contributor

This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

@github-actions github-actions bot added the Stale label Nov 14, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working needs author feedback Waiting for additional feedback from the author Stale
Projects
None yet
Development

No branches or pull requests

2 participants