Skip to content

Commit

Permalink
Merge pull request #62 from odigos-io/set-odigos-sampler-only-where-t…
Browse files Browse the repository at this point in the history
…racesprovider-created

fix: avoid errors in py app in case no destination configured
  • Loading branch information
blumamir authored Jan 7, 2025
2 parents c60a2bf + a01a5d8 commit 181556e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions initializer/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def initialize_components(trace_exporters = None, metric_exporters = None, log_e
.merge(Resource.create(auto_resource))

odigos_sampler = initialize_traces_if_enabled(trace_exporters, resource, span_processor)
client.sampler = odigos_sampler
if odigos_sampler is not None :
client.sampler = odigos_sampler

initialize_metrics_if_enabled(metric_exporters, resource)
initialize_logging_if_enabled(log_exporters, resource)

Expand Down Expand Up @@ -105,7 +107,9 @@ def initialize_traces_if_enabled(trace_exporters, resource, span_processor = Non
if span_processor is not None:
provider.add_span_processor(span_processor)

return odigos_sampler
return odigos_sampler

return None

def initialize_metrics_if_enabled(metric_exporters, resource):
metrics_enabled = os.getenv(sdk_config.OTEL_METRICS_EXPORTER, "none").strip().lower()
Expand Down

0 comments on commit 181556e

Please sign in to comment.