tracing: allow the Resource
to be set externally
#4472
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a workaround for the brittleness when constructing OTel
Resource
objects. Internally, the OTel libraries do their own detection which can be merged with one created in code. However, thesemconv
spec versions must match. (NOT module version! thesemconv
package has multiple subpackages for each spec version, e.g.semconv/v1.17
,semconv/v1.21
, etc.)This creates a problem when BuildKit is used as a library - the importing app might be using a different, otherwise compatible version of the OTel libraries, so when it creates a resource, it will be merged with one of a different version.
By allowing the
Resource
to be set (like theRecorder
), the calling code can construct a resource using known consistent library versions that work, and then allow BuildKit to take over the rest of the initialization process for OTel.See also: