open-telemetry / open-telemetry/opentelemetry-java-contrib

Structured Logging Trace Propagation for Google Cloud Logging

Open
#942 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Java
Stars
269
Forks
196
Avg merge
2d 7h
Merged PRs (30d)
38

Description

Is your feature request related to a problem? Please describe.

Structured logging with the JbossLogManager does not propagate the spanId and trace in a form where Google Cloud logging can work with it. The jboss-logmanager-mdc extension can add spanId etc. to the MDC context, but this does not end up on the root object when logged and also doesn't match the keys that Cloud Logging expects.

Describe the solution you'd like

Ideally there would be instrumentation of JbossLogManager and other LogManagers that add the spanId etc. when structured logging is used.
Specifically those three fields semantically understood by Cloud Logging:

  • logging.googleapis.com/spanId
  • logging.googleapis.com/trace (GCP specific)
  • logging.googleapis.com/trace_sampled

Currently the Java LogManager is pretty limited in terms of what root level keys are allowed, so probably one would have to instrument the actual formatter. For example here.

Describe alternatives you've considered
In the case of Quarkus, one could also use manual instrumentation instead of the agent, though that is less convenient.

Additional context

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 with the existing jboss-logmanager-mdc-1.1 instrumentation and the JBoss LogManager StructuredFormatter.java entry point mentioned in the issue. Review the Cloud Logging documentation for the required field semantics and determine how structured output currently handles MDC data. Done means structured logs expose logging.googleapis.com/spanId, logging.googleapis.com/trace, and logging.googleapis.com/trace_sampled in the expected form.

Written by the indexing model from the issue text.

Assessment

Tech stack
google-cloud, java
Domain
observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.