elastic / elastic/opentelemetry-lib
Destination service span enrichment issue
- Dominant language
- Go
- Stars
- 5
- Forks
- 18
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 7
Description
In the following situation, an unexpected behaviour is observed. A web frontend is instrumented with OTel JS for browser. The requests from the browser first hits a Kubernetes ingress controller that routes the requests to the backend services based on the `{language}` in the URL path `/api/{language}/rolldice`. The [destination service span enrichment](https://github.com/elastic/opentelemetry-lib/blob/main/enrichments/internal/elastic/span.go#L515) sets the IP address as destination service. The result is that in this scenario, the service map cannot properly resolve the backend services.
The ingress controller does URL rewriting like this:
```yaml
# Java service API
- path: /api/java(/|$)(.*)
pathType: ImplementationSpecific
backend:
service:
name: java-service
port:
number: 80
```
Is it possible to take the path into account for the destination service?
I have experimented with a custom span processor in the frontend to set the `peer.service` attribute. If this is set to the value of `service.name` attribute of the backend service, it works as expected. However, maintaining such a mapping in the frontend might be unfeasible.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.