{"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":"python","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,"search_vec":"'0.3.0':47 'ad':54 'ad-hoc':53 'appear':50 'attach':34 'attribut':10 'better':39 'broader':60 'command':26 'context':40 'current':44 'data':37 'detail':30 'detect':16,70 'detector':4 'ecosystem':63 'execut':24 'filter':42 'follow':56 'hoc':55 'inform':20 'line':27 'metric':67 'name':25 'observ':65 'opentelemetri':1,6,61,64 'packag':7 'pid':23 'popul':8 'process':2,14,18,71 'process-rel':17 'python':62 'relat':19 'releas':49 'resourc':3,9,69 'resource-detect':68 'run':13 'runtim':29 'telemetri':36 'trace':66 'updat':57 'version':45","created_at":"2026-04-12T14:02:37.926796+00:00","updated_at":"2026-04-16T17:46:04.495708+00:00","problems":[{"fix":"Ensure the package is installed using pip: `pip install opentelemetry-resourcedetector-process`","cause":"This error occurs when the 'opentelemetry-resourcedetector-process' package is not installed in the Python environment, or is installed but the import statement uses an incorrect path.","error":"ModuleNotFoundError: No module named 'opentelemetry_resourcedetector_process'"},{"fix":"Increase the timeout for resource detection (e.g., using `OTEL_EXPERIMENTAL_RESOURCE_DETECTOR_TIMEOUT` environment variable if available in newer SDK versions, or by ensuring custom detectors complete quickly). For the `ProcessResourceDetector`, ensure the `/proc` filesystem is accessible and not experiencing I/O delays in containerized environments.","cause":"This warning, especially when the exception string appears blank or the application hangs, indicates that a resource detector (like the ProcessResourceDetector) took longer than its default timeout (5 seconds) to complete its detection logic.","error":"Exception in detector <opentelemetry.resource.detector.<RESOURCE DETECTOR CLASS> object at 0x...>, ignoring."},{"fix":"The correct import statement is `from opentelemetry_resourcedetector_process import ProcessResourceDetector`.","cause":"Developers often incorrectly assume that all OpenTelemetry resource detectors are part of the core `opentelemetry.sdk.resources` module. However, `ProcessResourceDetector` is from the `opentelemetry-resourcedetector-process` package.","error":"from opentelemetry.sdk.resources import ProcessResourceDetector"},{"fix":"Verify that the application has the necessary permissions to access process information (e.g., read access to `/proc` in Linux environments). In containerized setups, ensure the container's security context or Docker run flags (like `--pid=host`) allow access to host process details if needed, or that the container environment itself provides the necessary process information.","cause":"This general error message or log entry indicates that the process resource detector was unable to collect the expected process-related information, often due to permission issues (e.g., restricted access to `/proc` filesystem in certain container configurations) or other environmental constraints.","error":"Process Detection Failed"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.3.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/chrisguidry/opentelemetry-resourcedetector-process","docs":null,"changelog":null,"pypi":"https://pypi.org/project/opentelemetry-resourcedetector-process/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["observability"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}