service.instance.id should be used to create a unique combination of service.namespace, service.name,service.instance.id. I could use host.id for this purpose as it is detected in \OpenTelemetry\SDK\Resource\Detectors\Host::getMachineId. However, that method is private and accessible only via getResource, which performs additional tasks beyond what I need. Furthermore, getResource uses static methods across different objects, and I cannot guarantee that these implementations won't change in the future, potentially affecting data collection.
I have noticed similar patterns in other places. While I understand that adding methods like getAttribute directly on a span is discouraged, limiting access to system information in such a restrictive way seems problematic.
Is your feature request related to a problem?
Yes, the lack of a standardized way to retrieve host.id for use in attributes (either directly or as part of a hash, for example).
Describe the solution you'd like
- Make the
getMachineId method publicly accessible and static.
- Review the SDK to identify and address other areas where increased openness could be beneficial.
Describe alternatives you've considered
Re-implementing the logic from getMachineId independently.
service.instance.idshould be used to create a unique combination ofservice.namespace, service.name,service.instance.id. I could usehost.idfor this purpose as it is detected in\OpenTelemetry\SDK\Resource\Detectors\Host::getMachineId. However, that method is private and accessible only viagetResource, which performs additional tasks beyond what I need. Furthermore,getResourceuses static methods across different objects, and I cannot guarantee that these implementations won't change in the future, potentially affecting data collection.I have noticed similar patterns in other places. While I understand that adding methods like
getAttributedirectly on a span is discouraged, limiting access to system information in such a restrictive way seems problematic.Is your feature request related to a problem?
Yes, the lack of a standardized way to retrieve
host.idfor use in attributes (either directly or as part of a hash, for example).Describe the solution you'd like
getMachineIdmethod publicly accessible and static.Describe alternatives you've considered
Re-implementing the logic from
getMachineIdindependently.