-
Notifications
You must be signed in to change notification settings - Fork 21
Genesis LLO Support in ADOT SDK #361
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
base: genesis-dev-v2
Are you sure you want to change the base?
Genesis LLO Support in ADOT SDK #361
Conversation
afd727c
to
49069e2
Compare
49069e2
to
f4e93d6
Compare
dbc0fcf
to
d04f786
Compare
""" | ||
events = [] | ||
span_ctx = span.context | ||
gen_ai_system = span.attributes.get("traceloop.entity.name", "unknown") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gen_ai.system
is not always available in the span. This is a best attempt at still retrieving a relevant value.
all_events = [] | ||
all_events.extend(self._extract_gen_ai_prompt_events(span, attributes, event_timestamp)) | ||
all_events.extend(self._extract_gen_ai_completion_events(span, attributes, event_timestamp)) | ||
all_events.extend(self._extract_traceloop_events(span, attributes, event_timestamp)) | ||
all_events.extend(self._extract_openlit_span_event_attributes(span, attributes, event_timestamp)) | ||
all_events.extend(self._extract_openinference_attributes(span, attributes, event_timestamp)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Support for more third-party SDKs can be added by following this pattern.
I don't think we can go further with isolating these rules since there is no consistent and generic way to determine which SDK family is being instrumented. Also, many of these third-party SDKs may have overlapping rules for generic OTel attributes such as gen_ai.prompt.{n}.content
and gen_ai.completion.{n}.content
.
logging_enabled = os.getenv(_OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED, "false") | ||
if logging_enabled.strip().lower() == "true": | ||
_init_logging(log_exporters, resource) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed order of pipeline initialization so we can pass the global logger provider instance to the span pipeline if AGENT_OBSERVABILITY_ENABLED
flag is enabled.
import sys | ||
from logging import Logger, getLogger | ||
|
||
import pkg_resources | ||
|
||
_logger: Logger = getLogger(__name__) | ||
|
||
AGENT_OBSERVABILITY_ENABLED = "AGENT_OBSERVABILITY_ENABLED" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LLO handling is gated behind this configuration. If false, then the ADOT SDK will have default behavior in span and logs pipelines.
What does this pull request do?
Adds support to handle LLO from third-party instrumentation SDKs in ADOT SDK.
The following SDKs are supported:
Note: OTel dependencies in ADOT SDK have been loosened as a short-term workaround to support the various conflicting dependency requirements of third-party instrumentation SDKs.
Test plan
Built this custom ADOT SDK into various sample apps and exported the span and logs data to the OTLP X-Ray and Logs endpoint, respectively, to validate the LLO extraction and transformation to Gen AI Events.
Configurations tested:
Environment variable configuration:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.