Skip to content

docs: document resource detectors and Sentry profiling on free-threaded CPython - #275

Merged
lesnik512 merged 1 commit into
mainfrom
docs-resource-detectors
Oct 4, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
docs-resource-detectors

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Closes #181. Docs plus pinning tests; no change under lite_bootstrap/.

Resource detectors

New ### Resource subsection under OpenTelemetry. OpenTelemetryInstrument builds its resource with Resource.create, so OTEL_EXPERIMENTAL_RESOURCE_DETECTORS and OTEL_RESOURCE_ATTRIBUTES already work. The configured attributes merge last.

The issue said lite-bootstrap's service_name overrides OTEL_SERVICE_NAME. It's stronger than that: service_name defaults to "micro-service", so OTEL_SERVICE_NAME is overridden unless service_name is empty. The docs say so.

The example lists detectors explicitly and doesn't mention *. The wildcard doesn't exist in opentelemetry-sdk 1.28, our floor. I checked 1.28's Resource.create: process, os and host are registered there, and explicit attributes still merge last.

New tests in tests/instruments/test_opentelemetry_instrument.py:

  • test_opentelemetry_configured_service_name_wins_over_env pins service.name with OTEL_SERVICE_NAME set, for three configs: the default, service_name, and opentelemetry_service_name.
  • test_opentelemetry_resource_detectors_enrich_resource checks that the process detector and OTEL_RESOURCE_ATTRIBUTES both reach the resource.

Profiling on free-threaded CPython

The Pyroscope section now says the extra can't install on free-threaded CPython (#171) and points to Sentry continuous profiling through sentry_additional_params.

The brief required this to be checked before it was documented. I ran it on CPython 3.14.7t, GIL disabled, with sentry-sdk 2.71.0 installed via lite-bootstrap[sentry]:

  • Setup: FreeBootstrapper with profile_session_sample_rate=1.0 and profile_lifecycle="manual", then start_profiler(), 1.5 s of CPU work on 5 threads, and stop_profiler().
  • A capturing Transport received one profile_chunk envelope with 777 samples across 6 thread ids.
  • sys._is_gil_enabled() was still False afterwards, and nothing warned under -X dev.

Only the manual lifecycle was exercised, so that's the one the docs example uses.

Checks

just lint-ci, just test-ci (340 passed, 100% coverage), just docs-build (strict), and just adr-check all pass.

@lesnik512
lesnik512 merged commit 5838c72 into main Oct 4, 2026
30 checks passed
@lesnik512
lesnik512 deleted the docs-resource-detectors branch October 4, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document resource detectors and the free-threaded profiling path

1 participant