Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource merge error for different versions #3361

Open
MrAlias opened this issue Apr 3, 2023 · 2 comments
Open

Resource merge error for different versions #3361

MrAlias opened this issue Apr 3, 2023 · 2 comments
Assignees
Labels
spec:resource Related to the specification/resource directory

Comments

@MrAlias
Copy link
Contributor

MrAlias commented Apr 3, 2023

Currently the specification defines the following merge strategy:

The resulting resource will have the Schema URL calculated as follows:

  • If the old resource's Schema URL is empty then the resulting resource's Schema
    URL will be set to the Schema URL of the updating resource,
  • Else if the updating resource's Schema URL is empty then the resulting
    resource's Schema URL will be set to the Schema URL of the old resource,
  • Else if the Schema URLs of the old and updating resources are the same then
    that will be the Schema URL of the resulting resource,
  • Else this is a merging error (this is the case when the Schema URL of the old
    and updating resources are not empty and are different). The resulting resource is
    undefined, and its contents are implementation-specific.

This results in resources that are defined using different versions of the OpenTelemetry semantic conventions to be merged into an undefined resource and results in an errors.

Users of libraries that provide resources (via a detector or directly) are often frustrated when they try to merge these resources together or with their own defined resources because the schema URLs differ and the merge results in an error. This is especially frustrating to them given they do not control the upgrade or downgrade of these resources they get from 3rd party libraries and currently have no way to resolve the error.

Given the telemetry schema exist for OpenTelemetry, it should be possible use the telemetry schema to upgrade/downgrade resources for a user (e.g. open-telemetry/opentelemetry-go#3944) and subsequently merge successfully into a single resource.

Existing Implementation

The following is a non-comprehensive survey of what language implementation currently do.

Language Error treatment Returned Resource
Go Error returned to user Empty resource returned
Java Warning logged Merged resource without a schema returned
Erlang Warning logged Merged resource without a schema returned
Python Error logged Original "old" resource returned
.Net ? ?
C++ ? ?
ruby ? ?
Javascript Not supported (?) Merged resource without a schema returned

@open-telemetry/dotnet-maintainers, @open-telemetry/python-maintainers, @open-telemetry/javascript-maintainers, @open-telemetry/cpp-maintainers @open-telemetry/erlang-maintainers, @open-telemetry/ruby-maintainers: please feel free to edit the table above to correct any information.

cc @trask

Proposal

Either:

  1. Update the merge strategy to have the SDK upgrade/downgrade a resource in the process of merging
  2. Add additional recommendations that SDKs provide upgrade/downgrade functionality for resources
@dyladan
Copy link
Member

dyladan commented Aug 11, 2023

For JS I would say the "Returned Resource" is "Merged resource without a schema returned" even though schema is not supported for resource it is technically true.

@MrAlias
Copy link
Contributor Author

MrAlias commented Aug 11, 2023

For JS I would say the "Returned Resource" is "Merged resource without a schema returned" even though schema is not supported for resource it is technically true.

Updated. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec:resource Related to the specification/resource directory
Projects
None yet
Development

No branches or pull requests

3 participants