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

chore(examples/web): use exported strings for attributes #2129

Merged
merged 4 commits into from Apr 24, 2024

Conversation

maryliag
Copy link
Contributor

Which problem is this PR solving?

Short description of the changes

On package examples/web:

  • Update @opentelemetry/semantic-conventions ^1.23.0
  • Use exported strings for Semantic Attributes.

Use exported strings for Semantic Attributes
Copy link

codecov bot commented Apr 19, 2024

Codecov Report

Merging #2129 (eac351b) into main (dfb2dff) will decrease coverage by 0.63%.
Report is 64 commits behind head on main.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2129      +/-   ##
==========================================
- Coverage   90.97%   90.35%   -0.63%     
==========================================
  Files         146      147       +1     
  Lines        7492     7679     +187     
  Branches     1502     1575      +73     
==========================================
+ Hits         6816     6938     +122     
- Misses        676      741      +65     

see 9 files with indirect coverage changes

@@ -46,7 +46,7 @@
"@opentelemetry/instrumentation-xml-http-request": "^0.39.1",
"@opentelemetry/propagator-b3": "^1.13.0",
"@opentelemetry/sdk-trace-web": "^1.13.0",
"@opentelemetry/semantic-conventions": "^1.13.0"
"@opentelemetry/semantic-conventions": "^1.23.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

This only requires v1.22.0, but I think we can have (perhaps even want) the examples all to be updated to be using the very latest versions of deps? Not sure how strict we need to be here. If we need to back this up to ^1.22.0 later, we can do another change.

Copy link
Member

Choose a reason for hiding this comment

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

This definitely brings the example in bad state. "@opentelemetry/instrumentation-xml-http-request": "^0.39.1" depends on "@opentelemetry/semantic-conventions": "1.13.0".
So user ends up with a duplicate.

In general I think examples should be only touched if it is verified manually that result is fine as there are no automated tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does having two versions of @opentelemetry/semantic-conventions necessarily mean a bad state for the example?

The current state already has three different versions of @opentelemetry/resource, FWIW:

[23:37:57 trentm@peach:~/src/opentelemetry-js-contrib/examples/web (git:main)]
% npm ls @opentelemetry/resources
web-examples@0.26.0 /Users/trentm/src/opentelemetry-js-contrib/examples/web
├─┬ @opentelemetry/auto-instrumentations-web@0.32.3
│ ├─┬ @opentelemetry/instrumentation-fetch@0.40.0
│ │ └─┬ @opentelemetry/sdk-trace-web@1.14.0
│ │   └─┬ @opentelemetry/sdk-trace-base@1.14.0
│ │     └── @opentelemetry/resources@1.14.0
│ └─┬ @opentelemetry/instrumentation-xml-http-request@0.40.0
│   └─┬ @opentelemetry/sdk-trace-web@1.14.0
│     └─┬ @opentelemetry/sdk-trace-base@1.14.0
│       └── @opentelemetry/resources@1.14.0
├─┬ @opentelemetry/exporter-trace-otlp-http@0.39.1
│ ├─┬ @opentelemetry/otlp-transformer@0.39.1
│ │ ├── @opentelemetry/resources@1.13.0 deduped
│ │ ├─┬ @opentelemetry/sdk-logs@0.39.1
│ │ │ └── @opentelemetry/resources@1.13.0 deduped
│ │ └─┬ @opentelemetry/sdk-metrics@1.13.0
│ │   └── @opentelemetry/resources@1.13.0 deduped
│ ├── @opentelemetry/resources@1.13.0
│ └─┬ @opentelemetry/sdk-trace-base@1.13.0
│   └── @opentelemetry/resources@1.13.0 deduped
└─┬ @opentelemetry/sdk-trace-web@1.23.0
  └─┬ @opentelemetry/sdk-trace-base@1.23.0
    └── @opentelemetry/resources@1.23.0

and 7 installs of 3 different versions of @opentelemetry/semantic-conventions:

% npm ls @opentelemetry/semantic-conventions | rg -v deduped | rg semantic
│ │ └── @opentelemetry/semantic-conventions@1.14.0
│   └── @opentelemetry/semantic-conventions@1.14.0
│ │ └── @opentelemetry/semantic-conventions@1.13.0
│ │ └── @opentelemetry/semantic-conventions@1.13.0
│   └── @opentelemetry/semantic-conventions@1.13.0
│ └── @opentelemetry/semantic-conventions@1.13.0
└── @opentelemetry/semantic-conventions@1.23.0

Anyway, it is a bit of a mess. I'm not sure these PRs updating the examples/* make it worse, but I understand your point.

Getting into attempting to maintain many of these examples is a huge pain. Some of them are ancient or obsolete (B3Propagator). The examples/web/README.md, for example, explains nothing about what to expect, whether to run the docker-compose file that is included, etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

This was discussed in the SIG today (https://docs.google.com/document/d/1tCyoQK49WVcE-x8oryZOTTToFm7sIeUhxFPm9g-qL1k/edit#heading=h.dvqq8u408ifx) and it was felt that we should go ahead with these semconv updates in the examples/* dirs. Trying to summarize the discussion from memory:

  • Possible multiple separate @opentelemetry/semantic-conventions versions won't break the example apps because the semconv package has no deps.
  • To the degree that users look at the examples for how to do things, it is helpful to update the semantic-conventions package usage to the new exports from v1.22.0.
  • There was some expression of hope for automated verification that examples are basically working (perhaps no more than a check that they install/compile fine). Verifying beyond that might be difficult because the examples aren't generally written to be testable. Also contributor bandwidth is an issue.

@trentm trentm enabled auto-merge (squash) April 24, 2024 03:03
@trentm trentm disabled auto-merge April 24, 2024 06:32
@maryliag
Copy link
Contributor Author

/easycla

@trentm trentm enabled auto-merge (squash) April 24, 2024 17:13
@trentm trentm merged commit 5f1910b into open-telemetry:main Apr 24, 2024
8 checks passed
@maryliag maryliag deleted the example-web branch April 24, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants