open-telemetry / open-telemetry/opentelemetry-php
Forcing service resource detector prevents from using more static service instance id
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 912
- Forks
- 232
- Avg merge
- 7d 16h
- Merged PRs (30d)
- 4
Description
Describe your environment
We have:
- NewRelic
- otel-collector-contrib
- monolith php app with manual instrumentation
As it was mentioned before (here and here) - paraphrasing - if we don't like usage of uuid as service id we can write our own resource detector. Change that was introduced in PR#1573 prevents us from doing so.
Why this is important?
We use NewRelic and they require some of the fields to have low cardinality and one of hose fields is service.instance.id.
Please either move those two lines above foreach from line 41 - so those are always added BUT there is a way to override those fields (less desirable because it will create objects just to overwrite them) - or restore previous behavior where we could just not list them in OTEL_PHP_DETECTORS env variable and replace with custom implementation (less resource usage).
This is breaking our instrumentation and we had to rollback to previous versions.
Steps to reproduce
Send any span or metric
What is the expected behavior?
Be able to override value service.instance.id using resource detector.
What is the actual behavior?
Because service is added at the end and detectors are processed from top to bottom there is no way to override value of that field.
Additional context
In my opinion otel spec is incorrect in description of this field and it is targeting only long running applications like java or .net that start once and handle thousands of requests without restart. In php world where everything lives in the request and it recreated this value should be stable.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read PR#1573 and the resource detector code around line 41, then review how OTEL_PHP_DETECTORS controls detector ordering. Reproduce the issue by sending a span or metric with a custom detector, and verify that service.instance.id can be overridden without forcing the default detector.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100