Skip to content

Commit

Permalink
Set OTEL_TRACES_SAMPLER to always on (#552)
Browse files Browse the repository at this point in the history
* Add host detector

* Lint

* Remove Telemetry type

* Set default sampler

* Update release notes

* Lint

* Fix test
  • Loading branch information
pmcollins authored Nov 25, 2024
1 parent 9ea7b96 commit efe97b0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
27 changes: 14 additions & 13 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@ Summary of changes between Splunk OTel Python major versions 1 and 2.

## Environment Variables

| Variable | v2 default | v1 -> v2 changes | Description |
|---------------------------------------|------------|--------------------------------------|--------------------------------------------------------------------------------------------------------------------|
| SPLUNK_ACCESS_TOKEN | | None | Adds token to requests to enable direct ingest (for skipping the collector) |
| OTEL_METRICS_ENABLED | true | None | Causes metrics to be configured (with an otlp-grpc metric exporter and a SystemMetricInstrumentor) |
| OTEL_METRICS_EXPORTER | otlp | Hard coded in v1, configurable in v2 | Indicates the metrics exporter |
| OTEL_TRACE_ENABLED | true | None | Causes tracing to be configured and instrumentors loaded |
| OTEL_TRACES_EXPORTER | otlp | None | Indicates the traces exporter |
| OTEL_PYTHON_DISABLED_INSTRUMENTATIONS | | None | Disables instrumentations by entrypoint name |
| SPLUNK_PROFILER_ENABLED | false | None | Causes the Splunk profiler to start polling at startup |
| OTEL_SPAN_LINK_COUNT_LIMIT | 1000 | None | Sets the maximum allowed span link count |
| OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT | 12000 | None | Sets the maximum allowed attribute value size |
| SPLUNK_TRACE_RESPONSE_HEADER_ENABLED | true | None | Causes a ServerTimingReponsePropagator to be configured if true (injects tracecontext headers into HTTP responses) |
| OTEL_EXPERIMENTAL_RESOURCE_DETECTORS | host | Not set in v1 | Causes a host resource detector to be configured to set telemetry attributes |
| Variable | v2 default | v1 -> v2 changes | Description |
|---------------------------------------|------------|----------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|
| SPLUNK_ACCESS_TOKEN | | None | Adds token to requests to enable direct ingest (for skipping the collector) |
| OTEL_METRICS_ENABLED | true | None | Causes metrics to be configured (with an otlp-grpc metric exporter and a SystemMetricInstrumentor) |
| OTEL_METRICS_EXPORTER | otlp | Hard coded in v1, configurable in v2 | Indicates the metrics exporter |
| OTEL_TRACE_ENABLED | true | None | Causes tracing to be configured and instrumentors loaded |
| OTEL_TRACES_EXPORTER | otlp | None | Indicates the traces exporter |
| OTEL_PYTHON_DISABLED_INSTRUMENTATIONS | | None | Disables instrumentations by entrypoint name |
| SPLUNK_PROFILER_ENABLED | false | None | Causes the Splunk profiler to start polling at startup |
| OTEL_SPAN_LINK_COUNT_LIMIT | 1000 | None | Sets the maximum allowed span link count |
| OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT | 12000 | None | Sets the maximum allowed attribute value size |
| SPLUNK_TRACE_RESPONSE_HEADER_ENABLED | true | None | Causes a ServerTimingReponsePropagator to be configured if true (injects tracecontext headers into HTTP responses) |
| OTEL_EXPERIMENTAL_RESOURCE_DETECTORS | host | Not set in v1 | Causes a host resource detector to be configured to set telemetry attributes |
| OTEL_TRACES_SAMPLER | always_on | Not set in v1 (took upstream default of parentbased_always_on) | |

## Auto-instrumentation

Expand Down
1 change: 1 addition & 0 deletions src/splunk_otel/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"OTEL_SPAN_LINK_COUNT_LIMIT": "1000",
"OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT": "12000",
"OTEL_EXPERIMENTAL_RESOURCE_DETECTORS": "host",
"OTEL_TRACES_SAMPLER": "always_on",
}

OTEL_TRACE_ENABLED = "OTEL_TRACE_ENABLED"
Expand Down
1 change: 0 additions & 1 deletion tests/ott_trace_loop.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from oteltest.telemetry import count_spans, extract_leaves, get_attribute

from ott_lib import project_path, trace_loop

NUM_SPANS = 12
Expand Down
2 changes: 1 addition & 1 deletion tests/test_distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_distro_env():
env_store = {}
configure_distro(env_store)
assert env_store["OTEL_TRACES_EXPORTER"] == "otlp"
assert len(env_store) == 12
assert len(env_store) == 14


def test_access_token():
Expand Down

0 comments on commit efe97b0

Please sign in to comment.