* 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>
Thanks for taking the time to fill out this bug report!
Please make sure to fill out the entire form below,
providing as much context as you can in order to help us
triage and track down your bug as quickly as possible.
> [!IMPORTANT]
> **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
If your bug is related to an instrumentation or plugin in [opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib)
please be sure to file it there.
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:Please provide as much detail as you reasonably can.
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
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.
description:If possible, please provide your full package.json. If not, please provide at least your list of dependencies and their versions, especially OpenTelemetry versions.
description:|
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 tracing.js app.js"
"start": "node -r otel.js app.js"
},
"dependencies": {
"@opentelemetry/api": "^1.3.0",
@ -95,3 +120,20 @@ body:
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})."
All notable changes to this project will be documented in this file.
For API changes, see the [API CHANGELOG](api/CHANGELOG.md).
For experimental package changes, see the [experimental CHANGELOG](experimental/CHANGELOG.md).
For semantic convention package changes, see the [semconv CHANGELOG](semantic-conventions/CHANGELOG.md).
For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2.x.md).
## Unreleased
* 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
### 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,14 @@ 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]
```
Here an example that will pass the verification: `git commit -s -am "chore(opentelemetry-core): update deps"`
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
@ -54,7 +97,7 @@ An entry into `CHANGELOG.md` or `experimental/CHANGELOG.md` is required for the
- Changes to default settings
- New components being added
It is reasonable to omit an entry to the changelog under these circuimstances:
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
@ -95,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
@ -111,10 +154,10 @@ Most of the commands needed for development are accessed as [npm scripts](https:
### 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
@ -153,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.
@ -173,6 +225,16 @@ To run the unit tests continuously in watch mode while developing, use:
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 `eslint` to lint source code. Just like tests and compilation, linting can be done for all packages or only a single package.
@ -197,6 +259,21 @@ 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.
@ -216,40 +293,6 @@ To add a new package, copy `packages/template` to your new package directory and
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
- 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.
### 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.
- 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.
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.
### 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).
### Platform conditional exports
Universal packages are packages that can be used in both web browsers and
This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a framework for collecting traces and metrics from applications.
This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a framework for collecting traces, metrics, and logs from applications.
## Quick Start
**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).
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/>.
@ -68,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
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
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.
Please note that versions of Node.JS v8 prior to `v8.12.0` will NOT work, because OpenTelemetry Node depends on the `perf_hooks` module introduced in `v8.5.0` and `performance.timeOrigin` that is set correctly starting in `v8.12.0`.
### 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
@ -136,19 +158,49 @@ There may also be API packages for experimental signals in the experimental dire
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.
For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
- [Svetlana Brennan](https://github.com/svetlanabrennan), New Relic
*Find more about the approver role in [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver).*
For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
- [Valentin Marchaud](https://github.com/vmarchaud), Open Source Contributor
Members of this team have triager permissions for opentelemetry-js.git and opentelemetry-js-contrib.git.
*Find more about the maintainer role in [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer).*
- [Jackson Weber](https://github.com/JacksonWeber), Microsoft
### Thanks to all the people who already contributed
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).
- `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.
- Prometheus exporter added suffix `_total` to counter metrics.
### 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/blob/main/api/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]
@ -540,11 +381,13 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
* 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
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].
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].