open-telemetry / opentelemetry-js

OpenTelemetry JavaScript Client
https://opentelemetry.io
Apache License 2.0
2.76k stars 810 forks source link

feat(web): Add session handling implementation #5173

Open martinkuba opened 3 days ago

martinkuba commented 3 days ago

Which problem is this PR solving?

Follow up to https://github.com/open-telemetry/opentelemetry-js/pull/4972

Discussed in issue https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2358

Short description of the changes

This adds an implementation of session management for web. It introduces a SessionManager class that is responsible for starting, ending, and persisting sessions.

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Checklist:

codecov[bot] commented 3 days ago

Codecov Report

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

Project coverage is 93.25%. Comparing base (1370810) to head (58005d4).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #5173 +/- ## ========================================== + Coverage 93.19% 93.25% +0.06% ========================================== Files 314 315 +1 Lines 8077 8144 +67 Branches 1622 1636 +14 ========================================== + Hits 7527 7595 +68 + Misses 550 549 -1 ``` | [Files with missing lines](https://app.codecov.io/gh/open-telemetry/opentelemetry-js/pull/5173?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [...rimental/packages/web-common/src/SessionManager.ts](https://app.codecov.io/gh/open-telemetry/opentelemetry-js/pull/5173?src=pr&el=tree&filepath=experimental%2Fpackages%2Fweb-common%2Fsrc%2FSessionManager.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-ZXhwZXJpbWVudGFsL3BhY2thZ2VzL3dlYi1jb21tb24vc3JjL1Nlc3Npb25NYW5hZ2VyLnRz) | `100.00% <100.00%> (ø)` | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/open-telemetry/opentelemetry-js/pull/5173/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)

🚨 Try these New Features: