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

sdk/resource: Add Resource.WithoutSchemaURL #4484

Closed

Conversation

pellared
Copy link
Member

@pellared pellared commented Sep 7, 2023

Fixes #2341
Fixes #3769
Fixes #4476

This should mitigate a common problem. Most users seem to want to have some "easy fix".

Pros:

  • Acceptable from the OTel Specification perspective.
  • Can be used in a fine grained manner. One can only set it to empty for “problematic” resource attributes. But also one could always use this for all resources being merged.

Current alternative:

  • One could call resource.NewSchemaless(r.Attributes()…). However, this is clunky and it is not efficient as it copies a slice (which is not needed as attribute.Set is immutable).

Side notes:

I was also thinking of adding an option to Merge, but this would be not compliant with the specification. Also it would be hard to answer what schemaURL should be set in case of a conflict.

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Merging #4484 (dfba85b) into main (6eedabf) will increase coverage by 0.0%.
The diff coverage is 100.0%.

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #4484   +/-   ##
=====================================
  Coverage   81.3%   81.3%           
=====================================
  Files        220     220           
  Lines      17670   17672    +2     
=====================================
+ Hits       14378   14380    +2     
  Misses      2992    2992           
  Partials     300     300           
Files Changed Coverage
sdk/resource/resource.go 100.0%

@pellared
Copy link
Member Author

pellared commented Sep 7, 2023

@MrAlias
Copy link
Contributor

MrAlias commented Sep 7, 2023

I would rather we provide a translation layer than remove a part of the resource that is included by the specification.

@pellared
Copy link
Member Author

pellared commented Sep 7, 2023

I would rather we provide a translation layer than remove a part of the resource that is included by the specification.

Is the translation defined in the OTel Specification?

@pellared
Copy link
Member Author

pellared commented Sep 7, 2023

SIG meeting: This API will not help a lot. Closing.

@MrAlias Will try to revive the translation layer.

@pellared pellared closed this Sep 7, 2023
@pellared pellared deleted the resource-withoutschemaurl branch November 17, 2023 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants