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

Observability - Prompt content and completion as span events #1237

Conversation

ThomasVitale
Copy link
Contributor

@ThomasVitale ThomasVitale commented Aug 17, 2024

Currently, prompt content and completion can optionally be included as span attributes when model observability is enabled. That was a temporary solution because span attributes are not ideal for potentially long text.

This PR stores such content as span events instead whenever the underlying tracing technology supports them (i.e. OpenTelemetry), and it falls back on span attributes when the underlying tracing technology doesn't support span events (i.e. Zipkin/Brave).

The OpenTelemetry Semantic Conventions for GenAI also defines span events for the prompt content and completion data in the current release (1.27.0): https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/#events

The solution in this PR relies on Reflection. It can be simplified if and when this issue is solved: micrometer-metrics/tracing#808.

In the future, when Micrometer supports span events, the fallback solution based on span attributes can be removed entirely (see: micrometer-metrics/micrometer#5238).

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
@ThomasVitale ThomasVitale changed the title Prompt content and completion as span events Observability - Prompt content and completion as span events Aug 17, 2024
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.*;
Copy link
Member

Choose a reason for hiding this comment

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

need to set your ide to not use .*

@markpollack
Copy link
Member

merged in 3fa102e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants