open-telemetry / open-telemetry/opentelemetry-java

AutoConfiguredOpenTelemetrySdk, when configured with ResourceProviders loses logs on startup

Open
#7,649 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
3d 17h
Merged PRs (30d)
58

Description

Describe the bug
A clear and concise description of what the bug is.

If

  1. I am using AutoConfiguredOpenTelemetrySdk instead of OpenTelemetrySdk
  2. I have opentelemetry-resources in my classpath
  3. I am using logback appender.

Then I lose the logs emitted before the install command is called.

If I

  1. either use OpenTelemetrySdk or don't have opentelemetry-resources in my classpath

I do not have this issue.

Also if I set a debug endpoint I can see the queued items in the "pre-install" in the logback correctly drained
and if I slowly step through the "emit" loop, most of them appear. This implies some sort of race.

Steps to reproduce
If possible, provide a recipe for reproducing the error.

  1. docker run -p 3000:3000 -p 4317:4317 -p 4318:4318 --rm -ti grafana/otel-lgtm
  2. System property pointing to logback file: -Dlogging.config=/Users/mbell/git/service-otj-mvc-demo/src/main/resources/logback-local.xml
  3. Env Vars: OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317;OTEL_EXPORTER_OTLP_PROTOCOL=grpc

What did you expect to see?
A clear and concise description of what you expected to see.
Several hundred log lines that had been queued

What did you see instead?
A clear and concise description of what you saw instead.
A couple of log lines

What version and what artifacts are you using?
Artifacts: (e.g., opentelemetry-api, opentelemetry-sdk, which exporters, etc)
Version: (e.g., v0.4.0, 1eb551b, etc)
How did you reference these artifacts? (excerpt from your build.gradle, pom.xml, etc)

<opentelemetry-instrumentation-bom.version>2.19.0-alpha</opentelemetry-instrumentation-bom.version>
<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.opentelemetry.instrumentation</groupId>
                <artifactId>opentelemetry-instrumentation-bom-alpha</artifactId>
                <version>${opentelemetry-instrumentation-bom.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>

Environment
Compiler: Correttto 17
OS:mac

Additional context
Add any other context about the problem here.

Spring 3.5.5. I'm using "Autoconfiguration", but not instrumentation nor Spring Boot AutoConfiguration/starter

If I add -Dotel.java.enabled.resource.providers=io.opentelemetry.sdk.autoconfigure.EnvironmentResourceProvider

which from the docs implies to me this is the ONLY configured ResourceProvider. Things work

this implies to me a faulty resource provider, but I don't know how to find it

logback-local.xml

WireOpenTelemetry.java

DemoServerMain.java

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the startup behavior with AutoConfiguredOpenTelemetrySdk, opentelemetry-resources, the logback appender, and the provided WireOpenTelemetry.java, DemoServerMain.java, and logback-local.xml files. Compare normal resource-provider discovery with the explicit EnvironmentResourceProvider setting; done means the several hundred pre-install queued log lines are delivered rather than only a couple.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.