Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(resources): prevent circular import (resource -> detector -> resource -> ...) #4653

Merged

Conversation

pichlermarc
Copy link
Member

Which problem is this PR solving?

Using @opentelemetry/resources with rollup causes a warning to be logged:

(!) Circular dependencies
../../packages/opentelemetry-resources/build/esm/Resource.js -> ../../packages/opentelemetry-resources/build/esm/platform/index.js -> ../../packages/opentelemetry-resources/build/esm/platform/node/index.js -> ../../packages/opentelemetry-resources/build/esm/platform/node/HostDetector.js -> ../../packages/opentelemetry-resources/build/esm/platform/node/HostDetectorSync.js -> ../../packages/opentelemetry-resources/build/esm/Resource.js
../../packages/opentelemetry-resources/build/esm/Resource.js -> ../../packages/opentelemetry-resources/build/esm/platform/index.js -> ../../packages/opentelemetry-resources/build/esm/platform/node/index.js -> ../../packages/opentelemetry-resources/build/esm/platform/node/OSDetector.js -> ../../packages/opentelemetry-resources/build/esm/platform/node/OSDetectorSync.js -> ../../packages/opentelemetry-resources/build/esm/Resource.js
../../packages/opentelemetry-resources/build/esm/Resource.js -> ../../packages/opentelemetry-resources/build/esm/platform/index.js -> ../../packages/opentelemetry-resources/build/esm/platform/node/index.js -> ../../packages/opentelemetry-resources/build/esm/platform/node/ProcessDetector.js -> ../../packages/opentelemetry-resources/build/esm/platform/node/ProcessDetectorSync.js -> ../../packages/opentelemetry-resources/build/esm/Resource.js
...and 3 more

Fixes #4452

Short description of the changes

  • re-arranges files so that Resource does not import detectors anymore (moved detectors to the detectors directory)
  • changes wildcard exports to named exports

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Unit tests (Node.js/Browser)
  • Manual test with rollup

@pichlermarc pichlermarc marked this pull request as ready for review April 22, 2024 20:00
@pichlermarc pichlermarc requested a review from a team April 22, 2024 20:00
@pichlermarc pichlermarc added bug Something isn't working pkg:resources labels Apr 22, 2024
@pichlermarc pichlermarc merged commit 8079fd6 into open-telemetry:main Apr 26, 2024
18 checks passed
@pichlermarc pichlermarc deleted the fix/resource-circular-dep branch April 26, 2024 12:22
pichlermarc added a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request May 6, 2024
…urce -> ...) (open-telemetry#4653)

* fix(resources): prevent circular import (resource -> detector -> resource -> ...)

* fixup! fix(resources): prevent circular import (resource -> detector -> resource -> ...)
pichlermarc added a commit that referenced this pull request May 15, 2024
…ents (#4705)

* fix(resources): prevent circular import (resource -> detector -> resource -> ...) (#4653)

* fix(resources): prevent circular import (resource -> detector -> resource -> ...)

* fixup! fix(resources): prevent circular import (resource -> detector -> resource -> ...)

* fix(core): align inconsistent behavior of getEnv() and getEnvWithoutDefaults() when a process polyfill is used (#4649)

* fix(core): align inconsistent behavior of getEnv() and getEnvWithoutDefaults() when a process polyfill is used

* Update CHANGELOG.md

* fix(deps): update dependency import-in-the-middle to v1.7.4 (#4667)

* fix(exporter-metrics-otlp-grpc) Add explicit otlp-exporter-base depen… (#4678)

* fix(exporter-metrics-otlp-grpc) Add explicit otlp-exporter-base dependency to exporter-metrics-otlp-grpc

* Update CHANGELOG.md

---------

Co-authored-by: Marc Pichler <[email protected]>

* chore: sync package-lock.json, adapt changelog

* chore: prepare release 1.24.1/0.51.1

* chore: adjust changelog

* chore: sync package-lock.json

---------

Co-authored-by: Mend Renovate <[email protected]>
Co-authored-by: Aksel Allas <[email protected]>
Zirak pushed a commit to Zirak/opentelemetry-js that referenced this pull request Sep 14, 2024
…urce -> ...) (open-telemetry#4653)

* fix(resources): prevent circular import (resource -> detector -> resource -> ...)

* fixup! fix(resources): prevent circular import (resource -> detector -> resource -> ...)
Zirak pushed a commit to Zirak/opentelemetry-js that referenced this pull request Sep 14, 2024
…ents (open-telemetry#4705)

* fix(resources): prevent circular import (resource -> detector -> resource -> ...) (open-telemetry#4653)

* fix(resources): prevent circular import (resource -> detector -> resource -> ...)

* fixup! fix(resources): prevent circular import (resource -> detector -> resource -> ...)

* fix(core): align inconsistent behavior of getEnv() and getEnvWithoutDefaults() when a process polyfill is used (open-telemetry#4649)

* fix(core): align inconsistent behavior of getEnv() and getEnvWithoutDefaults() when a process polyfill is used

* Update CHANGELOG.md

* fix(deps): update dependency import-in-the-middle to v1.7.4 (open-telemetry#4667)

* fix(exporter-metrics-otlp-grpc) Add explicit otlp-exporter-base depen… (open-telemetry#4678)

* fix(exporter-metrics-otlp-grpc) Add explicit otlp-exporter-base dependency to exporter-metrics-otlp-grpc

* Update CHANGELOG.md

---------

Co-authored-by: Marc Pichler <[email protected]>

* chore: sync package-lock.json, adapt changelog

* chore: prepare release 1.24.1/0.51.1

* chore: adjust changelog

* chore: sync package-lock.json

---------

Co-authored-by: Mend Renovate <[email protected]>
Co-authored-by: Aksel Allas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:resources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Circular dependencies in @opentelemetry/resources/build/esm/Resource.js when build browser bundle with rollup
2 participants