{"id":4671,"library":"opentelemetry-resourcedetector-process","title":"OpenTelemetry Process Resource Detector","description":"This OpenTelemetry package populates Resource attributes from the running process. It detects process-related information such as PID, executable name, command line, and runtime details, which are then attached to telemetry data for better context and filtering. The current version is 0.3.0, and releases appear to be ad-hoc, following updates in the broader OpenTelemetry Python ecosystem.","status":"active","version":"0.3.0","language":"en","source_language":"en","source_url":"https://github.com/chrisguidry/opentelemetry-resourcedetector-process","tags":["opentelemetry","observability","tracing","metrics","resource-detection","process"],"install":[{"cmd":"pip install opentelemetry-resourcedetector-process","lang":"bash","label":"Install stable release"}],"dependencies":[{"reason":"Required for aggregating resource detectors into a Resource object and for OpenTelemetry SDK functionality.","package":"opentelemetry-sdk","optional":false}],"imports":[{"symbol":"ProcessResourceDetector","correct":"from opentelemetry_resourcedetector_process import ProcessResourceDetector"},{"note":"Used to combine multiple resource detectors.","symbol":"get_aggregated_resources","correct":"from opentelemetry.sdk.resources import get_aggregated_resources"}],"quickstart":{"code":"from opentelemetry.sdk.resources import get_aggregated_resources\nfrom opentelemetry_resourcedetector_process import ProcessResourceDetector\n\n# Instantiate the process resource detector\nprocess_detector = ProcessResourceDetector()\n\n# Aggregate resources, including the process detector\n# Note: The OpenTelemetry SDK often includes built-in detectors by default, \n# but if you are manually creating an aggregated resource, you must explicitly\n# list all desired detectors.\nresource = get_aggregated_resources([\n    process_detector,\n    # Add other detectors here if needed, e.g., HostResourceDetector()\n])\n\nprint(\"Detected Process Resource Attributes:\")\nfor key, value in resource.attributes.items():\n    print(f\"  {key}: {value}\")\n\n# In a real OpenTelemetry setup, this 'resource' object would be passed \n# to a TracerProvider, MeterProvider, or LoggerProvider.\n# Example (conceptual):\n# from opentelemetry.sdk.trace import TracerProvider\n# tracer_provider = TracerProvider(resource=resource)\n# # ... further setup ...","lang":"python","description":"Demonstrates how to import and use `ProcessResourceDetector` to gather process-specific attributes and combine them with other resource attributes using `get_aggregated_resources`."},"warnings":[{"fix":"Ensure your project uses Python 3.8 or newer, or pin to an older `opentelemetry-resourcedetector-process` version if Python 3.6/3.7 support is critical.","message":"Python version requirement changed. Version 0.3.0 and later require Python >=3.8. Previous versions (e.g., 0.2.0) supported Python >=3.6.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Always pass `ProcessResourceDetector()` to `get_aggregated_resources` or `Resource.create` if you intend to collect process attributes.","message":"When manually constructing `Resource` objects or using `get_aggregated_resources`, you must explicitly include `ProcessResourceDetector()` in the list of detectors to ensure process attributes are collected. It is not automatically added if you provide your own list.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Periodically consult the official OpenTelemetry Semantic Conventions for resource attributes to ensure compatibility with your observability backend and dashboards.","message":"OpenTelemetry Semantic Conventions, which define attribute names (e.g., `process.pid`, `process.executable.name`), can evolve. While this detector provides these attributes, their precise names or expected values might change with future OpenTelemetry specification updates.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}