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

Resources API: package, semantic conventions, and test utils #815

Merged
merged 12 commits into from
Mar 2, 2020

Conversation

mwear
Copy link
Member

@mwear mwear commented Feb 26, 2020

Which problem is this PR solving?

Short description of the changes

  • Extracted the current resource implementation into opentelemetry/resources with a dependency on opentelemetry/api
  • Loosened the restriction on label values from string to string, numeric, or boolean
  • Added constants for resource semantic conventions from the specification

Next

This PR only provides modeling of Resources, constants for the semantic conventions, and test utilities to validate a resource for conforming to the conventions.

According to the Resource spec spans and metrics should be associated with a resource: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sdk-resource.md#resource-sdk

At the Spec SIG call there was confusion over how this should be done and I created this issue for clarification: open-telemetry/opentelemetry-specification#491.

I suspect there will be additional work to associate telemetry with resources, but am proposing that we handle that in a subsequent PR as we get clarification. The approach that Ruby is taking is described in: open-telemetry/opentelemetry-specification#491 and we can go that route if we choose to.

I have also noticed that OpenCensus node has automatic resource detection, these are for system, cloud, container resources: open-telemetry/opentelemetry-specification#491. We should decide what logic we would like to port from Census. Again, I think we can handle these as separate PRs.

@codecov-io
Copy link

codecov-io commented Feb 26, 2020

Codecov Report

Merging #815 into master will decrease coverage by 1.64%.
The diff coverage is 58.82%.

@@            Coverage Diff             @@
##           master     #815      +/-   ##
==========================================
- Coverage   94.55%   92.91%   -1.65%     
==========================================
  Files         249      246       -3     
  Lines       10751    10868     +117     
  Branches     1060     1066       +6     
==========================================
- Hits        10166    10098      -68     
- Misses        585      770     +185
Impacted Files Coverage Δ
...telemetry-tracing/test/BasicTracerRegistry.test.ts 100% <ø> (ø) ⬆️
packages/opentelemetry-tracing/src/Tracer.ts 96.55% <ø> (-0.17%) ⬇️
packages/opentelemetry-api/src/trace/NoopTracer.ts 100% <ø> (ø) ⬆️
packages/opentelemetry-api/test/api/api.test.ts 96.66% <ø> (ø) ⬆️
packages/opentelemetry-tracing/src/config.ts 100% <ø> (ø) ⬆️
...-api/test/noop-implementations/noop-tracer.test.ts 100% <ø> (ø) ⬆️
...opentelemetry-node/test/NodeTracerProvider.test.ts 100% <ø> (ø) ⬆️
packages/opentelemetry-api/src/api/propagation.ts 58.82% <58.82%> (ø)
...s/opentelemetry-core/test/context/B3Format.test.ts 50% <0%> (-50%) ⬇️
packages/opentelemetry-core/test/utils/url.test.ts 50% <0%> (-50%) ⬇️
... and 50 more

@vmarchaud
Copy link
Member

I believe that since it's only interface/enums, we should put that inside @opentelemetry/api

@dyladan
Copy link
Member

dyladan commented Feb 26, 2020

I believe that since it's only interface/enums, we should put that inside @opentelemetry/api

This is not just interfaces/enums. Also, I don't believe that resource is meant to be exposed by the API, but is a SDK concern.

@dyladan dyladan added this to the Beta milestone Feb 26, 2020
@dyladan dyladan added the enhancement New feature or request label Feb 26, 2020
@dyladan dyladan mentioned this pull request Feb 26, 2020
46 tasks
Co-Authored-By: Daniel Dyla <dyladan@users.noreply.github.com>
@mwear
Copy link
Member Author

mwear commented Feb 26, 2020

I've taken this out of draft and into ready for review. I also updated the comment with a description of the current state of resources and the future work that we need to have clarified and make decisions on. I'm happy to take up any of that work in future PRs, or as part of this one if that's what we decide.

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just minor things

packages/opentelemetry-resources/src/Resource.ts Outdated Show resolved Hide resolved
packages/opentelemetry-resources/src/constants.ts Outdated Show resolved Hide resolved
packages/opentelemetry-resources/src/constants.ts Outdated Show resolved Hide resolved
Copy link
Member

@vmarchaud vmarchaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@mayurkale22 mayurkale22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, added one minor nit.

packages/opentelemetry-resources/src/constants.ts Outdated Show resolved Hide resolved
@dyladan dyladan added the Merge:LGTM This PR is ready to be merged by a Maintainer (has enough valid approvals, successful build, etc.) label Feb 28, 2020
"mocha": "^6.2.0",
"nyc": "^14.1.1",
"rimraf": "^3.0.0",
"sinon": "^7.5.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused dep

Copy link
Member

@OlivierAlbertini OlivierAlbertini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dyladan dyladan merged commit 3818515 into open-telemetry:master Mar 2, 2020
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
martinkuba pushed a commit to martinkuba/opentelemetry-js that referenced this pull request Mar 13, 2024
martinkuba pushed a commit to martinkuba/opentelemetry-js that referenced this pull request Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Merge:LGTM This PR is ready to be merged by a Maintainer (has enough valid approvals, successful build, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants