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

Tracing: end HTTP spans when body is fully consumed, add missing methods for OpenAI instrumentation #39381

Merged
merged 8 commits into from
Mar 27, 2024

Conversation

lmolkova
Copy link
Member

Description

  • Fixes
  • Fills most of the gaps for OpenAI instrumentation
    • adds Tracer.isRecording - useful when we want to avoid overhead for sampled-out spans (e.g. we don't need to wrap the HTTP response if span is not sampled in)
    • adds Tracer.setAttribute(String, Object, Context) to support double attributes needed for OpenAI, but we'll also likely need String[]

@@ -102,7 +102,7 @@ public Context start(String spanName, StartSpanOptions options, Context context)
return startSuppressedSpan(context);
}
context = unsuppress(context);
if (spanKind == SpanKind.INTERNAL && !context.getData(CLIENT_METHOD_CALL_FLAG).isPresent()) {
if (isInternalOrClientSpan(spanKind) && !context.getData(CLIENT_METHOD_CALL_FLAG).isPresent()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed for suppression when we have

  • Client (public API) -> Client (public API) -> Client (HTTP)
  • Client (public API) -> Internal (public API) -> Client (HTTP)

spans

@lmolkova lmolkova enabled auto-merge (squash) March 27, 2024 01:05
@lmolkova lmolkova merged commit b8a9d8c into Azure:main Mar 27, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core azure-core OpenTelemetry OpenTelemetry instrumentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants