Skip to content

Commit

Permalink
Add host detector (#551)
Browse files Browse the repository at this point in the history
* Bump upstream otel versions.
Remove cryptography library (from v1, not used?)
Remove protobuf library (version pin conflicted with upstream)

* Fix propagator ott deps

* Add host detector

* Lint

* Remove Telemetry type

* Update release notes
  • Loading branch information
pmcollins authored Nov 25, 2024
1 parent 2e2782a commit 9ea7b96
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
25 changes: 13 additions & 12 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@ Summary of changes between Splunk OTel Python major versions 1 and 2.

## Environment Variables

| Variable | 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) |
| 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 |

## 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 @@ -27,6 +27,7 @@
"OTEL_LINK_ATTRIBUTE_COUNT_LIMIT": "",
"OTEL_SPAN_LINK_COUNT_LIMIT": "1000",
"OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT": "12000",
"OTEL_EXPERIMENTAL_RESOURCE_DETECTORS": "host",
}

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

from ott_lib import project_path, trace_loop

NUM_SPANS = 12
Expand All @@ -25,5 +26,8 @@ def on_start(self):
def on_stop(self, telemetry, stdout: str, stderr: str, returncode: int) -> None:
assert count_spans(telemetry) == NUM_SPANS

attributes = extract_leaves(telemetry, "trace_requests", "pbreq", "resource_spans", "resource", "attributes")
assert get_attribute(attributes, "host.name")

def is_http(self):
return False

0 comments on commit 9ea7b96

Please sign in to comment.