* feat: Do not limit `@opentelemetry/api` upper range peerDependency
* Revert "feat: Do not limit `@opentelemetry/api` upper range peerDependency"
This reverts commit d0dd3d577b.
* only unclamp otlp-transformer
* Add changelog entry
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* fix(sdk-node): avoid spurious diag errors for unknown OTEL_NODE_RESOURCE_DETECTORS values
When NodeSDK is configured with explicit 'resourceDetectors' or
with 'autoDetectResources: false', then it should not emit diag
errors about unknown values in OTEL_NODE_RESOURCE_DETECTORS.
This can happen when that envvar is used with
@opentelemetry/auto-instrumentation-node
Closes: https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2311
* add a changelog entry
* lint:fix
* fix(instrumentation-http): Ensure instrumentation of `http.get` and `https.get` work when used in ESM code
The issue was that the `_wrap`ing of `http.get` was getting the
just-wrapped `http.request` by accessing `moduleExports.request`.
However, when wrapping an ES module the `moduleExports` object from IITM
is a Proxy object that allows setting a property, but *not* re-getting
that set property.
The fix is to use the wrapped `http.request` from the `this._wrap` call.
That required fixing a bug in the IITM code-path of
`InstrumentationBase.prototype._wrap` to return the wrapped property.
(The previous code was doing `return Object.defineProperty(...)`, which
returns the moduleExports, not the defined property.)
Fixes: #4857
* correct typo in the changelog message
* does this fix the test:esm script running on windows?
* remove other console.logs (presumably dev leftovers) from tests in this file
* test name suggestion
Co-authored-by: Jamie Danielson <jamieedanielson@gmail.com>
* test name suggestion
Co-authored-by: Jamie Danielson <jamieedanielson@gmail.com>
* test name suggestion
Co-authored-by: Jamie Danielson <jamieedanielson@gmail.com>
* test name suggestion
Co-authored-by: Jamie Danielson <jamieedanielson@gmail.com>
* var naming suggestion: expand cres and creq, the abbrev isn't obvious
---------
Co-authored-by: Jamie Danielson <jamieedanielson@gmail.com>
* docs(opentelemetry-browser-detector): Use tree-shakeable string constants for semconv in Readme
* Update changelog
* Uninstall unused semantic-conventions package from browser-detector package
* Move changelog entry to Unreleased section
* rm changelog entry, I don't think it is necessary for a small docs update
---------
Co-authored-by: Jamie Danielson <jamieedanielson@gmail.com>
Co-authored-by: Trent Mick <trentm@gmail.com>
* feat: add release-pr update chores as scripts to package.json
* fix: use all instead of api
* docs: update usage comment for extract-latest-release-node.js
* refactor(examples/opentelemetry-web): use new exported string constants for semconv
* added changelog entry
* deleted changelog extra line
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* tests: regenerate recently-expired test TLS certs
Tests started failing yesterday because the various TLS certs in
the repo used for TLS testing had expired
$ openssl x509 -noout -enddate -in experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.crt
notAfter=Jun 7 16:44:23 2024 GMT
This change regenerates all the TLS certs used for testing and
examples/https. It also adds a test case in each relevant package
that will fail with an obvious message when these certs expire
next time (certs are generated with a 1y expiry).
This also adds a comment 'npm run main:regenerate-test-certs'
that can be used to run the maintenance task.
* lint:fix, add changelog entry
* skip cert expiry test on node v14, because crypto.X509Certificate came in node v15
* refactor(examples/otlp-exporter-node): use new exported string constants for semconv
* added changelog entry
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* refactor(instrumentation-xhr): use exported strings for semantic attributes
Signed-off-by: Prashansa Kulshrestha <prashkulshrestha@gmail.com>
* Updated changelog entry with PR id and link
Signed-off-by: Prashansa Kulshrestha <prashkulshrestha@gmail.com>
* Changed normal string to template string and replaced old HTTP_RESPONSE_CONTENT_SIZE to new exported string
Signed-off-by: Prashansa Kulshrestha <prashkulshrestha@gmail.com>
---------
Signed-off-by: Prashansa Kulshrestha <prashkulshrestha@gmail.com>
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* chose(resources): update deprecated semconv to use exported strings
* update test to match changes in contrib 2210
* prep changelog
* update changelog
* Update CHANGELOG.md
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* refactor(examples/https): use new exported string constants for semconv
* refactor(examples/https): use new exported string constants for semconv in the https example
* refactor(examples/http): use new exported string constants for semconv
* added changelog entry
* refactor(examples/http): actually use new exported string constants for semconv
* chore(lint): refactor Markdown linting to use markdownlint-cli2
- first commit is just config changes; lint updates will follow
* lint fixes
* fix markdownlint for rule MD045/no-alt-text
* lint config changes for prefering 'dash' style for rule MD004/ul-style
* lint:markdown:fix changes for MD004/ul-style
* manually apply this h3->h2 fix that Amir had in his #4703 PR
* mention markdown linting in the Linting section of the contributor guide
* add link to rules docs
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* feat: add more scripts for release creation
* Update scripts/extract-latest-release-notes.js
* fix: replace console.log() with console.warn(), ensure get-version.js is a version by checking against a regex
* chore: add comment to describe the regex
* docs: enhanced description for instrumentations in package.json
* chore: CHANGELOG
* fix: do not export description from core package
* fix: revert unrelated change
* fix: remove CHANGELOG entry and fix text
* docs: align all supported versions to a common format
* chore: CHANGELOG
* docs: make markdown list
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* feat(instrumentation): hoist span event hook execution to base class
* test: add test for new hook runner
* chore: changelog
* fix: use event name from arguments
* fix: remove unused import
* fix: make diag message structual
* make the private function start with underscore
* chore: rename insetrumentation event to span customization hook
* chore: update changelog
* chore: lint fix
* Update experimental/packages/opentelemetry-instrumentation/src/instrumentation.ts
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* chore: move CHANGELOG to experimental
* fix: changelog
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* feat!(instrumentation): generic config type and no default config value
* fix: apply type in base Instrumentation interface
* revert: enabled flag rename
* fix: autoloader types
* chore: lint fix
* revert: default config in constructor to empty object
* revert: make constructor config default empty object
* docs: note that instrumentation config fields are optional
* revert: deftaul type for generic
* revert: default object in instrumentation abstract constructor
* chore: lint fix
* chore: changelog
* fix: changelog in merge
* feat(sdk-node): add serviceInstanceIDDetector to NodeSDK
Follow up from #4608
Adds the resource detector ServiceInstanceIDDetector on the NodeSDK constructor.
It only gets added by default on any of those conditions:
- the value `serviceinstance` is part of the list `OTEL_NODE_RESOURCE_DETECTORS`
- `OTEL_NODE_EXPERIMENTAL_DEFAULT_SERVICE_INSTANCE_ID` is set to `true`
* remove OTEL_NODE_EXPERIMENTAL_DEFAULT_SERVICE_INSTANCE_ID
Signed-off-by: maryliag <marylia.gutierrez@grafana.com>
* update readme on how to use `OTEL_NODE_RESOURCE_DETECTORS`
* feedback from review
* Update experimental/packages/opentelemetry-sdk-node/README.md
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* feedback from review
---------
Signed-off-by: maryliag <marylia.gutierrez@grafana.com>
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* moved aws xray propagator from contrib
* updated package lock file
* updated dev dependencies
* added a note about the original location in README
* updated changelog
* fix: limit package-lock.json changes
* removed status section from readme
* chore: align versions with current release
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* feat(node-sdk): implements `service.instance.id`
Implements `service.instance.id`
Signed-off-by: maryliag <marylia.gutierrez@grafana.com>
* implement service instance id by default with env var
use an experimental environment variable to set the default value of `service.instance.id` as default
* Update CHANGELOG.md
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* create separate add experimental for browser and node
create a function to add experimental default values (currently only service instance id, but others can be added in the future),
with the value being set on the node case, but not on the browser case.
Signed-off-by: maryliag <marylia.gutierrez@grafana.com>
* use resource detector for service instance id
use a resource detector for service instance id
* remove references to env variables
* remove Detector and use DetectorSync
remove the Detector and use the DetectorSync instead. Also mark things as experimental.
Signed-off-by: maryliag <marylia.gutierrez@grafana.com>
* Update packages/opentelemetry-resources/src/platform/node/ServiceInstanceIDDetectorSync.ts
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* rename ServiceInstanceIDDetector to ServiceInstanceIDDetectorSync
* change ID to Id
* renaming something temp so git will pick up the name change
it was not picking up the case change on previous commit
* update to final name using Id
---------
Signed-off-by: maryliag <marylia.gutierrez@grafana.com>
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* fix(otlp-grpc-exporter-base): avoid TypeError on exporter shutdown
* chore: update changelog
* fix: use gRPC Client type over any
* fixup! fix: use gRPC Client type over any
* fix: use ts-lint/ts-ignore
This package accidentally got a dep and devDep on api-logs, at
different versions. The result was it being pinned at the older
version in package-lock.
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* add `data` field to the Event interface
* updated body field in the Logs SDK
* updated changelog to breaking change
* lint
* added dedicated type for event data field
* added AnyValue and AnyValueMap types for Event data
* changed body type to LogBody
* markdown lint
* updated Logs SDK
* changed to non-breaking change in the core API
* moved AnyValue to Log API, updated changelog
* feat(node-sdk): add `HostDetector` as default resource detector
Fixes#4282
- Add `HostDetector` to the list of default resource detectors
- Add test to make sure host and process values are being set by default
- Update from deprecated `sdk.detectResources()` to `sdk.start()` on tests
- Update from deprecated `SemanticResourceAttributes.SERVICE_NAME` to `SEMRESATTRS_SERVICE_NAME` on SDK file
* Update experimental/CHANGELOG.md
* fix lint
remove extra lint causing lint error
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* perf(eport): do not allocate arrays if resource has no pending async attributes
* perf(export): do not use splice if fit in one batch
* Update CHANGELOG.md
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
Before this Resource.default() attributes would only be used if *no*
resource was given to LoggerProvider. That would mean that
'service.name' and others could be missing, e.g. when called from
NodeSDK.
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* chore(changelog): move entry that accidentally ended up in a previous version
* fixup! chore(changelog): move entry that accidentally ended up in a previous version
* add sbom workflow
* generate sbom for each package
* generate sbom API
* add prefix to all files
* conditionally add artifacts to releases
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* fix(exporters): use parseHeaders() to ensure header-values are not 'undefined'
* chore: changelog
* fixup! fix(exporters): use parseHeaders() to ensure header-values are not 'undefined'
* fix: (ConsoleMetricExporter): Increase console log depth to get useful information from metrics.
* update: add contribution to changelog.
* Update CHANGELOG.md
* chore: Semantic Conventions export individual strings
* Reduce to just emit full strings and add size-limit test output to review the results
* Update generation to use createConstMap for enums where possible
* Move changelog back to Unreleased -- merge shifted it
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* fix(instr-fetch): do not enable in Node.js; clarify in docs this instr is for web fetch only
* add a changelog entry
* add a diagnostic warning if attempting to use instr-fetch in Node.js
* fixup! add a diagnostic warning if attempting to use instr-fetch in Node.js
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* Add the ability for the implementation to provide the binding event for shutdown.
* fix: whoops totally missed the linting formatting fix step
* Remove any concept of a shutdown event
* add change log and obey interface
* no longer need globalthis
* modify the correct changelog and identify this as a breaking change under the scenario in comments
* markdown lint
* Update experimental/CHANGELOG.md
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* feat(instrumentation): add getModuleDefinitions() instead of making init() public
* test(instrumetation): add tests for getModuleDefinitions()
* chore: changelog
* fix(sdk-metrics): allow single bucket histograms
* test(sdk-metrics): undefined and null inputs for bucket boundaries
* fixup! test(sdk-metrics): undefined and null inputs for bucket boundaries
* Allow LoggerProvider to be specified in Instrumentations
* Update
* Lint
* Add test
* npm i
* Update changelog
* npm i
* marking setLoggerProvider as optional
* Add check for possible undefined method
* npm i
* fix(sdk-node): Allow tracerProvider to be created when exporter is defined in the env.
* fix(node-sdk): Update to not accept when exporter is set to none.
* fix(sdk-node): Update Changelog.
* fix(sdk-node): Fix Changelog.
* fix(sdk-node): cleanup changelog.
* fix(sdk-node): lint fix
* fix(sdk-node): Fix logic for creating tracerProviders.
* Fix lint.
* Update experimental/CHANGELOG.md
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* Fix manual sampler and environment exporter case.
* Update logic to check for a defined traceExporter on the config before using the NodeTracerProvider.
* Fix equality check.
* Update env exporter configuration logic and add tests.
* Update experimental/CHANGELOG.md
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* Fix changelog issues.
* Clean up tracerProvider logic.
* Update sdk.ts
* Update sdk.ts
* Update experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* Update experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* Update experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* fix(sdk-trace-base): Export processed spans while exporter failed
While the exporter deals with a batch of spans, new spans may come in and wait
to be exported. As previously implemented, a successful export would notice
these waiting spans, triggering a renewed timer check, but not so for an
unsuccessful export.
The result was that, prior to this commit, a failing export may end up in a
situation where no further spans will be exported. This is due to the behaviour
of `_addToBuffer` when the queue is full: Imagine an export which fails after a
long timeout (because of, for instance, network troubles). While the connection
waits to be timed out, the span queue fills up. Once completely full, no new
calls to recheck the timer will be done. On its own, this behaviour is
fine. When combined with the patched bug, this leads to a rather confusing case
where the exporter never tries exporting.
* fix(changelog): add entry
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* chore(otel-resources): replace deprecated spanAttributes
* update minimum api version to 1.1
* update changelog
* per legendecas, add todo for ResourceAttributes
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* fix(exporter-logs-otlp-proto): programatic headers take precedence over environment variables
* chore: update PR url in changelog
* chore: fix deletion of env var
* fix(exporter-logs-otlp-http): programatic headers take precedence over environment variables
* fix(exporter-trace-otlp-http): programatic headers take precedence over environment variables
* fix(exporter-trace-otlp-proto): programatic headers take precedence over environment variable
* chore: update CHANGELOG
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* fix(instrumentation): do not import 'path' in browser runtimes
* fix(changelog): clean up and add entry
* fix(instrumentation): add missing license header
* fix(changelog): formatting
* fix(instrumentation): do not throw
* Add Trent to approvers (#4311)
* chore(renovate): require dashboard approval for lerna updates (#4276)
* chore(ci): install semver globally to speed up "peer-api" workflow (#4270)
Closes: #4242
* fix(ci): remove token setup via environment variable from .npmrc (#4329)
* fix(instrumentation-http): resume responses when there is no response listener
Fixes a memory leak where unhandled response bodies pile up in node 20
* feat: add script to update changelogs on release preparation (#4315)
* feat: add script to update changelogs on releases
* fix: address comments
* Apply suggestions from code review
Co-authored-by: Trent Mick <trentm@gmail.com>
* fix: apply suggestions from code review
* fix: use packageJson.version instead of version
---------
Co-authored-by: Trent Mick <trentm@gmail.com>
* Fix event name
* test: make rawRequest HTTP-compliant
* Add node 20 to test matrix
* Enable old hash functions on 20
* Fix esm handling for iitm node 20
* Use err.code to make test more reliable
* Changelog
* nit: single import
* Remove unused files
* Add v20 to supported runtimes
* ci: add npm cache in actions/setup-node (#4271)
* feat(sdk-logs): add droppedAttributesCount field to ReadableLogRecord (#4289)
* feat(sdk-logs): add droppedAttributesCount field to ReadableLogRecord
* chore: check droppedAttributesCount value in test case
* feat(otlp-transformer): make toLogRecord() use ReadableLogRecord.droppedAttributesCount
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* fix(api-logs): allow passing in TimeInput for LogRecord (#4345)
* fix: allow passing in TimeInput for LogRecord
* chore: update changelog
* fix: programmatic url and headers take precedence in metric exporters… (#4334)
* fix: programmatic url and headers take precedence in metric exporters (#2370)
* chore: adjust grpc exporter metrics test
* chore(changelog): update changelog
* fix(instrumentation-http): do not mutate given headers object for outgoing http requests (#4346)
Fixes: https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1609
* chore(deps): update actions/stale action to v9 (#4353)
* fix(deps): update dependency import-in-the-middle to v1.6.0 (#4357)
* chore(deps): update all patch versions (#4306)
* chore(ci): use node 20 in lint workflow (#4359)
* chore(deps): update dependency linkinator to v6 (#4237)
* fix(otlp-exporter-base): decrease default concurrency limit to 30 (#4211)
* fix(otlp-exporter-base): decrease concurrency limit to 30
* fix(changelog): add changelog entry
* chore(deps): use actions/checkout >4 instead of 4.0.0 exactly (#4361)
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
Co-authored-by: strivly <133362191+strivly@users.noreply.github.com>
Co-authored-by: Trent Mick <trentm@gmail.com>
Co-authored-by: lyzlisa <34400837+lyzlisa@users.noreply.github.com>
Co-authored-by: Hyun Oh <hyunnoh01@gmail.com>
Co-authored-by: Siim Kallas <siimkallas@gmail.com>
Co-authored-by: Vladimir Adamić <441333+Vunovati@users.noreply.github.com>
Co-authored-by: Mend Renovate <bot@renovateapp.com>
* feat(sdk-logs): add droppedAttributesCount field to ReadableLogRecord
* chore: check droppedAttributesCount value in test case
* feat(otlp-transformer): make toLogRecord() use ReadableLogRecord.droppedAttributesCount
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* chore: track package-lock.json (#4238)
* chore: track package-lock.json
* Pin to old versions for node 14
* Use version range
* Remove unused cached directories
* Temporarily disable other tests
* Temporarily enable only api test
* Enable only some packages
* Test only api packages
* Test trace exporters
* Fix line ordering
* Test all packages except otlp exporters
* Add trace http exporter
* Add trace proto exporter
* Test all but grpc exporters
* chore: use npm workspaces and degrade lerna to v6
* chore: get rid of lerna bootstrap
* chore: use npx
* chore: allow install scripts to setup buf
* chore: fix w3c-integration-test cache key
* chore: fix cache key
* chore: disable resource compat test
* chore: fix node_modules assumptions
* chore: fix hoisted karma issue
* chore: fix markdown linter complaints
* chore: lock @grpc/grpc-js to v1.8.21
* Break caches
* chore: remove cache
* chore: fixup inline commands
---------
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* docs: fixed link to benchmark results (#4233)
Co-authored-by: Chengzhong Wu <legendecas@gmail.com>
* chore(deps): update all patch versions (#4215)
* fix: otlp json encoding (#4220)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* fix: remove duplicate export star from version.ts (#4225)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* docs: fix sdk-node config instructions (#4249)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* feat(api): publish api esnext target (#4231)
* chore: release API 1.7.0/Core 1.18.0/Experimental 0.45.0 (#4254)
* fix(sdk-metrics): hand-roll MetricAdvice type as older API versions do not include it (#4260)
* chore: prepare release 1.18.1/0.45.1 (#4261)
* chore: no need for 'packages' in "lerna.json" (#4264)
* Benchmark tests for trace OTLP transform and BatchSpanProcessor (#4218)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* chore: type reference on zone.js (#4257)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* docs: add docker-compose to run prometheus for the experimental example (#4268)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* fix(sdk-logs): avoid map attribute set when count limit exceeded (#4195)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* chore(deps): update dependency chromedriver to v119 [security] (#4280)
* chore(deps): update actions/setup-node action to v4 (#4236)
* fix(sdk-trace-base): processor onStart called with a span having empty attributes (#4277)
Co-authored-by: artahmetaj <artahmetaj@yahoo.com>
* Update fetch instrumentation to be runtime agnostic (#4063)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
---------
Co-authored-by: Chengzhong Wu <legendecas@gmail.com>
Co-authored-by: Martin Kuba <martin@martinkuba.com>
Co-authored-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: Siim Kallas <siimkallas@gmail.com>
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
Co-authored-by: David Luna <david.luna@elastic.co>
Co-authored-by: Dinko Osrecki <dinko.osrecki@emarsys.com>
Co-authored-by: Trent Mick <trentm@gmail.com>
Co-authored-by: François <32224751+Lp-Francois@users.noreply.github.com>
Co-authored-by: Hyun Oh <hyunnoh01@gmail.com>
Co-authored-by: André Cruz <andremiguelcruz@msn.com>
Co-authored-by: artahmetaj <artahmetaj@yahoo.com>
Co-authored-by: drewcorlin1 <82601620+drewcorlin1@users.noreply.github.com>
* chore: track package-lock.json
* Pin to old versions for node 14
* Use version range
* Remove unused cached directories
* Temporarily disable other tests
* Temporarily enable only api test
* Enable only some packages
* Test only api packages
* Test trace exporters
* Fix line ordering
* Test all packages except otlp exporters
* Add trace http exporter
* Add trace proto exporter
* Test all but grpc exporters
* chore: use npm workspaces and degrade lerna to v6
* chore: get rid of lerna bootstrap
* chore: use npx
* chore: allow install scripts to setup buf
* chore: fix w3c-integration-test cache key
* chore: fix cache key
* chore: disable resource compat test
* chore: fix node_modules assumptions
* chore: fix hoisted karma issue
* chore: fix markdown linter complaints
* chore: lock @grpc/grpc-js to v1.8.21
* Break caches
* chore: remove cache
* chore: fixup inline commands
---------
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* feat(minification): Add noEmitHelpers, importHelpers and tslib as a dependency
* fix: Lint fixes
* Remove noEmitHelpers as not needed
---------
Co-authored-by: Chengzhong Wu <legendecas@gmail.com>
* feat(api-logs): add `ObservedTimestamp` to `LogRecord`
* chore(changelog): add changelog
* fix(sdk-logs): use `Date` instead of `hrTime()` for timestamps
---------
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Co-authored-by: Martin Kuba <martin@martinkuba.com>
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* fix(opentelemetry-sdk-trace-web): don't crash in runtimes where location isn't defined
* chore: updated changelog
* chore(opentelemetry-sdk-trace-web): fix linter issues
* fix(opentelemetry-sdk-trace-web): Remove broken test and replace with comment
---------
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* refactor: move ProcessDetector to node; export noopDetector for Browser
* feat: collect additional process attributes
* refactor: always return a process resource
This commit introduces a slight change in behavior. Previously the
ProcessDectector would validate that it received attributes that it
expected, and returned an empty Resource if it didn't. Based on the
types, and the implementation of the ProcessDetector, there will
always be a valid ProcessResource. Collection of many of the attributes
can be done as a best effort without violating the specification.
* chore: add changelog entry
* feat: collect process.execArgv in process.command_args
* refactor: omit process.command_line in favor of process.command_args
* Move changelog entry to unreleased
---------
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
* update versions in http example
* use newer active span methods for http example
* fix(changelog): add changelog entry
* Add http example to lerna
---------
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* fix: set http.target as path (like spec) and not pathname
* fix: set http.target as path (like spec) and not pathname
* fix: set http.target as path (like spec) and not pathname
* added events API package
* removed events from Logs API
* updated logs tests
* added tooling and tests to api-events
* fixed package name, updated changelog, updated tsconfig
* lint
* added back precompile script, minor updates
* tsconfig updates
* changed logger to emitter in a test
* added domain as a required parameter for creating an emitter, removed from Event
* lint
* Update experimental/packages/api-events/package.json
Co-authored-by: Chengzhong Wu <legendecas@gmail.com>
---------
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Co-authored-by: Nev <54870357+MSNev@users.noreply.github.com>
Co-authored-by: Chengzhong Wu <legendecas@gmail.com>
* chore: regenerate tsconfig files
* fix: add generated js files back to proto base esnext
* Changelog
---------
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* fix(sdk-node): register instrumentations early
Register instrumentations as first step in start() before it gets async to
ensure that modules required during async resource detection get instrumented.
* Update experimental/CHANGELOG.md
---------
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* fix: include TraceState in trace exports
Include TraceState in OTEL spans and links.
Print span.traceState in ConsoleSpanExporter.
* Update experimental/CHANGELOG.md
* Update CHANGELOG.md
* feat: add exponential histogram mapping functions
* Apply suggestions from code review
Co-authored-by: Marc Pichler <marcpi@edu.aau.at>
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* chore: fix compile
* refactor: use Number.MAX_VALUE directly
* chore: add docs to mapping and ieee754
* chore: move MIN_SCALE and MAX_SCALE to unexported constants
* chore: remove currently unused test helper
* chore: lint
* refactor: build all scales, extract single getMapping function
* fix: off by one error when pre-building mappings
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
Co-authored-by: Marc Pichler <marcpi@edu.aau.at>
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* fix: avoid grpc types dependency
Avoid a dependency to grpc types by moving the into a internal-types.ts file.
* Update CHANGELOG.md
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* add node & browser platform for exporter-trace-otlp-proto
* add browser support for proto base exporter
* add base browser class with xhr support
* add browser class for proto trace exporter
* slight tweaks to make it work
* send data as blob to avoid making sync xhr requests
* fix lint
* remove console.logs and add browser proto example
* cleanup and start adding tests
* Undo formatting changes
* exporter-trace-otlp-proto: fix compile errors
* Misc updates from review comments
* Adding changelog entry
* Reverting format changes not needed
* Moving the send function into the class for browser case.
* Adjust indentation to fix lint errors
* Remove template parameter that's not needed
* Apply review changes
* fix the import path
* Addressing lint errors
* Explicit imports for browser case
* More explicit exports
* Add missing exports
* Address lint issues with export statements
* Adding missing exports
* Adding missing export
* Using import from top level folder
* Trigger Build
* Update experimental/packages/exporter-trace-otlp-proto/test/browser/CollectorTraceExporter.test.ts
Co-authored-by: Marc Pichler <marcpi@edu.aau.at>
* Remove trailing comma
* Remove blank line to fix lint error
* Fixes based on testing opentelemetry-web/fetch-proto
* Add additional missing export
* Skip hex conversion of traceId for the protobuf
* Add esm/esnext builds for the proto packages
that will now be used for the browser case as well.
* Trigger Build
Co-authored-by: Santosh Cheler <scheler@cisco.com>
Co-authored-by: Santosh Cheler <santosh.cheler@gmail.com>
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
Co-authored-by: Marc Pichler <marcpi@edu.aau.at>
* chore: release SDK 1.9.0 / 0.35.0
* Update readme
* Move API changelog entries
* Add API to release
* API changelog
* Update additional api max version
* fix(api): use active context as default in NoopTracer
To support the API without SDK use cast to forward a span context it's needed
to fetch active context via ContextManager also in NoopTracer. Otherwise only
direct passing of a context works but not if context.with() is used.
* update PR link
* fixup: correct link
* remove unneeded assert
* fix(prometheus-sanitization): fix multiple underscores
* fix(prometheus-sanitization): updated test to check for multiple underscores as well
* fix(prometheus-sanitization): updated CHANGELOG.md
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* chore: improve windows compatibility update-ts-config
Change update-ts-config script to generate posix path also on windows to avoid
that tsconfig.json files are wrongly modified.
* fixup add comment
* fix(instrumentation): only call `onRequire` for full matches on core modules with sub-paths
* chore: add changelog entry
* chore(instrumentation): add `ModuleNameTrieSearchOptions` type
* chore(instrumentation): fix linting errors
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* docs: fix comment in metrics api refering to span
* fix(api): deprecate MetricsAttributes and MetricAttributeValue
* fix: typo in changelog
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* fix(sdk-metrics): use default Resource to comply with semantic conventions
* fix(prometheus-exporter): escape default resource attribute values
* fix(changelog): use correct pr number
* ci: run browser tests without circle
* Reduce scope
* Bring back other tests
* Apply to webworker tests
* Changelog
* Use specific node version
* Review comments
* Downgrade node in both places
* deps: remove unused protobufjs and update used ones to 7.1.1
* fix(changelog): add chanelog entry.
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* feat: add the ability to set the views via the SDK constructor
* docs: update CHANGELOG.md
* test: added test for checking if views configured when passed to the SDK
* test: update test to check view got applied by renaming an counter metric's name
* style: run `lint:fix` command on package
* style: remove unused imports
* style: fix identation linting issue in `sdk.test.ts`
* docs: add reference to views-parameter of the NodeSDK
* fix: throw an error when NodeSDK is used incorrectly
* fix: improve the way handling views without metric reader
* chore: update code
* test: update the test cases
* fix: update reader, if needed
Co-authored-by: Weyert de Boer <weyert.deboer@tapico.io>
* Increase max old space size
* Reduce max free space to 4096
* No need to expand memory on docs test
* Increase headroom
Testing shows that the docs generation uses about 3.9GB so a bit of
headroom seems like a good idea
* add function to extract hostname and port from parsed option
Signed-off-by: Cuichen Li <cuichli@cisco.com>
* add unit test
Signed-off-by: Cuichen Li <cuichli@cisco.com>
* remove code for setting http.host when received the response
Signed-off-by: Cuichen Li <cuichli@cisco.com>
* fix lint issue
* add changelog
* only use manually formatted host when options.host is not defined
* add event listener on timeout so span is closed properly
* add test
* use header as host source instead
* try remove span number check
* update based on comment
* Update experimental/CHANGELOG.md
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Co-authored-by: Valentin Marchaud <contact@vmarchaud.fr>
* feat: add InMemoryMetricExporter
Introduces the `InMemoryMetricExporter`-class which collects metrics and stores it in memory
* style: improve comments
* style: improve comments
* test: created test for the `InMemoryMetricExporter`-class
* fix: remove the `clear`-method from `InMemoryMetricExporter`-class
* fix: add missing `ResourceMetrics` import
* style: ran `lint:fix` command on the code base
* docs: add CHANGELOG.md entry for the new `InMemoryMetricExporter`-class
* test: drop the `describe.only`
* test: improve test coverage
* Split reset and forceFlush
* fix: remove meterprovider typo
* Remove calls to missing setup method
* Use api meter in test
* Browser support
* style: lint
Co-authored-by: Weyert de Boer <weyert.deboer@tapico.io>
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
* feature(sdk-metrics-base): distinguish between Sum and Gauge in MetricData
* feat(sdk-metrics-base): fix test.
* fix(changelog): add changelog entry.
* feat(prometheus-serializer): add test for gauge serialization.
* feat(sdk-metrics-base): add assertions for isMonotonic in Instrument tests.
* feat(otlp-transformer): add test-cases for non-monotonic sums.
* feat(prometheus-exporter): add test-cases for gauges.
* fix(sdk-metrics-base): remove DataPointType.SINGULAR
* fix(changelog): add more details about breaking changes.
* chore(deps): update dependency ts-mocha to v9
* chore: remove test scripts if there are no tests
* chore: remvoe also coverage script
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: legendecas <legendecas@gmail.com>
* chore: use a single lerna monorepo
* chore: release API dependencies
* chore: fix selenium exporter
* chore: support old API versions
* chore: update changelog
* chore: remove peer api check
* chore: changelog
* chore: fix cache keys and paths
* chore: fix lint cache
* ci: install when cache misses
* chore: apply cache fix to webworker and web
* chore: apply cache fix to lint
* chore: revert peer api check removal
* chore: match peer and dev dependency versions for API
* chore: send full string to lerna exec
* chore: use npm script for peer api check
* chore: use MetricAttributes in metrics
* chore: use MetricAttributes when appropriate
Co-authored-by: Valentin Marchaud <contact@vmarchaud.fr>
> **Please read all parts of this form carefully.** By following the instructions carefully, you ensure that we
> can get started fixing your bug, instead of being stuck at trying to reproduce your issue. Please provide
> all requested information, even if you think it does not apply to your problem.
>
> **If you use a third-party package that re-distributes OpenTelemetry, open the bug ticket with that third party unless you can provide steps to reproduce this with pure OpenTelemetry.**
> Digging into third-party distributions of OpenTelemetry is not in scope for this project.
Before filing a bug, please be sure you have searched through [existing open bugs](https://github.com/open-telemetry/opentelemetry-js/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Abug)
to see if this bug has already been filed.
- type:markdown
attributes:
value:|
## Bug Reproduction
- type:textarea
attributes:
label:What happened?
description:|
> [!IMPORTANT]
> **Please provide as much detail as you reasonably can.**
> We all know the complexities of developing with JavaScript/TypeScript. **Be specific** about your setup and **DO NOT** assume that the person handling your bug report knows how to use your specific combination of tooling. Always provide build instructions and config files.
value:|
## Steps to Reproduce
<!--
The most effective way to solve a bug is to provide a link to a reproducer repository. It is extremely difficult to exactly reproduce problems
and doing so can take multiple hours for us. You know your tooling and setup and we know OpenTelemetry JavaScript internals.
Let's help each other! :)
-->
## Expected Result
## Actual Result
## Additional Details
<!--
Anything you can think of that will help us reproduce and understand your problem:
- details about the behavior of the bug
- code to reproduce, if not provided via a repository above (including setting up any frameworks you may be using, we likely don't use the same tech-stack that you're using on the daily)
- which tooling you use and how you're using it
- config files for your tooling (typescript, bundlers, ...)
- how you run your code (example:`node -r otel.js ./index.js`).
- which module type you are you using (`module` or `commonjs`)
-->
validations:
required:true
- type:textarea
attributes:
label:OpenTelemetry Setup Code
description:|
Please provide the code you use to set up OpenTelemetry.
If you use `@opentelemetry/auto-instrumentations-node/register`, please state so here.
You may omit this step if you have provided a reproducer repository.
Please provide your the full package.json needed to reproduce the issue.
You may omit this step if you provided a reproducer repository.
render:"JSON"
placeholder:|
{
"name": "my-app",
"scripts": {
"start": "node -r otel.js app.js"
},
"dependencies": {
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/sdk-trace-base": "~1.3.1",
...
}
}
- type:textarea
attributes:
label:Relevant log output
description:|
Please copy and paste any relevant log output.
render:shell
- type:markdown
attributes:
value:|
## System Details
System Details help us when we cannot reproduce your problem with the information provided above. Sometimes bugs only surface on specific platforms and runtime versions.
- type:textarea
attributes:
label:Operating System and Version
placeholder:Ubuntu 24.04, Windows 11 Build 26100.2033, macOS 15.0.1
gh pr comment ${PR_NUM} --repo open-telemetry/opentelemetry-js --body "Thank you for your contribution @${USERNAME}! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this [survey](${SURVEY_URL})."
* [#2776](https://github.com/open-telemetry/opentelemetry-js/pull/2776) feat(sdk-metrics-base): add ValueType support for sync instruments ([@legendecas](https://github.com/legendecas))
* [#2686](https://github.com/open-telemetry/opentelemetry-js/pull/2686) feat(sdk-metrics-base): implement async instruments support ([@legendecas](https://github.com/legendecas))
* [#2666](https://github.com/open-telemetry/opentelemetry-js/pull/2666) feat(sdk-metrics-base): meter registration ([@legendecas](https://github.com/legendecas))
* [#2658](https://github.com/open-telemetry/opentelemetry-js/pull/2658) Update metrics example ([@svetlanabrennan](https://github.com/svetlanabrennan))
* [#2676](https://github.com/open-telemetry/opentelemetry-js/pull/2676) fix(sdk-metrics-base): remove aggregator.toMetricData dependency on AggregationTemporality ([@legendecas](https://github.com/legendecas))
* [#2725](https://github.com/open-telemetry/opentelemetry-js/pull/2725) feat(sdk-metrics-base): document and export basic APIs ([@legendecas](https://github.com/legendecas))
* [#2712](https://github.com/open-telemetry/opentelemetry-js/pull/2712) docs(api-metrics): add notes on ObservableResult.observe ([@legendecas](https://github.com/legendecas))
* [#2820](https://github.com/open-telemetry/opentelemetry-js/pull/2820) feat(views): Update addView() to disallow named views that select more than one instrument. ([@pichlermarc](https://github.com/pichlermarc))
* [#2813](https://github.com/open-telemetry/opentelemetry-js/pull/2813) Add grpc compression to trace-otlp-grpc exporter ([@svetlanabrennan](https://github.com/svetlanabrennan))
* [#2695](https://github.com/open-telemetry/opentelemetry-js/pull/2695) refactor: unifying shutdown once with BindOnceFuture ([@legendecas](https://github.com/legendecas))
* feat(instrumentation-http): Added support for redacting specific url query string values and url credentials in instrumentations [#5743](https://github.com/open-telemetry/opentelemetry-js/pull/5743) @rads-1996
### :boom: Breaking Changes
### :rocket: Features
### :bug: Bug Fixes
* fix(sdk-metrics): Remove invalid default value for `startTime` param to ExponentialHistogramAccumulation. This only impacted the closurescript compiler. [#5763](https://github.com/open-telemetry/opentelemetry-js/pull/5763) @trentm
* fix(resource): do not trigger `Accessing resource attributes before async attributes settled` warning when detecting resources [#5546](https://github.com/open-telemetry/opentelemetry-js/pull/5546) @dyladan
* verbose logging of detected resource removed
* fix(resource): use dynamic import over require to improve ESM compliance [#5298](https://github.com/open-telemetry/opentelemetry-js/pull/5298) @xiaoxiangmoe
### :books: Documentation
* refactor(metrics): Updated metrics samples to no longer treat `sdk.start()` as async [#5617](https://github.com/open-telemetry/opentelemetry-js/pull/5617) @JacksonWeber
### :house: Internal
* refactor(sdk-trace-base): update semconv usage to ATTR_ exports [#5669](https://github.com/open-telemetry/opentelemetry-js/pull/5669) @trentm
* refactor(sdk-trace-web): update semconv usage to ATTR_ exports [#5672](https://github.com/open-telemetry/opentelemetry-js/pull/5672) @trentm
* refactor(resources): update semconv usage to ATTR_ exports [#5666](https://github.com/open-telemetry/opentelemetry-js/pull/5666) @trentm
- The **minimum supported Node.js has been raised to `^18.19.0 || >=20.6.0`**. This means that support for Node.js 14 and 16 has been dropped.
- The **minimum supported TypeScript version has been raised to 5.0.4**.
- The **compilation target for transpiled TypeScript has been raised to ES2022** (from ES2017).
- The **public interface has changed**
- for notes on migrating to 2.x / 0.200.x see [the upgrade guide](https://github.com/open-telemetry/opentelemetry-js/tree/main/doc/upgrade-to-2.x.md)
- Only experimental versions `0.200.0` are compatible with this release
### :boom: Breaking Change
* feat(sdk-trace-base)!: Add `parentSpanContext` and remove `parentSpanId` from `Span` and `ReadableSpan` [#5450](https://github.com/open-telemetry/opentelemetry-js/pull/5450) @JacksonWeber
* (user-facing): the SDK's `Span`s `parentSpanId` was replaced by `parentSpanContext`, to migrate to the new property, please replace `span.parentSpanId` -> `span.parentSpanContext?.spanId`
* feat(sdk-metrics)!: drop deprecated `type` field on `MetricDescriptor` [#5291](https://github.com/open-telemetry/opentelemetry-js/pull/5291) @chancancode
* feat(sdk-metrics)!: drop deprecated `InstrumentDescriptor` type; use `MetricDescriptor` instead [#5277](https://github.com/open-telemetry/opentelemetry-js/pull/5266) @chancancode
* feat(sdk-metrics)!: bump minimum version of `@opentelemetry/api` peer dependency to 1.9.0 [#5254](https://github.com/open-telemetry/opentelemetry-js/pull/5254) @chancancode
* feat(sdk-metrics)!: remove MeterProvider.addMetricReader() in favor of constructor option [#4419](https://github.com/open-telemetry/opentelemetry-js/pull/4419) @pichlermarc
* feat(sdk-metrics)!: replace attributeKeys with custom processors option [#4532](https://github.com/open-telemetry/opentelemetry-js/pull/4532) @pichlermarc
* refactor(sdk-trace-base)!: replace `SpanAttributes` with `Attributes` [#5009](https://github.com/open-telemetry/opentelemetry-js/pull/5009) @david-luna
* refactor(resources)!: replace `ResourceAttributes` with `Attributes` [#5016](https://github.com/open-telemetry/opentelemetry-js/pull/5016) @david-luna
* feat(sdk-metrics)!: drop `View` and `Aggregation` in favor of `ViewOptions` and `AggregationOption` [#4931](https://github.com/open-telemetry/opentelemetry-js/pull/4931) @pichlermarc
* refactor(sdk-trace-base)!: remove `new Span` constructor in favor of `Tracer.startSpan` API [#5048](https://github.com/open-telemetry/opentelemetry-js/pull/5048) @david-luna
* refactor(sdk-trace-base)!: remove `BasicTracerProvider.addSpanProcessor` API in favor of constructor options. [#5134](https://github.com/open-telemetry/opentelemetry-js/pull/5134) @david-luna
* refactor(sdk-trace-base)!: make `resource` property private in `BasicTracerProvider` and remove `getActiveSpanProcessor` API. [#5192](https://github.com/open-telemetry/opentelemetry-js/pull/5192) @david-luna
* feat(sdk-metrics)!: extract `IMetricReader` interface and use it over abstract class [#5311](https://github.com/open-telemetry/opentelemetry-js/pull/5311)
* (user-facing): `MeterProviderOptions` now provides the more general `IMetricReader` type over `MetricReader`
* If you accept `MetricReader` in your public interface, consider accepting the more general `IMetricReader` instead to avoid unintentional breaking changes
* feat(sdk-trace)!: remove ability to have BasicTracerProvider instantiate exporters [#5239](https://github.com/open-telemetry/opentelemetry-js/pull/5239) @pichlermarc
* When extending `BasicTracerProvider`, the class offered multiple methods to facilitate the creation of exporters and auto-pairing with `SpanProcessor`s.
* This functionality has been removed - users may now pass `SpanProcessor`s to the base class constructor when extending
* (user-facing): `_registeredExporters` has been removed
* (user-facing): `_getSpanExporter` has been removed
* (user-facing): `_buildExporterFromEnv` has been removed
* feat(core)!: remove deprecated `IdGenerator` and `RandomIdGenerator` [#5309](https://github.com/open-telemetry/opentelemetry-js/pull/5309) @pichlermarc
* feat(core)!: remove deprecated type `InstrumentationLibrary` [#5308](https://github.com/open-telemetry/opentelemetry-js/pull/5308) @pichlermarc
* (user-facing): please use equivalent type `InstrumentationScope` instead
* feat(sdk-trace-base)!: replace usages fo `InstrumentationLibrary` with `InstrumentationScope` [#5308](https://github.com/open-telemetry/opentelemetry-js/pull/5308) @pichlermarc
* also renames the property in implementations of `ReadableSpan`
* feat(exporter-jaeger): use `ReadableSpan.instrumentationScope` over `ReadableSpan.instrumentationLibrary` [#5308](https://github.com/open-telemetry/opentelemetry-js/pull/5308) @pichlermarc
* feat(exporter-zipkin): use `ReadableSpan.instrumentationScope` over `ReadableSpan.instrumentationLibrary` [#5308](https://github.com/open-telemetry/opentelemetry-js/pull/5308) @pichlermarc
* chore!: update typescript to version `5.0.4` [#5145](https://github.com/open-telemetry/opentelemetry-js/pull/5145) @david-luna
* (user-facing) dropped support for `typescript@<5.0.4`
* (user-facing) all packages published from this repository will from now on drop support for old versions of `typescript` in minor releases. We will only drop support for versions that are older than 2 years.
* (user-facing): deprecated `AlwaysOnSampler` has moved to `@opentelemetry/sdk-trace-base`
* (user-facing): deprecated `AlwaysOffSampler` has moved to `@opentelemetry/sdk-trace-base`
* (user-facing): deprecated `ParentBasedSampler` has moved to `@opentelemetry/sdk-trace-base`
* (user-facing): deprecated `TraceIdRatioSampler` has moved to `@opentelemetry/sdk-trace-base`
* feat(resource): Merge sync and async resource interfaces into a single interface [#5350](https://github.com/open-telemetry/opentelemetry-js/pull/5350) @dyladan
* Resource constructor now takes a single argument which contains an optional `attributes` object
* Detected resource attribute values may be a promise or a synchronous value
* Resources are now merged by the order in which their detectors are configured instead of async attributes being last
* Resource detectors now return `DetectedResource` plain objects instead of `new Resource()`
* feat(sdk-trace-base)!: drop ability to instantiate propagators beyond defaults [#5355](https://github.com/open-telemetry/opentelemetry-js/pull/5355) @pichlermarc
* (user-facing): only a non-env-var based default is now used on `BasicTracerProvider#register()`.
* propagators can now not be configured via `OTEL_PROPAGATORS` or `window.OTEL_PROPAGATORS` anymore, please pass the propagator to `NodeTracerProvider#register()` instead.
* if not configured directly via code, `BasicTracerProvider#register()` will now fall back to defaults (`tracecontext` and `baggage`)
* feat(sdk-trace-node)!: drop ability to instantiate propagators beyond defaults [#5355](https://github.com/open-telemetry/opentelemetry-js/pull/5355) @pichlermarc
* (user-facing): only a non-env-var based default is now used on `NodeTracerProvider#register()`.
* propagators can now not be configured via `OTEL_PROPAGATORS` anymore, please pass the propagator to `NodeTracerProvider#register()` instead.
* if not configured via code, `NodeTracerProvider#register()` will now fall back to the defaults (`tracecontext` and `baggage`)
* if autoconfiguration based on enviornment variables is needed, please use `NodeSDK` from `@opentelemetry/sdk-node`.
* feat(sdk-trace-web)!: drop ability to instantiate propagators beyond defaults [#5355](https://github.com/open-telemetry/opentelemetry-js/pull/5355) @pichlermarc
* (user-facing): only a non-env-var based default is now used on `WebTracerProvider#register()`.
* propagators can now not be configured via `window.OTEL_PROPAGATORS` anymore, please pass the propagator to `WebTracerProvider#register()` instead.
* if not configured via code, `WebTracerProvider#register()` will now fall back to defaults (`tracecontext` and `baggage`)
* feat(sdk-trace)!: drop unnecessary exports [#5405](https://github.com/open-telemetry/opentelemetry-js/pull/5405) @pichlermarc
* (user-facing): `EXPORTER_FACTORY` is not used anymore and has been removed
* (user-facing): `PROPAGATOR_FACTORY` is not used anymore and has been removed
* (user-facing): `ForceFlushState` was intended for internal use and has been removed
* (user-facing): the `Tracer` class was unintentionally exported and has been removed
* to obtain a `Tracer`, please use `BasicTracerProvider#getTracer()`, `NodeTracerProvider#getTracer()` or `WebTracerProvider#getTracer()`
* to reference a `Tracer`, please use the `Tracer` type from `@opentelemetry/api`
* chore!: Raise the minimum supported Node.js version to `^18.19.0 || >=20.6.0`. Support for Node.js 14, 16, and early minor versions of 18 and 20 have been dropped. This applies to all packages except the 'api' and 'semantic-conventions' packages. [#5395](https://github.com/open-telemetry/opentelemetry-js/issues/5395) @trentm
* feat(core)!: remove TracesSamplerValues from exports [#5406](https://github.com/open-telemetry/opentelemetry-js/pull/5406) @pichlermarc
* (user-facing): TracesSamplerValues was only consumed internally and has been removed from exports without replacement
* chore(resources)!: Remove deprecated duplicate browser detector from `@opentelemetry/resource` in favor of `@opentelemetry/opentelemetry-browser-detector` [#5420](https://github.com/open-telemetry/opentelemetry-js/pull/5420)
* feat(core)!: remove unused and obsolete functions and types [#5444](https://github.com/open-telemetry/opentelemetry-js/pull/5444) @pichlermarc
* (user-facing): `VERSION` was an internal constant that was unintentionally exported. It has been removed without replacement.
* (user-facing): `isWrapped` has been removed in favor of `isWrapped` from `@opentelemetry/instrumentation`
* (user-facing): `ShimWrapped` has been removed in favor of `ShimWrapped` from `@opentelemetry/instrumentation`
* (user-facing): `hexToBase64` was a utility function that is not used by the SDK anymore. It has been removed without replacement.
* (user-facing): `hexToBinary` was a utility function that now internal to `@opentelemetry/otlp-tranformer`. It has been removed without replacement.
* (user-facing): `baggageUtils.getKeyParis` was an internal utility function that was unintentionally exported. It has been removed without replacement.
* (user-facing): `baggageUtils.serializeKeyPairs` was an internal utility function that was unintentionally exported. It has been removed without replacement.
* (user-facing): `baggageUtils.parseKeyPairsIntoRecord,` has been removed in favor of `parseKeyPairsIntoRecord`
* (user-facing): `baggageUtils.parsePairKeyValue` was an internal utility function that was unintentionally exported. It has been removed without replacement.
* (user-facing): `TimeOriginLegacy` has been removed without replacement.
* (user-facing): `isAttributeKey` was an internal utility function that was unintentionally exported. It has been removed without replacement.
* feat(sdk-trace-base)!: do not read environment variables from window in browsers [#5445](https://github.com/open-telemetry/opentelemetry-js/pull/5455) @pichlermarc
* (user-facing): all configuration previously possible via `window.OTEL_*` is now not supported anymore, please pass configuration options to constructors instead.
* Note: Node.js environment variable configuration continues to work as-is.
* feat(exporter-zipkin)!: do not read environment variables from window in browsers [#5465](https://github.com/open-telemetry/opentelemetry-js/pull/5465) @pichlermarc
* (user-facing): all configuration previously possible via `window.OTEL_*` is now not supported anymore, please pass configuration options to constructors instead.
* Note: Node.js environment variable configuration continues to work as-is.
* feat(resource)!: Remove resource class export in favor of functions and types only to aid in cross-version compatibility [#5421](https://github.com/open-telemetry/opentelemetry-js/pull/5421)
* Renames `Resource` class to `ResourceImpl` and makes it package-private
* Renames `IResource` interface to `Resource`
* Export function `resourceFromAttributes` to create a `Resource` from a `DetectedAttributes` object
* Export function `defaultResource` to create a default resource [#5467](https://github.com/open-telemetry/opentelemetry-js/pull/5467) @pichlermarc
* Export function `emptyResource` to create an empty resource [#5467](https://github.com/open-telemetry/opentelemetry-js/pull/5467) @pichlermarc
* Only export types and functions. This aids in cross-version compatibility and makes it more easily extensible in the future.
* feat(resources)!: do not read environment variables from window in browsers [#5466](https://github.com/open-telemetry/opentelemetry-js/pull/5466) @pichlermarc
* (user-facing): all configuration previously possible via `window.OTEL_*` is now not supported anymore
* If you have been using the `envDetector` in browser environments, please migrate to manually creating a resource.
* Note: Node.js environment variable configuration continues to work as-is.
* fix(sdk-trace-base)!: use `ParentBasedAlwaysOnSampler` over `AlwaysOnSampler` when bogus data is supplied to `OTEL_TRACES_SAMPLER`
* this aligns the SDK implementation with the specification
* feat(core)!: drop `getEnv()`, `getEnvWithoutDefaults()` [#5481](https://github.com/open-telemetry/opentelemetry-js/pull/5481) @pichlermarc
* (user-facing): `getEnv()` has been replaced by `getStringFromEnv()`, `getNumberFromEnv()`, `getBooleanFromEnv()`, `getStringListFromEnv()`
* these new functions do not include defaults, please inline any defaults if necessary (example: `getStringFromEnv("OTEL_FOO") ?? "my-default"`)
* to find the previously used defaults, please see [here](https://github.com/open-telemetry/opentelemetry-js/blob/e9d3c71918635d490b6a9ac9f8259265b38394d0/packages/opentelemetry-core/src/utils/environment.ts#L154-L239)
* (user-facing): `getEnvWithoutDefaults()` has been replaced by `getStringFromEnv()`, `getNumberFromEnv()`, `getBooleanFromEnv()`, `getStringListFromEnv()`
* (user-facing): `DEFAULT_ENVIRONMENT` has been removed, please inline any defaults from now on
* to find the previously used defaults, please see [here](https://github.com/open-telemetry/opentelemetry-js/blob/e9d3c71918635d490b6a9ac9f8259265b38394d0/packages/opentelemetry-core/src/utils/environment.ts#L154-L239)
* (user-facing): `ENVIRONMENT` has been removed without replacement
* (user-facing): `RAW_ENVIRONMENT` has been removed without replacement
* (user-facing): `parseEnvironment` has been removed without replacement
* feat(sdk-trace-base): remove `BasicTracerProvider#register()` to improve tree-shaking [#5503](https://github.com/open-telemetry/opentelemetry-js/pull/5503) @pichlermarc
* (user-facing): `BasicTracerProvider#register()` has been removed
* to register a global propagator, please use `propagation.setGlobalPropagator()` from `@opentelemetry/api`
* to register a global context manager, please use `context.setGlobalContextManager()` from `@opentelemetry/api`
* feat!: set compilation target to ES2022 for all packages except `@opentelemetry/api`, `@opentelemetry/api-logs`, `@opentelemetry/api-events`, and `@opentelemetry/semantic-conventions` [#5456](https://github.com/open-telemetry/opentelemetry-js/pull/5456) @david-luna
* (user-facing): drops browser runtimes which do not support ES2022 features
* feat(core)! drop unused constants [#5504](https://github.com/open-telemetry/opentelemetry-js/pull/5504) @pichlermarc
* (user-facing): `DEFAULT_ATTRIBUTE_VALUE_LENTGHT_LIMIT` has been removed, please use `Infinity` instead
* (user-facing): `DEFAULT_ATTRIBUTE_VALUE_COUNT_LIMIT` has been removed, please use `128` instead
* (user-facing): `DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT` has been removed, please use `128` instead
* (user-facing): `DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT` has been removed, please use `128` instead
### :rocket: (Enhancement)
* feat(sdk-trace-web): do not throw when passing extra options [#5357](https://github.com/open-telemetry/opentelemetry-js/pull/5357) @pichlermarc
* `WebTracerProvider` constructor now does not throw anymore when `contextManager` or `propagator` are passed as extra options to the constructor
* fix(exporter-zipkin): remove usages of deprecated `url.parse` from `node:url` [#5390](https://github.com/open-telemetry/opentelemetry-js/pull/5390) @chancancode
* fix(sdk-metrics): do not export from `PeriodicExportingMetricReader` when there are no metrics to export. [#5288](https://github.com/open-telemetry/opentelemetry-js/pull/5288) @jacksonweber
* fix(sdk-trace-base): always wait on pending export in SimpleSpanProcessor. [#5303](https://github.com/open-telemetry/opentelemetry-js/pull/5303) @anuraaga
* fix(core): avoid using util in configuration.ts for browser compatibility [#5524](https://github.com/open-telemetry/opentelemetry-js/pull/5524) @sriraamas
### :house: (Internal)
* refactor(sdk-metrics): the internal `InstrumentDescriptor` type now extends `MetricDescriptor`; moved public `InstrumentType` type enum into `./src/export/MetricData.ts` [#5277](https://github.com/open-telemetry/opentelemetry-js/pull/5266)
* refactor(sdk-metrics): remove `Gauge` and `MetricAdvice` workaround types in favor of the upstream `@opentelemetry/api` types [#5254](https://github.com/open-telemetry/opentelemetry-js/pull/5254) @chancancode
* chore: remove checks for unsupported node versions [#4341](https://github.com/open-telemetry/opentelemetry-js/pull/4341) @dyladan
* feat(opentelemetry-instrumentation): replace `semver` package with internal semantic versioning check implementation to get rid of `semver` package initialization overhead especially in the AWS Lambda environment during coldstart [#5305](https://github.com/open-telemetry/opentelemetry-js/pull/5305) @serkan-ozal
* chore: unpin `@opentelemetry/semantic-conventions` dep to allow better de-duplication in installs [#5439](https://github.com/open-telemetry/opentelemetry-js/pull/5439) @trentm
## 1.30.0
### :rocket: (Enhancement)
* feat(sdk-metrics): PeriodicExportingMetricReader now flushes pending tasks at shutdown [#5242](https://github.com/open-telemetry/opentelemetry-js/pull/5242)
### :bug: (Bug Fix)
* fix(sdk-trace-base): do not load OTEL_ env vars on module load, but when needed [#5233](https://github.com/open-telemetry/opentelemetry-js/pull/5233)
* fix(instrumentation-xhr, instrumentation-fetch): content length attributes no longer get removed with `ignoreNetworkEvents: true` being set [#5229](https://github.com/open-telemetry/opentelemetry-js/issues/5229)
## 1.29.0
### :rocket: (Enhancement)
* feat(sdk-metrics): Add support for aggregation cardinality limit with a default limit of 2000. This limit can be customized via views [#5128](https://github.com/open-telemetry/opentelemetry-js/pull/5128)
## 1.28.0
### :rocket: (Enhancement)
* feat(sdk-metrics, sdk-trace): add `mergeResourceWithDefaults` flag, which allows opting-out of resources getting merged with the default resource [#4617](https://github.com/open-telemetry/opentelemetry-js/pull/4617)
* default: `true` (no change in behavior)
* note: `false` will become the default behavior in the next major version in order to comply with [specification requirements](https://github.com/open-telemetry/opentelemetry-specification/blob/f3511a5ccda376dfd1de76dfa086fc9b35b54757/specification/resource/sdk.md?plain=1#L31-L36)
* feat(sdk-trace-base): add `spanProcessors` property in `TracerConfig` interface. [#5138](https://github.com/open-telemetry/opentelemetry-js/pull/5138) @david-luna
### :bug: (Bug Fix)
* fix(sdk-metrics): await exports in `PeriodicExportingMetricReader` when async resource attributes have not yet settled [#5119](https://github.com/open-telemetry/opentelemetry-js/pull/5119/) @pichlermarc
* fix(sdk-trace): performance.now() may return the same value for consecutive calls [#5150](https://github.com/open-telemetry/opentelemetry-js/pull/5150) @dyladan
* fix(sdk-trace-base): pass BatchSpanProcessor#forceFlush() errors on visibilitychange/pagehide to globalErrorHandler [#5143](https://github.com/open-telemetry/opentelemetry-js/pull/5143) @pichlermarc
* fixes a bug where switching browser tabs with a failing exporter would cause an unhandled error
## 1.27.0
### :rocket: (Enhancement)
* feat: add processors for adding session.id attribute to spans and logs [#4972](https://github.com/open-telemetry/opentelemetry-js/pull/4972)
### :bug: (Bug Fix)
* fix(sdk-trace-base): avoid keeping non-string `status.message` on `Span#setStatus()` [#4999](https://github.com/open-telemetry/opentelemetry-js/pull/4999) @pichlermarc
* fix(sdk-metrics): Add missing catch and handle error in promise of `PeriodicExportingMetricReader` [#5006](https://github.com/open-telemetry/opentelemetry-js/pull/5006) @jj22ee
* fix(opentelemetry-core): confusing log extract of composite propagator [#5017](https://github.com/open-telemetry/opentelemetry-js/pull/5017) @rv2673
* fix(propagator-aws-xray-*): move propagators back to contrib repository [#4966](https://github.com/open-telemetry/opentelemetry-js/pull/4966) @pichlermarc
* The [specification](https://github.com/open-telemetry/opentelemetry-specification/blob/6672dbc97ddeb34f36c020a0f0a30323c8bc4d95/specification/context/api-propagators.md?plain=1#L354-L356) prohibits hosting these packages in the core repository
* `@opentelemetry/propagator-aws-xray` is now located in [open-telemetry/opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib)
* `@opentelemetry/propagator-aws-xray-lambda` is now located in [open-telemetry/opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib)
* refactor(sdk-metrics): replace `MetricsAttributes` with `Attributes` [#5021](https://github.com/open-telemetry/opentelemetry-js/pull/5021) @david-luna
* refactor(instrumentation-http): replace `SpanAttributes` and `MetricsAttributes` with `Attributes` [#5023](https://github.com/open-telemetry/opentelemetry-js/pull/5023) @david-luna
* chore(exporter-zipkin): remove usages of Span constructor [#5030](https://github.com/open-telemetry/opentelemetry-js/pull/5030) @david-luna
* test(instrumentation-http): remove usages of `new Span` in tests [#5035](https://github.com/open-telemetry/opentelemetry-js/pull/5035) @david-luna
## 1.26.0
### :rocket: (Enhancement)
* feat: include instrumentation scope info in console span and log record exporters [#4848](https://github.com/open-telemetry/opentelemetry-js/pull/4848) @blumamir
* Exported names have changed to `ATTR_{name}` for attributes (e.g. `ATTR_HTTP_REQUEST_METHOD`), `{name}_VALUE_{value}` for enumeration values (e.g. `HTTP_REQUEST_METHOD_VALUE_POST`), and `METRIC_{name}` for metrics. Exported names from previous versions are deprecated.
* Import `@opentelemetry/semantic-conventions` for *stable* semantic conventions. Import `@opentelemetry/semantic-conventions/incubating` for all semantic conventions, stable and unstable.
* Note: Semantic conventions are now versioned separately from other stable artifacts, to correspond to the version of semantic conventions they provide. Changes will be in a separate changelog.
* refactor(examples): added usage of @opentelemetry/semantic-conventions and @opentelemetry/resources to the examples in examples/opentelemetry-web for maintaining consistency across all examples. [#4764](https://github.com/open-telemetry/opentelemetry-js/pull/4764) @Zen-cronic
### :house: (Internal)
* refactor(context-zone-peer-dep): use explicit exports [#4785](https://github.com/open-telemetry/opentelemetry-js/pull/4787) @pichlermarc
* refactor(context-async-hooks): use explicit exports [#4785](https://github.com/open-telemetry/opentelemetry-js/pull/4786) @pichlermarc
## 1.25.0
### :rocket: (Enhancement)
* feat: support node 22 [#4666](https://github.com/open-telemetry/opentelemetry-js/pull/4666) @dyladan
* feat(context-zone*): support zone.js 0.12.x [#4376](https://github.com/open-telemetry/opentelemetry-js/pull/4736) @maldago
* refactor(core): Use tree-shakeable string constants for semconv [#4739](https://github.com/open-telemetry/opentelemetry-js/pull/4739) @JohannesHuster
* refactor(shim-opentracing): Use tree-shakeable string constants for semconv [#4746](https://github.com/open-telemetry/opentelemetry-js/pull/4746) @JohannesHuster
* refactor(sdk-trace-web): Use tree-shakeable string constants for semconv [#4747](https://github.com/open-telemetry/opentelemetry-js/pull/4747) @JohannesHuster
* refactor(sdk-trace-node): Use tree-shakeable string constants for semconv [#4748](https://github.com/open-telemetry/opentelemetry-js/pull/4748) @JohannesHuster
* refactor(sdk-trace-base): Use tree-shakeable string constants for semconv [#4749](https://github.com/open-telemetry/opentelemetry-js/pull/4749) @JohannesHuster
* refactor(resources): update deprecated semconv to use exported strings [#4755](https://github.com/open-telemetry/opentelemetry-js/pull/#4755) @JamieDanielson
* refactor(exporters): update deprecated semconv to use exported strings [#4756](https://github.com/open-telemetry/opentelemetry-js/pull/#4756) @JamieDanielson
### :books: (Refine Doc)
* refactor(examples): use new exported string constants for semconv in examples/esm-http-ts [#4758](https://github.com/open-telemetry/opentelemetry-js/pull/4758) @Zen-cronic
* refactor(examples): use new exported string constants for semconv in examples/basic-tracer-node [#4759](https://github.com/open-telemetry/opentelemetry-js/pull/4759#pull) @Zen-cronic
* refactor(examples): use new exported string constants for semconv in examples/http [#4750](https://github.com/open-telemetry/opentelemetry-js/pull/4750) @Zen-cronic
* refactor(examples): use new exported string constants for semconv in examples/grpc-js [#4760](https://github.com/open-telemetry/opentelemetry-js/pull/4760#pull) @Zen-cronic
* refactor(examples): use new exported string constants for semconv in examples/otlp-exporter-node [#4762](https://github.com/open-telemetry/opentelemetry-js/pull/4762) @Zen-cronic
* refactor(examples): use new exported string constants for semconv in examples/opentracing-shim [#4761](https://github.com/open-telemetry/opentelemetry-js/pull/4761) @Zen-cronic
## 1.24.1
### :bug: (Bug Fix)
* fix(core): align inconsistent behavior of `getEnv()` and `getEnvWithoutDefaults()` when a `process` polyfill is used [#4648](https://github.com/open-telemetry/opentelemetry-js/pull/4648) @pichlermarc
* `getEnvWithoutDefaults()` would use `process.env` if it was defined when running in a browser, while `getEnv()` would always use `_globalThis`. Now both use `_globalThis` when running in a browser.
* fixes a circular import warning which would appear in rollup when bundling `@opentelemetry/resources`
* fix(exporter-metrics-otlp-grpc): add explicit otlp-exporter-base dependency to exporter-metrics-otlp-grpc [#4678](https://github.com/open-telemetry/opentelemetry-js/pull/4678) @AkselAllas
* fix(resources) wait for async attributes for detecting resources [#4687](https://github.com/open-telemetry/opentelemetry-js/pull/4687) @ziolekjj
## 1.24.0
### :rocket: (Enhancement)
* feat(sdk-trace-base): log resource attributes in ConsoleSpanExporter [#4605](https://github.com/open-telemetry/opentelemetry-js/pull/4605) @pichlermarc
* feat(propagator-aws-xray): moved AWS Xray propagator from contrib [4603](https://github.com/open-telemetry/opentelemetry-js/pull/4603) @martinkuba
* feat(resources): new experimental detector ServiceInstanceIdDetectorSync that sets the value for `service.instance.id` as random UUID. [#4608](https://github.com/open-telemetry/opentelemetry-js/pull/4608) @maryliag
### :bug: (Bug Fix)
* fix(sdk-trace-web): fix invalid timings in span events [#4486](https://github.com/open-telemetry/opentelemetry-js/pull/4486) @Abinet18
* fix(resources): ensure BrowserDetector does not think Node.js v21 is a browser [#4561](https://github.com/open-telemetry/opentelemetry-js/issues/4561) @trentm
* fix(core): align inconsistent behavior of `getEnv()` and `getEnvWithoutDefaults()` when a `process` polyfill is used [#4648](https://github.com/open-telemetry/opentelemetry-js/pull/4648) @pichlermarc
* `getEnvWithoutDefaults()` would use `process.env` if it was defined when running in a browser, while `getEnv()` would always use `_globalThis`. Now both use `_globalThis` when running in a browser.
## 1.23.0
### :rocket: (Enhancement)
* perf(sdk-trace-base): do not allocate arrays if resource has no pending async attributes [#4576](https://github.com/open-telemetry/opentelemetry-js/pull/4576) @Samuron
* feat(sdk-metrics): added experimental synchronous gauge to SDK [#4565](https://github.com/open-telemetry/opentelemetry-js/pull/4565) @clintonb
* this change will become user-facing in an upcoming release
### :bug: (Bug Fix)
* fix(sdk-metrics): increase the depth of the output to the console such that objects in the metric are printed fully to the console [#4522](https://github.com/open-telemetry/opentelemetry-js/pull/4522) @JacksonWeber
## 1.22.0
### :rocket: (Enhancement)
* feat(sdk-metrics): allow single bucket histograms [#4456](https://github.com/open-telemetry/opentelemetry-js/pull/4456) @pichlermarc
* feat(instrumentation): Make `init()` method public [#4418](https://github.com/open-telemetry/opentelemetry-js/pull/4418)
* feat(context-zone-peer-dep, context-zone): support zone.js 0.13.x, 0.14.x [#4469](https://github.com/open-telemetry/opentelemetry-js/pull/4469) @pichlermarc
* deprecates `MeterProvider.addMetricReader()` please use the constructor option `readers` instead.
### :bug: (Bug Fix)
* fix(sdk-trace-base): ensure attribute value length limit is enforced on span creation [#4417](https://github.com/open-telemetry/opentelemetry-js/pull/4417) @pichlermarc
* fix(sdk-trace-base): Export processed spans while exporter failed [#4287](https://github.com/open-telemetry/opentelemetry-js/pull/4287) @Zirak
### :house: (Internal)
* chore(opentelemetry-context-zone-peer-dep): support zone.js ^v0.13.0 [#4320](https://github.com/open-telemetry/opentelemetry-js/pull/4320)
* refactor(core): drop unnecessary assignment of HOSTNAME [#4421](https://github.com/open-telemetry/opentelemetry-js/pull/4421) @pichlermarc
* test(opentelemetry-context-zone-peer-dep): transpile zone.js in tests [#4423](https://github.com/open-telemetry/opentelemetry-js/pull/4423) @legendecas
* Switched to npm workspaces to bootstrap dependencies.
## 1.17.1
### :bug: (Bug Fix)
* fix(sdk-trace-base): BatchSpanProcessor flushes when `maxExportBatchSize` is reached [#3958](https://github.com/open-telemetry/opentelemetry-js/pull/3958) @nordfjord
* fix(sdk-metrics): allow instrument names to contain '/' [#4155](https://github.com/open-telemetry/opentelemetry-js/pull/4155)
* fix(sdk-metrics): prevent per-reader storages from keeping unreported accumulations in memory [#4163](https://github.com/open-telemetry/opentelemetry-js/pull/4163) @pichlermarc
* fixes a memory leak which occurred when two or more `MetricReader` instances are registered to a `MeterProvider`
* fix(sdk-metrics): do not report empty scopes and metrics [#4135](https://github.com/open-telemetry/opentelemetry-js/pull/4135) @pichlermarc
* Instruments that were created, but did not have measurements will not be exported anymore
* Meters (Scopes) that were created, but did not have any instruments with measurements under them will not be exported anymore.
* fix(exporter-zipkin): round duration to the nearest int in annotations to be compliant with zipkin protocol [#4167](https://github.com/open-telemetry/opentelemetry-js/pull/4167) @FelipeEmerim
### :books: (Refine Doc)
* docs(contributing): added guidelines for adding benchmark tests [#4169](https://github.com/open-telemetry/opentelemetry-js/pull/4169)
### :house: (Internal)
* test: added a performance benchmark test for span creation [#4105](https://github.com/open-telemetry/opentelemetry-js/pull/4105)
* test: added a workflow to run performance benchmark tests automatically [#4144](https://github.com/open-telemetry/opentelemetry-js/pull/4144)
## 1.17.0
### :bug: (Bug Fix)
* Revert "feat(api): add attributes argument to recordException API [#4071](https://github.com/open-telemetry/opentelemetry-js/pull/4071)"
* This feature was an unintentional breaking change introduced with API 1.5.0
* This PR updates all SDK packages to allow API 1.6.0, where this change has been reverted.
* feat: update PeriodicExportingMetricReader and PrometheusExporter to accept optional metric producers [#4077](https://github.com/open-telemetry/opentelemetry-js/pull/4077) @aabmass
### :bug: (Bug Fix)
* fix(exporter-zipkin): rounding duration to the nearest int to be compliant with zipkin protocol [#4064](https://github.com/open-telemetry/opentelemetry-js/pull/4064) @n0cloud
* fix(sdk-metrics): metric names should be case-insensitive
* fix(core): stop rounding to nearest int in hrTimeTo*seconds() functions [#4014](https://github.com/open-telemetry/opentelemetry-js/pull/4014/) @aabmass
* fix(core): add baggage support for values containing an equals sign [#3975](https://github.com/open-telemetry/opentelemetry-js/pull/3975) @krosenk729
## 1.15.1
### :bug: (Bug Fix)
* Revert "feat(minification): Add noEmitHelpers, importHelpers and tslib as a dependency (#3914)"
* fix(opentelemetry-exporter-prometheus): Update default PrometheusExporter to not append a timestamp to match the text based exposition format [#3961](https://github.com/open-telemetry/opentelemetry-js/pull/3961) @JacksonWeber
* fix(sdk-metrics): Update default Histogram's boundary to match OTEL's spec [#3893](https://github.com/open-telemetry/opentelemetry-js/pull/3893/) @chigia001
* fix(sdk-metrics): preserve startTime for cumulative ExponentialHistograms [#3934](https://github.com/open-telemetry/opentelemetry-js/pull/3934/) @aabmass
* fix(sdk-trace-web): add secureConnectionStart to https only [#3879](https://github.com/open-telemetry/opentelemetry-js/pull/3879) @Abinet18
### :house: (Internal)
* feat(minification): [Minification] Add noEmitHelpers, importHelpers and tslib as a dependency [#3913](https://github.com/open-telemetry/opentelemetry-js/issues/3913) @MSNev
## 1.14.0
### :rocket: (Enhancement)
* feat(SpanExporter): Add optional forceFlush to SpanExporter interface [#3753](https://github.com/open-telemetry/opentelemetry-js/pull/3753/) @sgracias1@JacksonWeber
* fix(http-instrumentation): stop listening to `request`'s `close` event once it has emitted `response` [#3625](https://github.com/open-telemetry/opentelemetry-js/pull/3625) @SimenB
* fix(sdk-node): fix initialization in bundled environments by not loading @opentelemetry/exporter-jaeger [#3739](https://github.com/open-telemetry/opentelemetry-js/pull/3739) @pichlermarc
## 1.12.0
### :rocket: (Enhancement)
* feat(tracing): log span name and IDs when span end is called multiple times [#3716](https://github.com/open-telemetry/opentelemetry-js/pull/3716)
* fix(instrumentation-http): fixed description for http.server.duration metric [#3710](https://github.com/open-telemetry/opentelemetry-js/pull/3710)
* fix(opentelemetry-sdk-trace-web): don't crash in runtimes where location isn't defined [#3715](https://github.com/open-telemetry/opentelemetry-js/pull/3715)
## 1.11.0
### :rocket: (Enhancement)
* feat(sdk-metrics): add exponential histogram support [#3505](https://github.com/open-telemetry/opentelemetry-js/pull/3505), [#3506](https://github.com/open-telemetry/opentelemetry-js/pull/3506) @mwear
* feat(resources): collect additional process attributes [#3605](https://github.com/open-telemetry/opentelemetry-js/pull/3605) @mwear
* fix(sdk-trace-web): make `parseUrl()` respect document.baseURI [#3670](https://github.com/open-telemetry/opentelemetry-js/pull/3670) @domasx2
### :books: (Refine Doc)
* doc(sdk): update NodeSDK example [#3684](https://github.com/open-telemetry/opentelemetry-js/pull/3684) @martinkuba
* docs: change vmarchaud status from maintainer to emeritus [#3710](https://github.com/open-telemetry/opentelemetry-js/pull/3710) @vmarchaud
* docs: change rauno56 status from maintainer to emeritus [#3706](https://github.com/open-telemetry/opentelemetry-js/pull/3706) @rauno56
## 1.10.1
### :bug: (Bug Fix)
* fix(resource): make properties for async resource resolution optional [#3677](https://github.com/open-telemetry/opentelemetry-js/pull/3677) @pichlermarc
* fix(resource): change fs/promises import to be node 12 compatible [#3681](https://github.com/open-telemetry/opentelemetry-js/pull/3681) @pichlermarc
## 1.10.0
### :rocket: (Enhancement)
* feat(resource): create sync resource with some attributes that resolve asynchronously [#3460](https://github.com/open-telemetry/opentelemetry-js/pull/3460) @samimusallam
* feat: collect host id for non-cloud environments [#3575](https://github.com/open-telemetry/opentelemetry-js/pull/3575) @mwear
* feat (api-logs): separate Events API into its own package [3550](https://github.com/open-telemetry/opentelemetry-js/pull/3550) @martinkuba
* feat(sdk-metrics): apply binary search in histogram recording [#3539](https://github.com/open-telemetry/opentelemetry-js/pull/3539) @legendecas
* feat: support TraceState in SamplingResult [#3530](https://github.com/open-telemetry/opentelemetry-js/pull/3530) @raphael-theriault-swi
* feat(sdk-trace-base): add diagnostic logging when spans are dropped [#3610](https://github.com/open-telemetry/opentelemetry-js/pull/3610) @neoeinstein
* feat: add unit to view instrument selection criteria [#3647](https://github.com/open-telemetry/opentelemetry-js/pull/3647) @jlabatut
* feat(tracing): expose dropped counts for attributes, events and links on span [#3576](https://github.com/open-telemetry/opentelemetry-js/pull/3576) @mohitk05
### :bug: (Bug Fix)
* fix(core): added falsy check to make otel core work with browser where webpack config had process as false or null [#3613](https://github.com/open-telemetry/opentelemetry-js/issues/3613) @ravindra-dyte
* fix(instrumentation-http): include query params in http.target [#3646](https://github.com/open-telemetry/opentelemetry-js/pull/3646) @kobi-co
### :books: (Refine Doc)
* chore: update http example [#3651](https://github.com/open-telemetry/opentelemetry-js/pull/3651) @JamieDanielson
* fix(sdk-metrics): fix flaky LastValueAggregator test by using fake timer [#3587](https://github.com/open-telemetry/opentelemetry-js/pull/3587) @pichlermarc
* feat(instrumentation-grpc): set net.peer.name and net.peer.port on client spans [#3430](https://github.com/open-telemetry/opentelemetry-js/pull/3430)
* feat(exporter-trace-otlp-proto): Add protobuf otlp trace exporter support for browser [#3208](https://github.com/open-telemetry/opentelemetry-js/pull/3208) @pkanal
### :bug: (Bug Fix)
* fix(sdk-metrics): use default Resource to comply with semantic conventions [#3411](https://github.com/open-telemetry/opentelemetry-js/pull/3411) @pichlermarc
* Metrics exported by the SDK now contain the following resource attributes by default:
* `service.name`
* `telemetry.sdk.name`
* `telemetry.sdk.language`
* `telemetry.sdk.version`
* fix(sdk-metrics): use Date.now() for instrument recording timestamps [#3514](https://github.com/open-telemetry/opentelemetry-js/pull/3514) @MisterSquishy
* fix(sdk-trace): make spans resilient to clock drift [#3434](https://github.com/open-telemetry/opentelemetry-js/pull/3434) @dyladan
* fix(selenium-tests): updated webpack version for selenium test issue [#3456](https://github.com/open-telemetry/opentelemetry-js/issues/3456) @SaumyaBhushan
* chore: enforce format with prettier [#3444](https://github.com/open-telemetry/opentelemetry-js/pull/3444) @legendecas
## 1.8.0
* `@opentelemetry/sdk-metrics` has been promoted to stable
* `@opentelemetry/api-metrics` has been merged into `@opentelemetry/api` and deprecated
### :boom: Breaking Change
* feat(api): merge api-metrics into api [#3374](https://github.com/open-telemetry/opentelemetry-js/pull/3374) @legendecas
### :rocket: (Enhancement)
* feat(sdk-trace): re-export sdk-trace-base in sdk-trace-node and web [#3319](https://github.com/open-telemetry/opentelemetry-js/pull/3319) @legendecas
* feat: enable tree shaking [#3329](https://github.com/open-telemetry/opentelemetry-js/pull/3329) @pkanal
* chore: update trace-web example and rename it to opentelemetry-web [#3145](https://github.com/open-telemetry/opentelemetry-js/pull/3145) @pichlermarc
* chore: update https example [#3152](https://github.com/open-telemetry/opentelemetry-js/pull/3152) @pichlermarc
## 1.5.0
### :rocket: (Enhancement)
* feat(sdk-trace-base): Improve extensibility of BasicTracerProvider [#3023](https://github.com/open-telemetry/opentelemetry-js/pull/3023) @Rauno56
## 1.4.0
### :rocket: (Enhancement)
* fix(resources): fix browser compatibility for host and os detectors [#3004](https://github.com/open-telemetry/opentelemetry-js/pull/3004) @legendecas
* fix(sdk-trace-base): fix crash on environments without global document [#3000](https://github.com/open-telemetry/opentelemetry-js/pull/3000) @legendecas
* fix(resources): fix browser compatibility for host and os detectors [#3004](https://github.com/open-telemetry/opentelemetry-js/pull/3004) @legendecas
* fix: support earlier API versions [#2892](https://github.com/open-telemetry/opentelemetry-js/pull/2892) @dyladan
* fix: support extract one digit '0' in jaeger traceFlag [#2905](https://github.com/open-telemetry/opentelemetry-js/issues/2905) @shmilyoo
* fix(resources): extend ResourceAttributes interface to comply with spec [#2924](https://github.com/open-telemetry/opentelemetry-js/pull/2924) @blumamir
### :books: (Refine Doc)
* docs(sdk): update earliest support node version [#2860](https://github.com/open-telemetry/opentelemetry-js/pull/2860) @svetlanabrennan
### :house: (Internal)
* chore: require changelog entry to merge PR [#2847](https://github.com/open-telemetry/opentelemetry-js/pull/2847) @dyladan
* chore: remove peer API check [#2892](https://github.com/open-telemetry/opentelemetry-js/pull/2892) @dyladan
* chore: merge lerna subdirectories into a single monorepo [#2892](https://github.com/open-telemetry/opentelemetry-js/pull/2892) @dyladan
* chore: indent the code with eslint [#2923](https://github.com/open-telemetry/opentelemetry-js/pull/2923) @blumamir
* `opentelemetry-propagator-jaeger`
* [#2906](https://github.com/open-telemetry/opentelemetry-js/pull/2906) fix: support extract one digit '0' in jaeger traceFlag ([@shmilyoo](https://github.com/shmilyoo))
### This is a first official beta release, which provides almost fully complete metrics, tracing, and context propagation functionality but makes no promises around breaking changes
### First official beta release
* provides almost fully complete metrics, tracing, and context propagation functionality but makes **no promises** around breaking changes
Most pull requests MAY be merged by an approver OR a maintainer provided they meet the following [General Merge Requirements](#general-merge-requirements).
All requirements are at the discretion of the maintainers.
Maintainers MAY merge pull requests which have not strictly met these requirements.
Maintainers MAY close, block, or put on hold pull requests even if they have strictly met these requirements.
It is generally expected that a maintainer ([@open-telemetry/javascript-maintainers](https://github.com/orgs/open-telemetry/teams/javascript-maintainers)) should review and merge major changes.
Some examples include, but are not limited to:
- API changes
- Breaking changes
- New modules
- Changes which affect runtime support
- New features which are not required by the specification
If a PR has not been interacted with by a reviewer within one week, please ping the approvers ([@open-telemetry/javascript-approvers](https://github.com/orgs/open-telemetry/teams/javascript-approvers)).
### General Merge Requirements
- No “changes requested” reviews by approvers, maintainers, technical committee members, or subject matter experts
- No unresolved conversations
- Approved by at least one maintainer OR by at least one approver who is not the approver merging the pull request
- A pull request for small (simple typo, URL, update docs, or grammatical fix) changes may be approved and merged by the same approver
- For plugins, exporters, and propagators approval of the original code module author, or a contributor who has done extensive work on the module, is preferred but not required
- New or changed functionality is tested by unit tests
- New or changed functionality is documented if appropriate
- Substantial changes should not be merged within 24 hours of opening in order to allow reviewers from all time zones to have a chance to review
If all of the above requirements are met and there are no unresolved discussions, a pull request may be merged by either a maintainer or an approver.
## Report a bug or requesting feature
Reporting bugs is an important contribution. Please make sure to include:
@ -29,21 +79,41 @@ Reporting bugs is an important contribution. Please make sure to include:
The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages. You can see examples [here](https://www.conventionalcommits.org/en/v1.0.0-beta.4/#examples).
We use [commitlint](https://github.com/conventional-changelog/commitlint) and [husky](https://github.com/typicode/husky) to prevent bad commit message.
For example, you want to submit the following commit message `git commit -s -am "my bad commit"`.
You will receive the following error :
```text
✖ type must be one of [ci, feat, fix, docs, style, refactor, perf, test, revert, chore] [type-enum]
It is recommended to have your commit messages follow the Conventional Commits specification, with possible types listed in [.commitlint.rc.yml](.commitlintrc.yml). Here an example that uses the recommended format: `git commit -s -am "chore(opentelemetry-core): update deps"`
### Changelog
An entry into `CHANGELOG.md` or `experimental/CHANGELOG.md` is required for the following reasons:
- Changes made to the behaviour of the component
- Changes to the configuration
- Changes to default settings
- New components being added
It is reasonable to omit an entry to the changelog under these circumstances:
- Updating test to remove flakiness or improve coverage
- Updates to the CI/CD process
If there is some uncertainty with regards to if a changelog entry is needed, the recommendation is to create an entry to in the event that the change is important to the project consumers.
If a change does not require a changelog entry, the label `"Skip Changelog"` may be applied.
Pull requests with the `dependencies` label will be skipped by the changelog CI check.
If the change affects the overall project and not any individual package, it should usually go in the main changelog.
Changelog entries should be in the following format:
```md
* feat(subject): pull request title here #{pull request number} @{author github handle}
```
Here an example that will pass the verification: `git commit -s -am "chore(opentelemetry-core): update deps"`
Subject should describe the area of the project that was changed as descriptively as is possible in a short space.
For example, this may be the package name if a single package was updated or just `metrics` if both the metrics API and SDK are affected.
### Fork
@ -68,7 +138,7 @@ git merge upstream/main
Remember to always work in a branch of your local copy, as you might otherwise have to contend with conflicts in main.
Please also see [GitHub workflow](https://github.com/open-telemetry/community/blob/master/CONTRIBUTING.md#github-workflow) section of general project contributing guide.
Please also see [GitHub workflow](https://github.com/open-telemetry/community/blob/main/guides/contributor/processes.md#github-workflow) section of general project contributing guide.
## Development
@ -78,17 +148,16 @@ Please also see [GitHub workflow](https://github.com/open-telemetry/community/bl
- [TypeScript](https://www.typescriptlang.org/)
- [lerna](https://github.com/lerna/lerna) to manage dependencies, compilations, and links between packages. Most lerna commands should be run by calling the provided npm scripts.
- [MochaJS](https://mochajs.org/) for tests
- [gts](https://github.com/google/gts)
- [eslint](https://eslint.org/)
Most of the commands needed for development are accessed as [npm scripts](https://docs.npmjs.com/cli/v6/using-npm/scripts). It is recommended that you use the provided npm scripts instead of using `lerna run` in most cases.
### Install dependencies
This will install all dependencies for the root project and all modules managed by `lerna`. By default, a `postinstall` script will run `lerna bootstrap` automatically after an install. This can be avoided using the `--ignore-scripts` option if desired.
This will install all dependencies for the root project and all modules managed by `npm workspaces`.
```sh
npm install
npm ci
```
### Compile modules
@ -127,6 +196,15 @@ cd packages/opentelemetry-module-name
npm run watch
```
#### TypeScript version & update policy
TypeScript version used to compile the pacakges is `v5.0.4`. If you plan to use any of the packages from this
repository to make your own application or package instrumentation make sure to use same version or higher.
As update policy OpenTelemetry JS will follow DefinitelyType's [support policy for TypeScript](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window)
which sets a support window of 2 years.
### Running tests
Similar to compilations, tests can be run from the root to run all tests or from a single module to run only the tests for that module.
@ -140,9 +218,26 @@ cd packages/opentelemetry-module-name
npm test
```
To run the unit tests continuously in watch mode while developing, use:
```sh
# Run test in watch mode
npm run tdd
```
Packages that are expected to run in the browser have browser specific tests:
```sh
# Run browser-specific test
npm run test:browser
# Run web worker test
npm run test:webworker
```
### Linting
This project uses a combination of `gts` and `eslint`. Just like tests and compilation, linting can be done for all packages or only a single package.
This project uses `eslint` to lint source code. Just like tests and compilation, linting can be done for all packages or only a single package.
```sh
# Lint all modules
@ -164,46 +259,66 @@ cd packages/opentelemetry-module-name
npm run lint:fix
```
The default lint command will check majority of files, including Markdown files (such as README.md files), but you
also have the option to check just the Markdown files with:
```sh
npm run lint:markdown
npm run lint:markdown:fix # can automatically fix some Markdown rules
```
The default command doesn't check the examples folder. To lint just the examples, use the script:
```sh
npm run lint:examples
npm run lint:examples:fix # can automatically fix some errors
```
### Generating docs
We use [typedoc](https://www.npmjs.com/package/typedoc) to generate the api documentation.
To generate the docs, use:
```sh
# Generate docs in the root 'docs' directory
npm run docs
```
The document will be available under `docs` path.
### Adding a package
To add a new package, copy `packages/template` to your new package directory and modify the `package.json` file to reflect your desired package settings. If the package will not support browser, the `karma.conf` and `tsconifg.esm.json` files may be deleted. If the package will support es5 targets, the reference to `tsconfig.base.json` in `tsconfig.json` should be changed to `tsconfig.es5.json`.
After adding the package, run `npm install` from the root of the project. This will update the `tsconfig.json` project references automatically and install all dependencies in your new package. For packages supporting browser, file `tsconfig.esm.json` needs to be manually updated to include reference to ES modules build.
### Guidelines for Pull Requests
### Platform conditional exports
- Typically we try to turn around reviews within one to two business days.
- It is generally expected that a maintainer ([@open-telemetry/javascript-maintainers](https://github.com/orgs/open-telemetry/teams/javascript-maintainers)) should review and merge every PR.
- If a change has met the requirements listed below, an approver may also merge the pull request.
- Most PRs should be merged in one to two weeks.
- If a PR is taking longer than 30 days, please ping the approvers ([@open-telemetry/javascript-approvers](https://github.com/orgs/open-telemetry/teams/javascript-approvers)) as it may have been lost
- Dependency upgrades and Security fixes: This PR is small and/or low-risk and can be merged with only maintainer reviews.
- If your patch is not getting reviewed or you need a specific person to review it, you can @username or @open-telemetry/javascript-approvers a reviewer asking for a review in the pull request.
- API changes, breaking changes, or large changes will be subject to more scrutiny and may require more reviewers. These PRs should only be merged by maintainers.
- Changes to existing plugins and exporters will typically require the approval of the original plugin/exporter author.
Universal packages are packages that can be used in both web browsers and
Node.js environment. These packages may be implemented on top of different
platform APIs to achieve the same goal. Like accessing the _global_ reference,
we have different preferred ways to do it:
### General Merge Requirements
- In Node.js, we access the _global_ reference with `globalThis` or `global`:
- All requirements are at the discretion of the maintainers.
- Maintainers may merge pull requests which have not strictly met these requirements.
- Maintainers may close, block, or put on hold pull requests even if they have strictly met these requirements.
- No “changes requested” reviews.
- No unresolved conversations.
- 3 approvals, including the approvals of at least 2 maintainers
- A pull request opened by an approver may be merged with only the 2 maintainer reviews.
- Small (simple typo, URL, update docs, or grammatical fix) or high-priority changes may be merged more quickly or with fewer reviewers at the discretion of the maintainers. This is typically indicated with the express label.
- For plugins, exporters, and propagators approval of the original code module author is preferred but not required.
- New or changed functionality is tested by unit tests.
- New or changed functionality is documented.
- Substantial changes should not be merged within 24 hours of opening in order to allow reviewers from all time zones to have a chance to review.
- `npm run docs` to generate API documentation. Generates the documentation in `packages/opentelemetry-api/docs/out`
### Generating CHANGELOG documentation
- Generate and export your [Github access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token): `export GITHUB_AUTH=<your_token>`
- `npm run changelog` to generate CHANGELOG documentation in your terminal (see [RELEASING.md](RELEASING.md) for more details).
Even though the implementation may differ, the exported names must be aligned.
It can be confusing if exported names present in one environment but not in the
**Much of OpenTelemetry JS documentation is written assuming the compiled application is run as CommonJS.**
For more details on ECMAScript Modules vs CommonJS, refer to [esm-support](https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/esm-support.md).
## Versioning
The following describes how to set up tracing for a basic web application.
For more detailed documentation, see the website at <https://opentelemetry.io/docs/instrumentation/js/>.
The current version for each package can be found in the respective `package.json` file for that module. For additional details see the [versioning and stability][spec-versioning] document in the specification.
### Installation
## Quick start
### Application Owner
#### Install Dependencies
Dependencies with the `latest` tag on NPM should be compatible with each other.
See the [version compatibility matrix](#package-version-compatibility) below for more information.
**Note:** `auto-instrumentations-node` is a meta package from [opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/metapackages/auto-instrumentations-node) that provides a simple way to initialize multiple Node.js instrumentations.
#### Instantiate Tracing
### Set up Tracing
```js
// tracing.js
@ -95,15 +71,15 @@ const process = require('process');
The above example will emit auto-instrumented telemetry about your Node.js application to the console. For a more in-depth example, see the [Getting Started Guide](https://opentelemetry.io/docs/js/getting-started/). For more information about automatic instrumentation see [@opentelemetry/sdk-trace-node][otel-node], which provides auto-instrumentation for Node.js applications. If the automatic instrumentation does not suit your needs, or you would like to create manual traces, see [@opentelemetry/sdk-trace-base][otel-tracing]
The above example will emit auto-instrumented telemetry about your Node.js application to the console. For a more in-depth example, see the [Getting Started Guide](https://opentelemetry.io/docs/languages/js/getting-started/). For more information about automatic instrumentation see [@opentelemetry/sdk-trace-node][otel-node], which provides auto-instrumentation for Node.js applications. If the automatic instrumentation does not suit your needs, or you would like to create manual traces, see [@opentelemetry/sdk-trace-base][otel-tracing]
### Library Author
## Library Author
If you are a library author looking to build OpenTelemetry into your library, please see [the documentation][docs]. As a library author, it is important that you only depend on properties and methods published on the public API. If you use any properties or methods from the SDK that are not officially a part of the public API, your library may break if an [Application Owner](#application-owner) uses a different SDK implementation.
If you are a library author looking to build OpenTelemetry into your library, please see [the documentation][docs]. As a library author, it is important that you only depend on properties and methods published on the public API. If you use any properties or methods from the SDK that are not officially a part of the public API, your library may break if an application owner uses a different SDK implementation.
| Older Node Versions | See [Node Support](#node-support) |
| Web Browsers | See [Browser Support](#browser-support) below |
### Node Support
Automated tests are run using the latest release of each currently active version of Node.JS.
While Node.JS v8 and v10 are no longer supported by the Node.JS team, the latest versions of Node.JS v8 and v10 are still included in our testing suite.
Please note that versions of Node.JS v8 prior to `v8.5.0` will NOT work, because OpenTelemetry Node depends on the `perf_hooks` module introduced in `v8.5.0`
Only Node.js Active or Maintenance LTS versions are supported.
Previous versions of node *may* work, but they are not tested by OpenTelemetry and they are not guaranteed to work.
### Browser Support
Automated browser tests are run in the latest version of Headless Chrome.
There is currently no list of officially supported browsers, but OpenTelemetry is developed using standard web technologies with wide support and should work in currently supported versions of major browsers.
> [!IMPORTANT]
> Client instrumentation for the browser is **experimental** and mostly **unspecified**. If you are interested in
> helping out, get in touch with the [Client Instrumentation SIG][client-instrumentation-sig].
Rather than define versions of specific browsers / runtimes, OpenTelemetry sets the minimum supported version based on the
underlying language features used.
The current minumum language feature support is set as [ECMAScript 2022](https://262.ecma-international.org/13.0/) that are available
in all modern browsers / runtimes.
This means that if you are targeting or your end-users are using a browser / runtime that does not support ES2022, you will need
to transpile the code and provide any necessary polyfills for the missing features to ensure compatibility with your target
environments. Any support issues that arise from using a browser or runtime that does not support ES2022 will be closed as "won't fix".
This minimum support level is subject to change as the project evolves and as the underlying language features evolve.
## TypeScript Support
OpenTelemetry JavaScript is built with TypeScript `v5.0.4`. If you have a TypeScript project (app, library, instrumentation, etc.)
that depends on it, we recommend using same or higher version to compile the project.
OpenTelemetry JavaScript will follows DefinitelyType's [support policy for TypeScript](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window) which sets a support window of 2 years. Support for TypeScript versions older than 2 years will be dropped in minor releases of OpenTelemetry JavaScript.
## Package Version Compatibility
OpenTelemetry is released as a set of distinct packages in 3 categories: API, stable SDK, and experimental.
The API is located at [/api](/api/), the stable SDK packages are in the [/packages](/packages/) directory, and the experimental packages are listed in the [/experimental/packages](/experimental/packages/) directory.
There may also be API packages for experimental signals in the experimental directory.
All stable packages are released with the same version, and all experimental packages are released with the same version.
The below table describes which versions of each set of packages are expected to work together.
| Stable Packages | Experimental Packages |
|-----------------|-----------------------|
| 2.0.x | 0.200.x |
| 1.30.x | 0.57.x |
| 1.29.x | 0.56.x |
| 1.28.x | 0.55.x |
| 1.27.x | 0.54.x |
| 1.25.x | 0.52.x |
<details>
<summary>Older version compatibility matrix</summary>
<tr><td>1.8.x (this and later versions require API >=1.3.0 for metrics)</td><td>0.34.x</td></tr>
<tr><td>1.7.x</td><td>0.33.x</td></tr>
<tr><td>1.6.x</td><td>0.32.x</td></tr>
<tr><td>1.5.x</td><td>0.31.x</td></tr>
<tr><td>1.4.x</td><td>0.30.x</td></tr>
<tr><td>1.3.x</td><td>0.29.x</td></tr>
<tr><td>1.2.x</td><td>0.29.x</td></tr>
<tr><td>1.1.x</td><td>0.28.x</td></tr>
<tr><td>1.0.x</td><td>0.27.x</td></tr>
<tr><td>1.0.x (this and later versions require API >=1.0.0 for traces)</td><td>0.26.x</td></tr>
</table>
</details>
## Versioning
The current version for each package can be found in the respective `package.json` file for that module. For additional details see the [versioning and stability][spec-versioning] document in the specification.
## Feature Status
| Signal | API Status | SDK Status |
|---------|-------------|-------------------|
| Tracing | Stable | Release Candidate |
| Metrics | Development | Development |
| Logs | Roadmap | Roadmap |
| Signal | API Status | SDK Status |
| ------- | ----------- | ----------- |
| Tracing | Stable | Stable |
| Metrics | Stable | Stable |
| Logs | Development | Development |
For a more detailed breakdown of feature support see the [specification compliance matrix][compliance-matrix].
@ -177,60 +225,104 @@ instructions to build and make changes to this project, see the
We have a weekly SIG meeting! See the [community page](https://github.com/open-telemetry/community#javascript-sdk) for meeting details and notes.
*Find more about the maintainer role in [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer).*
For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
### Thanks to all the people who already contributed
- [Svetlana Brennan](https://github.com/svetlanabrennan), New Relic
For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
### Triagers
Members of this team have triager permissions for opentelemetry-js.git and opentelemetry-js-contrib.git.
- [Jackson Weber](https://github.com/JacksonWeber), Microsoft
For more information about the triager role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).
### Contrib Triagers
Members of this team have triager permissions for opentelemetry-js-contrib.git.
Typically, members of this are [component owners](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/.github/component_owners.yml) of one or more packages in the contrib repo.
- [Aaron Abbott](https://github.com/aabmass), Google
For more information about the triager role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).
For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).
| [@opentelemetry/api][otel-api] | This package provides TypeScript interfaces, enums and no-op implementations for the OpenTelemetry core trace and metrics model. It is intended for use both on the server and in the browser. |
| [@opentelemetry/core][otel-core] | This package provides default and no-op implementations of the OpenTelemetry api for trace and metrics. It's intended for use both on the server and in the browser. |
| [@opentelemetry/sdk-trace-base][otel-tracing] | This module provides a full control over instrumentation and span creation. It doesn't load [`async_hooks`](https://nodejs.org/api/async_hooks.html) or any instrumentation by default. It is intended for use both on the server and in the browser. |
| [@opentelemetry/sdk-metrics-base][otel-metrics] | This module provides instruments and meters for reporting of time series data. |
| [@opentelemetry/sdk-trace-node][otel-node] | This module provides automatic tracing for Node.js applications. It is intended for use on the server only. |
| [@opentelemetry/sdk-trace-web][otel-web] | This module provides automated instrumentation and tracing for Web applications. It is intended for use in the browser only. |
| [@opentelemetry/sdk-trace-base][otel-tracing] | This module provides a full control over instrumentation and span creation. It doesn't load [`async_hooks`](https://nodejs.org/api/async_hooks.html) or any instrumentation by default. It is intended for use both on the server and in the browser. |
| [@opentelemetry/sdk-metrics][otel-metrics] | This module provides instruments and meters for reporting of time series data. |
| [@opentelemetry/sdk-trace-node][otel-node] | This module provides automatic tracing for Node.js applications. It is intended for use on the server only. |
| [@opentelemetry/sdk-trace-web][otel-web] | This module provides automated instrumentation and tracing for Web applications. It is intended for use in the browser only. |
### Compatible Exporters
@ -271,250 +363,12 @@ These instrumentations are hosted at <https://github.com/open-telemetry/opentele
- `ResourceAttributes` renamed to `SemanticResourceAttributes` in the `@opentelemetry/semantic-conventions` package
### 0.19.x to 0.20.0
- `HttpBaggage` renamed to `HttpBaggagePropagator`
- `HttpTraceContext` renamed to `HttpTraceContextPropagator`
- `JaegerHttpTracePropagator` renamed to `JaegerPropagator`
- `serviceName` configuration removed from Collector exporters. Use `service.name` Resource attribute instead.
### 0.18.x to 0.19.0
- API is now a peer dependency. This means that users will need to include `@opentelemetry/api` as a dependency of their project in order to use the SDK. NPM version 7+ (Node 15+) should do this automatically.
- All plugins have been removed in favor of instrumentations.
- The `@opentelemetry/propagator-b3` package previously exported three propagators: `B3Propagator`,`B3SinglePropagator`, and `B3MultiPropagator`, but now only exports the `B3Propagator`. It extracts b3 context in single and multi-header encodings, and injects context using the single-header encoding by default, but can be configured to inject context using the multi-header endcoding during construction: `new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER })`. If you were previously using the `B3SinglePropagator` or `B3MultiPropagator` directly, you should update your code to use the `B3Propagator` with the appropriate configuration. See the [readme][otel-propagator-b3] for full details and usage.
- Sampling configuration via environment variable has changed. If you were using `OTEL_SAMPLING_PROBABILITY` then you should replace it with `OTEL_TRACES_SAMPLER=parentbased_traceidratio` and `OTEL_TRACES_SAMPLER_ARG=<number>` where `<number>` is a number in the [0..1] range, e.g. "0.25". Default is 1.0 if unset.
### 0.17.0 to 0.18.0
- `diag.setLogLevel` is removed and LogLevel can be set by an optional second parameter to `setLogger`
- Breaking change - The resulting resource MUST have all attributes that are on any of the two input resources. If a key exists on both the old and updating resource, the value of the updating resource MUST be picked - previously it was opposite.
### 0.16.0 to 0.17.0
[PR-1880](https://github.com/open-telemetry/opentelemetry-js/pull/1880) feat(diag-logger): introduce a new global level api.diag for internal diagnostic logging
- These PR's remove the previous ```Logger``` and ```LogLevel``` implementations and change the way you should use the replacement ```DiagLogger``` and ```DiagLogLevel```, below are simple examples of how to change your existing usages.
#### Setting the global diagnostic logger
The new global [```api.diag```](https://github.com/open-telemetry/opentelemetry-js-api/blob/main/src/api/diag.ts) provides the ability to set the global diagnostic logger ```setLogger()``` and logging level ```setLogLevel()```, it is also a ```DiagLogger``` implementation and should be directly to log diagnostic messages.
All included logger references have been removed in preference to using the global ```api.diag``` directly, so you no longer need to pass around the logger instance via function parameters or included as part of the configuration for a component.
```javascript
import { diag, DiagConsoleLogger, DiagLogLevel } from "@opentelemetry/api";
// Setting the default Global logger to use the Console
// And optionally change the logging level (Defaults to INFO)
- `registerInstrumentations` supports loading old plugins and instrumentations together. It also supports setting tracer provider and meter provider on instrumentations
[PR-1874](https://github.com/open-telemetry/opentelemetry-js/pull/1874) More specific API type names
Some types exported from `"@opentelemetry/api"` have been changed to be more specific.
- `AttributeValue` renamed to `SpanAttributeValue`
- `Attributes` renamed to `SpanAttributes`
- `EntryTtl` renamed to `BaggageEntryTtl`
- `EntryValue` renamed to `BaggageEntryValue`
- `Status` renamed to `SpanStatus`
- `StatusCode` renamed to `SpanStatusCode`
### 0.15.0 to 0.16.0
[PR-1863](https://github.com/open-telemetry/opentelemetry-js/pull/1863) removed public attributes `keepAlive` and `httpAgentOptions` from nodejs `CollectorTraceExporter` and `CollectorMetricExporter`
### 0.14.0 to 0.15.0
[PR-1764](https://github.com/open-telemetry/opentelemetry-js/pull/1764) removed some APIs from `Tracer`:
- `Tracer.getCurrentSpan()`: use `api.getSpan(api.context.active())`
- `Tracer.withSpan(span)`: use `api.context.with(api.setSpan(api.context.active(), span))`
- `Tracer.bind(target)`: use `api.context.bind(target)`
[PR-1797](https://github.com/open-telemetry/opentelemetry-js/pull/1797) chore!: split metrics into its own api package:
- Any references to `require("@opentelemetry/api").metrics` will need to be changed to `require("@opentelemetry/api-metrics").metrics`
[PR-1725](https://github.com/open-telemetry/opentelemetry-js/pull/1725) Use new gRPC default port
- The default port used by `@opentelemetry/exporter-collector-grpc` is changed from `55680` to `4317`
[PR-1749](https://github.com/open-telemetry/opentelemetry-js/pull/1749) chore: improve naming of span related context APIs
- Rename `[gs]etActiveSpan()` to `[gs]etSpan()`
- Rename `setExtractedSpanContext()` to `setSpanContext()`
- Rename `getParentSpanContext()` to `getSpanContext()`
## Useful links
- [Upgrade to SDK 2.x guide](./doc/upgrade-to-2.x.md)
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
@ -527,11 +381,13 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
This document explains how to publish all OT modules at version x.y.z. Ensure that you’re following semver when choosing a version number.
Release Process:
- [Release Process (Maintainers only)](#release-process)
- [Update to latest locally](#update-to-latest-locally)
- [Create a new branch](#create-a-new-branch)
- [Prepare each package for release](#prepare-each-package-for-release)
- [Use the Changelog to create a GitHub Release](#use-the-changelog-to-create-a-github-release)
- [Generate the changelog with lerna](#generate-the-changelog-with-lerna)
- [How to use](#how-to-use)
- [Update Changelog file](#update-changelog-file)
- [Create a new PR](#create-a-new-pr)
- [Merge and pull](#merge-and-pull)
- [Publish all packages](#publish-all-packages)
- [Publish the GitHub Release](#publish-the-github-release)
- [Update CHANGELOG](#update-changelog)
- [Known Issues](#known-issues)
## Release Process
### Update to latest locally
Use `git fetch` and `git checkout origin/main` to ensure you’re on the latest commit. Make sure you have no unstaged changes. Ideally, also use `git clean -dfx` to remove all ignored and untracked files.
### Create a new branch
Create a new branch called `x.y.z-proposal` from the current commit.
### Prepare each package for release
Decide on the next `major.minor.patch` release number based on [semver](http://semver.org/) guidelines.
- Use `npm install` command to initialize all package directories
- Use `lerna publish --skip-npm --no-git-tag-version --no-push` to bump the version in all `package.json`
- Use `npm run bootstrap` to generate latest `version.ts` files
### Use the Changelog to create a GitHub Release
#### Generate the changelog with lerna
Since we use `lerna`, we can use [lerna-changelog](https://github.com/lerna/lerna-changelog#lerna-changelog)
##### How to use
Pass your [github token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) to generate the changelog automatically.
For security reasons, when you create a Github token, select the permissions: under **repo**, select **Access public repositories**, **Access commit status**.
In your terminal, execute the following command:
```bash
GITHUB_AUTH=<yourtoken> lerna-changelog
```
It will print something like:
```md
### Unreleased (2018-05-24)
##### :bug: Bug Fix
* [#198](https://github.com/my-org/my-repo/pull/198) Avoid an infinite loop ([@helpful-hacker](https://github.com/helpful-hacker))
By default lerna-changelog will show all pull requests that have been merged since the latest tagged commit in the repository. That is however only true for pull requests **with certain labels applied** (see [lerna.json](lerna.json) for authorized labels).
You can also use the `--from` and `--to` options to view a different range of pull requests:
From what `lerna-changelog` has generated, starts new Unreleased label. Follow the example set by recent Released label.
On [GitHub Releases](https://github.com/open-telemetry/opentelemetry-js/releases), follow the example set by recent releases to populate a summary of changes, as well as a list of commits that were applied since the last release. Save it as a draft, don’t publish it. Don’t forget the tag -- call it `vx.y.z` and leave it pointing at `main` for now (this can be changed as long as the GitHub release isn’t published).
### Create a new PR
Create a pull request titled `chore: x.y.z release proposal`. The commit body should just be a link to the draft notes. Someone who can access draft notes should approve it, looking in particular for test passing, and whether the draft notes are satisfactory.
### Merge and pull
Merge the PR, and pull the changes locally (using the commands in the first step). Ensure that `chore: x.y.z release proposal` is the most recent commit.
### Publish all packages
Go into each directory and use `npm publish` (requires permissions) to publish the package. You can use the following script to automate this.
```bash
#!/bin/bash
for dir in $(ls packages); do
pushd packages/$dir
npm publish
popd
done
```
Check your e-mail and make sure the number of “you’ve published this module” emails matches the number you expect.
### Publish the GitHub Release
Publish the GitHub release, ensuring that the tag points to the newly landed commit corresponding to release proposal `x.y.z`.
### Update CHANGELOG
- After releasing is done, update the [CHANGELOG.md](https://github.com/open-telemetry/opentelemetry-js/blob/main/CHANGELOG.md) and start new Unreleased label.
- Create a new commit with the exact title: `Post Release: update CHANGELOG.md`.
- Go through PR review and merge it to GitHub main branch.
### Known Issues
- The `examples/` and `getting-started/` folders are not part of lerna packages, we need to manually bump the version in `package.json`.
* feat(diag): change types in `DiagComponentLogger` from `any` to `unknown`[#5478](https://github.com/open-telemetry/opentelemetry-js/pull/5478) @loganrosen
### :bug: (Bug Fix)
### :books: (Refine Doc)
### :house: (Internal)
* refactor(api): remove "export *" in favor of explicit named exports [#4880](https://github.com/open-telemetry/opentelemetry-js/pull/4880) @robbkidd
* This change is non-breaking for end-users, but breaking for Trace SDK implmentations in accordance with the [specification](https://github.com/open-telemetry/opentelemetry-specification/blob/a03382ada8afa9415266a84dafac0510ec8c160f/specification/upgrading.md?plain=1#L97-L122) as new features need to be implemented.
* feat: support node 22 [#4666](https://github.com/open-telemetry/opentelemetry-js/pull/4666) @dyladan
## 1.8.0
### :rocket: (Enhancement)
* feat(api): add SugaredTracer for functions not defined in the spec
* Add getActiveSpan to trace API ([#163](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/163)) ([17ccb3a](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/17ccb3a4e385bc5769ded6fc742c9782a93244a5))
* add tracestate implementation to api ([#147](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/147)) ([82842c7](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/82842c7097614e6ece99e73838ac5e94ff5460b7))
* define common attributes type ([#142](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/142)) ([ae9bead](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/ae9bead17750d35dec4b63cfae098087666abc85))
* **trace:** add optional schema url to TracerProvider.getTracer ([#129](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/129)) ([aa65fc6](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/aa65fc66809d45090d6e4951c265386d17ccc6f6))
* remove all circular dependencies ([#119](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/119)) ([a8083e8](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/a8083e84b23227828745da80fd5fe512357dd34b))
## 1.0.2
### :bug: Bug Fix
* [#105](https://github.com/open-telemetry/opentelemetry-js-api/pull/105) fix: set delegate after successful registration ([@Flarna](https://github.com/Flarna))
* [#94](https://github.com/open-telemetry/opentelemetry-js-api/pull/94) fix: enforce strict equality on prerelease versions ([@dyladan](https://github.com/dyladan))
### :memo: Documentation
* [#106](https://github.com/open-telemetry/opentelemetry-js-api/pull/106) docs: fix crash in README example ([@trentm](https://github.com/trentm))
* [#101](https://github.com/open-telemetry/opentelemetry-js-api/pull/101) docs: Format example for tracer.startActiveSpan ([@ad-m](https://github.com/ad-m))
* [#99](https://github.com/open-telemetry/opentelemetry-js-api/pull/99) chore: fix link to API docs ([@dyladan](https://github.com/dyladan))
### :house: Internal
* [#109](https://github.com/open-telemetry/opentelemetry-js-api/pull/109) internal: add missing approvers from core ([@dyladan](https://github.com/dyladan))
* [#103](https://github.com/open-telemetry/opentelemetry-js-api/pull/103) chore: reuse NoopTracer in ProxyTracer ([@Flarna](https://github.com/Flarna))
### Committers: 4
* Adam Dobrawy ([@ad-m](https://github.com/ad-m))
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
## 0.21.0
### :boom: Breaking Change
* [#78](https://github.com/open-telemetry/opentelemetry-js-api/pull/78) feat: unify signatures of `with` and `bind` ([@Rauno56](https://github.com/Rauno56))
* [#46](https://github.com/open-telemetry/opentelemetry-js-api/pull/46) chore: do not export singletons ([@dyladan](https://github.com/dyladan))
### :rocket: Enhancement
* [#81](https://github.com/open-telemetry/opentelemetry-js-api/pull/81) chore: function overloads implementation of startActiveSpan in noop t… ([@naseemkullah](https://github.com/naseemkullah))
* [#58](https://github.com/open-telemetry/opentelemetry-js-api/pull/58) chore: use spancontext for link ([@dyladan](https://github.com/dyladan))
* [#47](https://github.com/open-telemetry/opentelemetry-js-api/pull/47) chore: move span method for context in trace API #40 ([@vmarchaud](https://github.com/vmarchaud))
* [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) chore: rename `span#context()` to `span#spanContext` ([@dyladan](https://github.com/dyladan))
* [#43](https://github.com/open-telemetry/opentelemetry-js-api/pull/43) chore: renaming noop span to non recording span ([@obecny](https://github.com/obecny))
* [#32](https://github.com/open-telemetry/opentelemetry-js-api/pull/32) feat!: return boolean success value from setGlobalXXX methods ([@dyladan](https://github.com/dyladan))
* [#58](https://github.com/open-telemetry/opentelemetry-js-api/pull/58) chore: use spancontext for link ([@dyladan](https://github.com/dyladan))
* [#51](https://github.com/open-telemetry/opentelemetry-js-api/pull/51) feat: add function to wrap SpanContext in NonRecordingSpan #49 ([@dyladan](https://github.com/dyladan))
### :memo: Documentation
* [#64](https://github.com/open-telemetry/opentelemetry-js-api/pull/64) chore: document the reason for symbol.for ([@dyladan](https://github.com/dyladan))
* [#44](https://github.com/open-telemetry/opentelemetry-js-api/pull/44) chore: updating readme headline and fixing links ([@obecny](https://github.com/obecny))
### Committers: 6
* Bartlomiej Obecny ([@obecny](https://github.com/obecny))
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
## 0.18.1
### :bug: Bug Fix
* [#16](https://github.com/open-telemetry/opentelemetry-js-api/pull/16) fix: Reverse the direction of the semver check ([@dyladan](https://github.com/dyladan))
### Committers: 1
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
* [#10](https://github.com/open-telemetry/opentelemetry-js-api/pull/10) Use semver to determine API compatibility ([@dyladan](https://github.com/dyladan))
This package provides everything needed to interact with the OpenTelemetry API, including all TypeScript interfaces, enums, and no-op implementations. It is intended for use both on the server and in the browser.
The methods in this package perform no operations by default. This means they can be safely called by a library or end-user application whether there is an SDK registered or not. In order to generate and export telemetry data, you will also need an SDK such as the [OpenTelemetry JS SDK][opentelemetry-js].
## Tracing Quick Start
### You Will Need
- An application you wish to instrument
- [OpenTelemetry JS SDK][opentelemetry-js]
- Node.js >=8.5.0 (14+ is preferred) or an ECMAScript 5+ compatible browser
**Note:** ECMAScript 5+ compatibility is for this package only. Please refer to the documentation for the SDK you are using to determine its minimum ECMAScript version.
**Note for library authors:** Only your end users will need an OpenTelemetry SDK. If you wish to support OpenTelemetry in your library, you only need to use the OpenTelemetry API. For more information, please read the [tracing documentation][docs-tracing].
In order to get started with tracing, you will need to first register an SDK. The SDK you are using may provide a convenience method which calls the registration methods for you, but if you would like to call them directly they are documented here: [SDK registration methods][docs-sdk-registration].
Once you have registered an SDK, you can start and end spans. A simple example of basic SDK registration and tracing a simple operation is below. The example should export spans to the console once per second. For more information, see the [tracing documentation][docs-tracing].
// Acquire a tracer from the global tracer provider which will be used to trace the application
const name = 'my-application-name';
const version = '0.1.0';
const tracer = trace.getTracer(name, version);
// Trace your application by creating spans
async function operation() {
const span = tracer.startSpan("do operation");
// mock some work by sleeping 1 second
await new Promise((resolve, reject) => {
setTimeout(resolve, 1000);
})
span.end();
}
async function main() {
while (true) {
await operation();
}
}
main();
```
## Version Compatibility
Because the npm installer and node module resolution algorithm could potentially allow two or more copies of any given package to exist within the same `node_modules` structure, the OpenTelemetry API takes advantage of a variable on the `global` object to store the global API. When an API method in the API package is called, it checks if this `global` API exists and proxies calls to it if and only if it is a compatible API version. This means if a package has a dependency on an OpenTelemetry API version which is not compatible with the API used by the end user, the package will receive a no-op implementation of the API.
## Upgrade Guidelines
### 0.21.0 to 1.0.0
No breaking changes
### 0.20.0 to 0.21.0
- [#78](https://github.com/open-telemetry/opentelemetry-js-api/issues/78) `api.context.bind` arguments reversed and `context` is now a required argument.
- [#46](https://github.com/open-telemetry/opentelemetry-js-api/issues/46) Noop classes and singletons are no longer exported. To create a noop span it is recommended to use `api.trace.wrapSpanContext` with `INVALID_SPAN_CONTEXT` instead of using the `NOOP_TRACER`.
### 1.0.0-rc.3 to 0.20.0
- Removing `TimedEvent` which was not part of spec
- `HttpBaggage` renamed to `HttpBaggagePropagator`
- [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) `Span#context` renamed to `Span#spanContext`
- [#47](https://github.com/open-telemetry/opentelemetry-js-api/pull/47) `getSpan`/`setSpan`/`getSpanContext`/`setSpanContext` moved to `trace` namespace
- [#55](https://github.com/open-telemetry/opentelemetry-js-api/pull/55) `getBaggage`/`setBaggage`/`createBaggage` moved to `propagation` namespace
## Useful links
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
## License
Apache 2.0 - See [LICENSE][license-url] for more information.