opentelemetry-js-contrib icon indicating copy to clipboard operation
opentelemetry-js-contrib copied to clipboard

chore: add instrumentation metadata to package.json

Open blumamir opened this issue 1 year ago • 3 comments

This is the first implementation of https://github.com/open-telemetry/opentelemetry-js/issues/4725 into the contrib repo.

It adds metadata on the OpenTelemetry components that are exported from this npm package (which at the moment is one per package, but not always the case, for example opentelemetry-resource-detector-aws which exports multiple detectors.

For each component, one can currently publish its:

  • name the name of the component as exported from the package. currently not used in this PR but intended to be added to auto-create the code example for each instrumentation.
  • componentType - "instrumentation". In the future we can add metadata to more components and this field can identify if the component is "instrumentation" / "sampler" / "propagator" / resource-detector" etc.
  • platforms - an array with either "node" or "web". instrumentations are always either web or node, but I want to keep it generic so we can mark future non-instrumentation components as both web and node, or add additional platforms if the need arise (like deno).

I have updated the lint-markdown script to use this info directly from the package itself, instead of reading it indirectly from the auto-instrumentation packages dependencies.

After this one merges, I will work on adding and utilizing more metadata as followup PRs as described in the issue.

blumamir avatar Jun 21 '24 11:06 blumamir

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 90.30%. Comparing base (dfb2dff) to head (43b4977). Report is 403 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2292      +/-   ##
==========================================
- Coverage   90.97%   90.30%   -0.68%     
==========================================
  Files         146      147       +1     
  Lines        7492     7263     -229     
  Branches     1502     1509       +7     
==========================================
- Hits         6816     6559     -257     
- Misses        676      704      +28     

see 57 files with indirect coverage changes

codecov[bot] avatar Jun 22 '24 08:06 codecov[bot]

@open-telemetry/javascript-approvers would love to get feedback on this approach as an MVP + demonstration of how it can be actually leveraged by a tool (lint readme).

Please feel free to share any concerns or support for documenting the opentelemetry-domain-specific metadata for the components each npm package implements.

I am motivated to work on the followup metadata properties and utilize them, and would be happy to have this one in to build the next steps on top of it

blumamir avatar Jun 25 '24 17:06 blumamir

more on the motivation and future plans can be found in https://github.com/open-telemetry/opentelemetry-js/issues/4725. any feedback is appreciated 🙏

blumamir avatar Jun 25 '24 17:06 blumamir