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

fix(detector-aws): remove semconv incubating import #2668

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

garysassano
Copy link
Contributor

@garysassano garysassano commented Jan 17, 2025

Which problem is this PR solving?

The AWS detectors are directly importing experimental attributes from @opentelemetry/semantic-conventions/incubating, which can lead to breaking changes in minor versions and increased disk usage due to having multiple package versions installed.

Short description of the changes

  • Created a shared /src/semconv.ts file with generated unstable semantic conventions
  • Updated imports in AWS detectors to use the local /src/semconv.ts file

This follows the OpenTelemetry best practices for handling unstable semantic conventions.

Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.84%. Comparing base (4fb610d) to head (0ac7ca1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2668      +/-   ##
==========================================
+ Coverage   90.80%   90.84%   +0.03%     
==========================================
  Files         170      171       +1     
  Lines        8070     8102      +32     
  Branches     1646     1646              
==========================================
+ Hits         7328     7360      +32     
  Misses        742      742              
Files with missing lines Coverage Δ
...ctor-aws/src/detectors/AwsBeanstalkDetectorSync.ts 96.55% <100.00%> (+0.12%) ⬆️
...e-detector-aws/src/detectors/AwsEc2DetectorSync.ts 98.21% <ø> (ø)
...e-detector-aws/src/detectors/AwsEcsDetectorSync.ts 97.11% <100.00%> (ø)
...e-detector-aws/src/detectors/AwsEksDetectorSync.ts 91.86% <ø> (ø)
...etector-aws/src/detectors/AwsLambdaDetectorSync.ts 100.00% <ø> (ø)
...opentelemetry-resource-detector-aws/src/semconv.ts 100.00% <100.00%> (ø)

@trentm
Copy link
Contributor

trentm commented Jan 18, 2025

@garysassano Thanks. Heads up that I pushed a couple of commits to your feature branch. Happy to discuss the changes:

  • I moved src/lib/semconv.ts to src/semconv.ts. I don't see the value of the "lib/" subdir. Other packages will be using "src/semconv.ts" (e.g. instrumentation-pg already does).
  • I added the block comments for the copied vars: these are helpful for tooltips and deprecated styling in some IDEs. I've scripted the generation of semconv.ts (see chore: add scripts/gen-semconv-ts.js to help generate semconv.ts files for unstable semconv consts #2669 for the PR adding the generator script).
  • I moved two of the imports that are stable to import directly from @opentelemetry/semantic-conventions. The generator script warns about these cases.

@garysassano
Copy link
Contributor Author

I moved src/lib/semconv.ts to src/semconv.ts. I don't see the value of the "lib/" subdir. Other packages will be using "src/semconv.ts" (e.g. instrumentation-pg already does).

I would have preferred using /lib/semconv.ts instead of /src/semconv.ts to allow imports from /tests as ../lib/semconv rather than ../src/semconv.ts. However, I noticed that the NX build fails unless everything is within the /src folder, so I'm fine with your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants