feat: add GalileoSpanProcessor and GalileoOTLPExporter#392
feat: add GalileoSpanProcessor and GalileoOTLPExporter#392Focadecombate merged 3 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #392 +/- ##
==========================================
- Coverage 86.23% 86.14% -0.09%
==========================================
Files 75 76 +1
Lines 5942 6012 +70
==========================================
+ Hits 5124 5179 +55
- Misses 818 833 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/galileo/otel.py
Outdated
| self, | ||
| project: Optional[str] = None, | ||
| logstream: Optional[str] = None, | ||
| api_key: Optional[str] = None, |
There was a problem hiding this comment.
The api_key and base_url values are provided thru the GalileoPythonConfig objects. This would be the first method to accept this value as a parameter creating an special case in the SDK. I don't think this is the path we want to follow.
There was a problem hiding this comment.
Commit 57038f9 addressed this comment by completely removing the api_key and base_url parameters from the method signatures and replacing them with values obtained from GalileoPythonConfig.get(). This eliminates the special case concern and follows the desired pattern of using GalileoPythonConfig objects for configuration values.
There was a problem hiding this comment.
Implemented it!
src/galileo/otel.py
Outdated
| logstream: Optional[str] = None, | ||
| api_key: Optional[str] = None, | ||
| base_url: Optional[str] = None, | ||
| headers: Optional[dict[str, str]] = None, |
There was a problem hiding this comment.
What’s the use case for allowing the header to be passed as a parameter? Why would we want to let the user add additional header values?
There was a problem hiding this comment.
Commit 57038f9 addressed this comment by removing the ability for users to pass custom headers as a parameter. The headers are now constructed internally using configuration values (API key, project, logstream) from GalileoPythonConfig, eliminating the potential for users to add arbitrary header values that the commenter was questioning.
There was a problem hiding this comment.
I'll remove it. If we need it, we can use the following OTEL env var OTEL_EXPORTER_OTLP_HEADERS.
ed7d776 to
57038f9
Compare
57038f9 to
89fa1bb
Compare
89fa1bb to
d087367
Compare
d087367 to
04d72cc
Compare
04d72cc to
3306d5a
Compare
| endpoint: str = urljoin(base_url, "otel/traces") | ||
|
|
||
| if not config.api_key: | ||
| raise ValueError("API key is required.") |
There was a problem hiding this comment.
overall looks good. just a nit. You may want to make Error actionable by pointing to docs or in fact directly to cluster api keys (e.g., https://app.galileo.ai/default/settings/api-keys).
User description
Shortcut: SC-43420
Description:
This PR adds OpenTelemetry (OTEL) integration to the Galileo Python SDK, enabling users to export trace data to Galileo using standard OTEL protocols.
Key Components:
GalileoOTLPExporter- Preconfigured OTLP exporter for Galileo platformGalileoSpanProcessor- Complete span processor with integrated Galileo export functionalityopentelemetry-sdk,opentelemetry-api,opentelemetry-exporter-otlppip install galileo[otel]Features:
GalileoSpanProcessor(project="my-project")GALILEO_API_KEY,GALILEO_PROJECT, etc.)Usage:
Tests:
Generated description
Below is a concise technical summary of the changes proposed in this PR:
graph LR GalileoSpanProcessor_init_("GalileoSpanProcessor.__init__"):::added GalileoOTLPExporter_init_("GalileoOTLPExporter.__init__"):::added BatchSpanProcessor_("BatchSpanProcessor"):::added SpanProcessor_("SpanProcessor"):::added GalileoSpanProcessor_on_start_("GalileoSpanProcessor.on_start"):::added GalileoSpanProcessor_processor_("GalileoSpanProcessor.processor"):::added GalileoSpanProcessor_on_end_("GalileoSpanProcessor.on_end"):::added GalileoSpanProcessor_shutdown_("GalileoSpanProcessor.shutdown"):::added GalileoSpanProcessor_force_flush_("GalileoSpanProcessor.force_flush"):::added GalileoSpanProcessor_exporter_("GalileoSpanProcessor.exporter"):::added GalileoOTLPExporter_("GalileoOTLPExporter"):::added GalileoSpanProcessor_init_ -- "Initializes exporter with project and logstream configuration." --> GalileoOTLPExporter_init_ GalileoSpanProcessor_init_ -- "Uses BatchSpanProcessor for efficient batch span processing." --> BatchSpanProcessor_ GalileoSpanProcessor_init_ -- "Uses SpanProcessor as base for underlying processor." --> SpanProcessor_ GalileoSpanProcessor_on_start_ -- "Delegates span start handling to underlying processor." --> GalileoSpanProcessor_processor_ GalileoSpanProcessor_on_end_ -- "Delegates span end handling to underlying processor." --> GalileoSpanProcessor_processor_ GalileoSpanProcessor_shutdown_ -- "Gracefully shuts down and flushes remaining spans." --> GalileoSpanProcessor_processor_ GalileoSpanProcessor_force_flush_ -- "Immediately exports all pending spans." --> GalileoSpanProcessor_processor_ GalileoSpanProcessor_exporter_ -- "Provides access to underlying Galileo OTLP exporter." --> GalileoOTLPExporter_ classDef added stroke:#15AA7A classDef removed stroke:#CD5270 classDef modified stroke:#EDAC4C linkStyle default stroke:#CBD5E1,font-size:13pxIntegrates OpenTelemetry (OTel) tracing into the
galileo-pythonSDK, enabling users to export trace data to the Galileo platform using standard OTel protocols. ProvidesGalileoOTLPExporterto configure OTLP export andGalileoSpanProcessorto manage the lifecycle of spans.otelextra for simplified installation, ensuring compatibility and modularity.Modified files (2)
Latest Contributors(2)
GalileoOTLPExporterto configure OpenTelemetry Protocol (OTLP) export to the Galileo platform andGalileoSpanProcessorto manage the lifecycle of spans, including graceful degradation if OTel dependencies are not installed.Modified files (2)
Latest Contributors(0)