You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We are using otel to auto instrumentation with our app in k8s cluster.
And want to set deployment.environment to OTEL_RESOURCE_ATTRIBUTES, but the value will be empty sometimes.
When it's empty, the java app will throw exception.
Like the log of below, the keyvalue pair is deployment.environment=, the value is empty, so it throw an exception
Defaulted container "app" out of: app, opentelemetry-auto-instrumentation (init)
Picked up JAVA_TOOL_OPTIONS: -javaagent:/otel-auto-instrumentation/javaagent.jar
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
[otel.javaagent 2023-08-25 06:18:22:787 +0000] [main] INFO io.opentelemetry.javaagent.tooling.VersionLogger - opentelemetry-javaagent - version: 1.28.0
OpenTelemetry Javaagent failed to start
io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException: Invalid map property: otel.resource.attributes=sampler.ratio=1,service.instance.id=default/spring-petclinic-d5ffdc96c-j9brn,deployment.environment=,k8s.container.name=app,k8s.deployment.name=spring-petclinic,k8s.namespace.name=default,k8s.node.name=docker-desktop,k8s.pod.name=spring-petclinic-d5ffdc96c-j9brn,k8s.replicaset.name=spring-petclinic-d5ffdc96c,service.version=latest
at io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties.lambda$getMap$6(DefaultConfigProperties.java:217)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties.getMap(DefaultConfigProperties.java:224)
at io.opentelemetry.instrumentation.spring.resources.SpringBootServiceNameDetector.shouldApply(SpringBootServiceNameDetector.java:107)
at io.opentelemetry.sdk.autoconfigure.ResourceConfiguration.configureResource(ResourceConfiguration.java:101)
at io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder.build(AutoConfiguredOpenTelemetrySdkBuilder.java:335)
at io.opentelemetry.javaagent.tooling.OpenTelemetryInstaller.installOpenTelemetrySdk(OpenTelemetryInstaller.java:34)
at io.opentelemetry.javaagent.tooling.AgentInstaller.installBytebuddyAgent(AgentInstaller.java:121)
at io.opentelemetry.javaagent.tooling.AgentInstaller.installBytebuddyAgent(AgentInstaller.java:101)
at io.opentelemetry.javaagent.tooling.AgentStarterImpl.start(AgentStarterImpl.java:98)
at io.opentelemetry.javaagent.bootstrap.AgentInitializer$1.run(AgentInitializer.java:53)
at io.opentelemetry.javaagent.bootstrap.AgentInitializer$1.run(AgentInitializer.java:47)
at io.opentelemetry.javaagent.bootstrap.AgentInitializer.execute(AgentInitializer.java:64)
at io.opentelemetry.javaagent.bootstrap.AgentInitializer.initialize(AgentInitializer.java:46)
at io.opentelemetry.javaagent.OpenTelemetryAgent.startAgent(OpenTelemetryAgent.java:57)
at io.opentelemetry.javaagent.OpenTelemetryAgent.premain(OpenTelemetryAgent.java:45)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:491)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:503)
Describe the solution you'd like
we should keep the keyvalue pair even the value is empty
This is a good example. I would have expected the kubernetes environment variable substitution syntax to support setting a fallback / default, something like $(OTEL_RESOURCE_ATTRIBUTES_DEPLOYMENT_ENVIRONMENT:-foo), but it appears that's not the case.
You're right @jack-berg . And you have a well consideration for environment's default value, this will work fine for more cases include empty string case.
But as for now the offfical specification dont't have any thing about env default. So i think we could allow empty-value-pair just like other languages and avoid this kind of exception.
Is your feature request related to a problem? Please describe.
We are using otel to auto instrumentation with our app in k8s cluster.
And want to set deployment.environment to OTEL_RESOURCE_ATTRIBUTES, but the value will be empty sometimes.
When it's empty, the java app will throw exception.
Like the log of below, the keyvalue pair is
deployment.environment=
, the value is empty, so it throw an exceptionDescribe the solution you'd like
we should keep the keyvalue pair even the value is empty
Describe alternatives you've considered
Additional context
the Instrumentation config
The text was updated successfully, but these errors were encountered: