open-telemetry / open-telemetry/opentelemetry-java-instrumentation

Marking agent auto instrumentation span as ok from code

Open
#13,288 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs triage
Dominant language
Java
Stars
2.6k
Forks
1.2k
Avg merge
2d 18h
Merged PRs (30d)
228

Description

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

We are calling a Postgres DB and getting exceptions for the normal flow of things (we shouldn't, but do). In the current code we set the span status to ok when we catch the exception. But this is not reflected in the child span started by the agent auto instrumentation.

We would like these to be set as OK, but need to do this from the call site (the parent span). Could it be possible to add a context attribute to say something to the agent about expected results?

We're using Applicationinsights agent, which is a repackaged OT agent to my understanding.

Describe the solution you'd like

A way to update the child as ok. A less optimal way could be to instruct the agent to disable auto instrumentation for the following call.

Describe alternatives you've considered

I see there are options to disable a certain auto instrumentation and filter on classes etc, but this is actually more fine grained than that.

Additional context

No response

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 reviewing the Java agent's auto-instrumentation behavior for PostgreSQL calls and how parent span status changes relate to child spans. Determine whether a call-site context attribute can mark an expected exception as OK or selectively disable instrumentation; done means one supported mechanism is defined and its behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql
Domain
databases, observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.