@veryfront/ext-content-mdx 0.1.985
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +42 -0
- package/esm/_dnt.polyfills.d.ts +18 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +15 -0
- package/esm/_dnt.shims.d.ts +12 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +68 -0
- package/esm/deno.d.ts +427 -0
- package/esm/deno.d.ts.map +1 -0
- package/esm/deno.js +512 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_chars.d.ts +33 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_chars.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_chars.js +48 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_loader_state.d.ts +64 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_loader_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_loader_state.js +1371 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_schema.d.ts +44 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_schema.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_schema.js +117 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/binary.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/binary.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/binary.js +103 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/bool.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/bool.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/bool.js +32 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/float.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/float.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/float.js +96 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/int.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/int.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/int.js +159 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/map.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/map.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/map.js +14 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/merge.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/merge.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/merge.js +10 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/nil.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/nil.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/nil.js +22 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/omap.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/omap.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/omap.js +29 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.js +19 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.js +30 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/seq.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/seq.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/seq.js +10 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/set.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/set.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/set.js +14 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/str.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/str.js +9 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.js +81 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.js +20 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type.d.ts +32 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type.js +6 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_utils.d.ts +4 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_utils.js +13 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/parse.d.ts +76 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/parse.js +91 -0
- package/esm/extensions/ext-content-mdx/src/compiler/markdown-compile.d.ts +3 -0
- package/esm/extensions/ext-content-mdx/src/compiler/markdown-compile.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/compiler/markdown-compile.js +99 -0
- package/esm/extensions/ext-content-mdx/src/compiler/mdx-compile.d.ts +3 -0
- package/esm/extensions/ext-content-mdx/src/compiler/mdx-compile.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/compiler/mdx-compile.js +53 -0
- package/esm/extensions/ext-content-mdx/src/index.d.ts +31 -0
- package/esm/extensions/ext-content-mdx/src/index.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/index.js +56 -0
- package/esm/extensions/ext-content-mdx/src/plugins/plugin-loader.d.ts +4 -0
- package/esm/extensions/ext-content-mdx/src/plugins/plugin-loader.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/plugins/plugin-loader.js +18 -0
- package/esm/extensions/ext-content-mdx/src/plugins/rehype-node-positions.d.ts +20 -0
- package/esm/extensions/ext-content-mdx/src/plugins/rehype-node-positions.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/plugins/rehype-node-positions.js +45 -0
- package/esm/extensions/ext-content-mdx/src/plugins/remark-headings.d.ts +4 -0
- package/esm/extensions/ext-content-mdx/src/plugins/remark-headings.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/plugins/remark-headings.js +69 -0
- package/esm/extensions/ext-content-mdx/src/plugins/remark-mdx-utils.d.ts +14 -0
- package/esm/extensions/ext-content-mdx/src/plugins/remark-mdx-utils.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/plugins/remark-mdx-utils.js +191 -0
- package/esm/package.json +3 -0
- package/esm/src/config/defaults.d.ts +39 -0
- package/esm/src/config/defaults.d.ts.map +1 -0
- package/esm/src/config/defaults.js +65 -0
- package/esm/src/errors/error-registry/agent.d.ts +18 -0
- package/esm/src/errors/error-registry/agent.d.ts.map +1 -0
- package/esm/src/errors/error-registry/agent.js +60 -0
- package/esm/src/errors/error-registry/boundary.d.ts +16 -0
- package/esm/src/errors/error-registry/boundary.d.ts.map +1 -0
- package/esm/src/errors/error-registry/boundary.js +52 -0
- package/esm/src/errors/error-registry/build.d.ts +20 -0
- package/esm/src/errors/error-registry/build.d.ts.map +1 -0
- package/esm/src/errors/error-registry/build.js +68 -0
- package/esm/src/errors/error-registry/config.d.ts +22 -0
- package/esm/src/errors/error-registry/config.d.ts.map +1 -0
- package/esm/src/errors/error-registry/config.js +70 -0
- package/esm/src/errors/error-registry/deploy.d.ts +12 -0
- package/esm/src/errors/error-registry/deploy.d.ts.map +1 -0
- package/esm/src/errors/error-registry/deploy.js +36 -0
- package/esm/src/errors/error-registry/dev.d.ts +14 -0
- package/esm/src/errors/error-registry/dev.d.ts.map +1 -0
- package/esm/src/errors/error-registry/dev.js +44 -0
- package/esm/src/errors/error-registry/general.d.ts +29 -0
- package/esm/src/errors/error-registry/general.d.ts.map +1 -0
- package/esm/src/errors/error-registry/general.js +92 -0
- package/esm/src/errors/error-registry/module.d.ts +16 -0
- package/esm/src/errors/error-registry/module.d.ts.map +1 -0
- package/esm/src/errors/error-registry/module.js +52 -0
- package/esm/src/errors/error-registry/route.d.ts +16 -0
- package/esm/src/errors/error-registry/route.d.ts.map +1 -0
- package/esm/src/errors/error-registry/route.js +52 -0
- package/esm/src/errors/error-registry/runtime.d.ts +18 -0
- package/esm/src/errors/error-registry/runtime.d.ts.map +1 -0
- package/esm/src/errors/error-registry/runtime.js +60 -0
- package/esm/src/errors/error-registry/server.d.ts +39 -0
- package/esm/src/errors/error-registry/server.d.ts.map +1 -0
- package/esm/src/errors/error-registry/server.js +129 -0
- package/esm/src/errors/error-registry-helpers.d.ts +6 -0
- package/esm/src/errors/error-registry-helpers.d.ts.map +1 -0
- package/esm/src/errors/error-registry-helpers.js +9 -0
- package/esm/src/errors/error-registry.d.ts +114 -0
- package/esm/src/errors/error-registry.d.ts.map +1 -0
- package/esm/src/errors/error-registry.js +60 -0
- package/esm/src/errors/types.d.ts +84 -0
- package/esm/src/errors/types.d.ts.map +1 -0
- package/esm/src/errors/types.js +69 -0
- package/esm/src/errors/veryfront-error.d.ts +149 -0
- package/esm/src/errors/veryfront-error.d.ts.map +1 -0
- package/esm/src/errors/veryfront-error.js +61 -0
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts +13 -0
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts.map +1 -0
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.js +55 -0
- package/esm/src/observability/tracing/api-shim.d.ts +178 -0
- package/esm/src/observability/tracing/api-shim.d.ts.map +1 -0
- package/esm/src/observability/tracing/api-shim.js +241 -0
- package/esm/src/observability/tracing/otlp-setup.d.ts +56 -0
- package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -0
- package/esm/src/observability/tracing/otlp-setup.js +206 -0
- package/esm/src/observability/tracing/telemetry-env.d.ts +3 -0
- package/esm/src/observability/tracing/telemetry-env.d.ts.map +1 -0
- package/esm/src/observability/tracing/telemetry-env.js +10 -0
- package/esm/src/platform/adapters/base.d.ts +188 -0
- package/esm/src/platform/adapters/base.d.ts.map +1 -0
- package/esm/src/platform/adapters/base.js +15 -0
- package/esm/src/platform/compat/constants.d.ts +13 -0
- package/esm/src/platform/compat/constants.d.ts.map +1 -0
- package/esm/src/platform/compat/constants.js +12 -0
- package/esm/src/platform/compat/dynamic-import.d.ts +11 -0
- package/esm/src/platform/compat/dynamic-import.d.ts.map +1 -0
- package/esm/src/platform/compat/dynamic-import.js +10 -0
- package/esm/src/platform/compat/fs.d.ts +71 -0
- package/esm/src/platform/compat/fs.d.ts.map +1 -0
- package/esm/src/platform/compat/fs.js +277 -0
- package/esm/src/platform/compat/path/basic-operations.d.ts +9 -0
- package/esm/src/platform/compat/path/basic-operations.d.ts.map +1 -0
- package/esm/src/platform/compat/path/basic-operations.js +56 -0
- package/esm/src/platform/compat/path/index.d.ts +13 -0
- package/esm/src/platform/compat/path/index.d.ts.map +1 -0
- package/esm/src/platform/compat/path/index.js +11 -0
- package/esm/src/platform/compat/path/parse-format.d.ts +4 -0
- package/esm/src/platform/compat/path/parse-format.d.ts.map +1 -0
- package/esm/src/platform/compat/path/parse-format.js +26 -0
- package/esm/src/platform/compat/path/resolution.d.ts +6 -0
- package/esm/src/platform/compat/path/resolution.d.ts.map +1 -0
- package/esm/src/platform/compat/path/resolution.js +121 -0
- package/esm/src/platform/compat/path/runtime.d.ts +8 -0
- package/esm/src/platform/compat/path/runtime.d.ts.map +1 -0
- package/esm/src/platform/compat/path/runtime.js +20 -0
- package/esm/src/platform/compat/path/security.d.ts +2 -0
- package/esm/src/platform/compat/path/security.d.ts.map +1 -0
- package/esm/src/platform/compat/path/security.js +24 -0
- package/esm/src/platform/compat/path/types.d.ts +22 -0
- package/esm/src/platform/compat/path/types.d.ts.map +1 -0
- package/esm/src/platform/compat/path/types.js +1 -0
- package/esm/src/platform/compat/path/url-conversion.d.ts +3 -0
- package/esm/src/platform/compat/path/url-conversion.d.ts.map +1 -0
- package/esm/src/platform/compat/path/url-conversion.js +45 -0
- package/esm/src/platform/compat/process/command.d.ts +31 -0
- package/esm/src/platform/compat/process/command.d.ts.map +1 -0
- package/esm/src/platform/compat/process/command.js +194 -0
- package/esm/src/platform/compat/process/env.d.ts +35 -0
- package/esm/src/platform/compat/process/env.d.ts.map +1 -0
- package/esm/src/platform/compat/process/env.js +194 -0
- package/esm/src/platform/compat/process/lifecycle.d.ts +99 -0
- package/esm/src/platform/compat/process/lifecycle.d.ts.map +1 -0
- package/esm/src/platform/compat/process/lifecycle.js +327 -0
- package/esm/src/platform/compat/process/runtime-process.d.ts +10 -0
- package/esm/src/platform/compat/process/runtime-process.d.ts.map +1 -0
- package/esm/src/platform/compat/process/runtime-process.js +25 -0
- package/esm/src/platform/compat/process.d.ts +5 -0
- package/esm/src/platform/compat/process.d.ts.map +1 -0
- package/esm/src/platform/compat/process.js +4 -0
- package/esm/src/platform/compat/runtime.d.ts +51 -0
- package/esm/src/platform/compat/runtime.d.ts.map +1 -0
- package/esm/src/platform/compat/runtime.js +101 -0
- package/esm/src/platform/compat/std/front-matter-yaml.d.ts +13 -0
- package/esm/src/platform/compat/std/front-matter-yaml.d.ts.map +1 -0
- package/esm/src/platform/compat/std/front-matter-yaml.js +28 -0
- package/esm/src/transforms/import-rewriter/url-builder.d.ts +70 -0
- package/esm/src/transforms/import-rewriter/url-builder.d.ts.map +1 -0
- package/esm/src/transforms/import-rewriter/url-builder.js +152 -0
- package/esm/src/transforms/md/utils.d.ts +14 -0
- package/esm/src/transforms/md/utils.d.ts.map +1 -0
- package/esm/src/transforms/md/utils.js +17 -0
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts +6 -0
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts.map +1 -0
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.js +48 -0
- package/esm/src/transforms/mdx/compiler/import-rewriter.d.ts +10 -0
- package/esm/src/transforms/mdx/compiler/import-rewriter.d.ts.map +1 -0
- package/esm/src/transforms/mdx/compiler/import-rewriter.js +87 -0
- package/esm/src/utils/base64url.d.ts +6 -0
- package/esm/src/utils/base64url.d.ts.map +1 -0
- package/esm/src/utils/base64url.js +12 -0
- package/esm/src/utils/bundle-manifest.d.ts +63 -0
- package/esm/src/utils/bundle-manifest.d.ts.map +1 -0
- package/esm/src/utils/bundle-manifest.js +96 -0
- package/esm/src/utils/constants/buffers.d.ts +24 -0
- package/esm/src/utils/constants/buffers.d.ts.map +1 -0
- package/esm/src/utils/constants/buffers.js +23 -0
- package/esm/src/utils/constants/build.d.ts +8 -0
- package/esm/src/utils/constants/build.d.ts.map +1 -0
- package/esm/src/utils/constants/build.js +7 -0
- package/esm/src/utils/constants/cache.d.ts +74 -0
- package/esm/src/utils/constants/cache.d.ts.map +1 -0
- package/esm/src/utils/constants/cache.js +133 -0
- package/esm/src/utils/constants/cdn.d.ts +29 -0
- package/esm/src/utils/constants/cdn.d.ts.map +1 -0
- package/esm/src/utils/constants/cdn.js +58 -0
- package/esm/src/utils/constants/crypto.d.ts +10 -0
- package/esm/src/utils/constants/crypto.d.ts.map +1 -0
- package/esm/src/utils/constants/crypto.js +9 -0
- package/esm/src/utils/constants/env.d.ts +16 -0
- package/esm/src/utils/constants/env.d.ts.map +1 -0
- package/esm/src/utils/constants/env.js +20 -0
- package/esm/src/utils/constants/hash.d.ts +5 -0
- package/esm/src/utils/constants/hash.d.ts.map +1 -0
- package/esm/src/utils/constants/hash.js +4 -0
- package/esm/src/utils/constants/hmr.d.ts +24 -0
- package/esm/src/utils/constants/hmr.d.ts.map +1 -0
- package/esm/src/utils/constants/hmr.js +26 -0
- package/esm/src/utils/constants/html.d.ts +13 -0
- package/esm/src/utils/constants/html.d.ts.map +1 -0
- package/esm/src/utils/constants/html.js +12 -0
- package/esm/src/utils/constants/http.d.ts +77 -0
- package/esm/src/utils/constants/http.d.ts.map +1 -0
- package/esm/src/utils/constants/http.js +76 -0
- package/esm/src/utils/constants/index.d.ts +23 -0
- package/esm/src/utils/constants/index.d.ts.map +1 -0
- package/esm/src/utils/constants/index.js +22 -0
- package/esm/src/utils/constants/limits.d.ts +27 -0
- package/esm/src/utils/constants/limits.d.ts.map +1 -0
- package/esm/src/utils/constants/limits.js +26 -0
- package/esm/src/utils/constants/metrics.d.ts +10 -0
- package/esm/src/utils/constants/metrics.d.ts.map +1 -0
- package/esm/src/utils/constants/metrics.js +34 -0
- package/esm/src/utils/constants/network.d.ts +23 -0
- package/esm/src/utils/constants/network.d.ts.map +1 -0
- package/esm/src/utils/constants/network.js +27 -0
- package/esm/src/utils/constants/priorities.d.ts +31 -0
- package/esm/src/utils/constants/priorities.d.ts.map +1 -0
- package/esm/src/utils/constants/priorities.js +30 -0
- package/esm/src/utils/constants/retry.d.ts +14 -0
- package/esm/src/utils/constants/retry.d.ts.map +1 -0
- package/esm/src/utils/constants/retry.js +13 -0
- package/esm/src/utils/constants/security.d.ts +16 -0
- package/esm/src/utils/constants/security.d.ts.map +1 -0
- package/esm/src/utils/constants/security.js +15 -0
- package/esm/src/utils/constants/server.d.ts +107 -0
- package/esm/src/utils/constants/server.d.ts.map +1 -0
- package/esm/src/utils/constants/server.js +120 -0
- package/esm/src/utils/feature-flags.d.ts +7 -0
- package/esm/src/utils/feature-flags.d.ts.map +1 -0
- package/esm/src/utils/feature-flags.js +8 -0
- package/esm/src/utils/hash-utils.d.ts +19 -0
- package/esm/src/utils/hash-utils.d.ts.map +1 -0
- package/esm/src/utils/hash-utils.js +42 -0
- package/esm/src/utils/import-lockfile.d.ts +52 -0
- package/esm/src/utils/import-lockfile.d.ts.map +1 -0
- package/esm/src/utils/import-lockfile.js +187 -0
- package/esm/src/utils/index.d.ts +27 -0
- package/esm/src/utils/index.d.ts.map +1 -0
- package/esm/src/utils/index.js +25 -0
- package/esm/src/utils/logger/components.d.ts +73 -0
- package/esm/src/utils/logger/components.d.ts.map +1 -0
- package/esm/src/utils/logger/components.js +81 -0
- package/esm/src/utils/logger/core.d.ts +73 -0
- package/esm/src/utils/logger/core.d.ts.map +1 -0
- package/esm/src/utils/logger/core.js +143 -0
- package/esm/src/utils/logger/index.d.ts +10 -0
- package/esm/src/utils/logger/index.d.ts.map +1 -0
- package/esm/src/utils/logger/index.js +9 -0
- package/esm/src/utils/logger/logger.d.ts +166 -0
- package/esm/src/utils/logger/logger.d.ts.map +1 -0
- package/esm/src/utils/logger/logger.js +445 -0
- package/esm/src/utils/logger/redact.d.ts +74 -0
- package/esm/src/utils/logger/redact.d.ts.map +1 -0
- package/esm/src/utils/logger/redact.js +294 -0
- package/esm/src/utils/logger/request-context.d.ts +27 -0
- package/esm/src/utils/logger/request-context.d.ts.map +1 -0
- package/esm/src/utils/logger/request-context.js +28 -0
- package/esm/src/utils/memoize.d.ts +19 -0
- package/esm/src/utils/memoize.d.ts.map +1 -0
- package/esm/src/utils/memoize.js +72 -0
- package/esm/src/utils/parallel.d.ts +25 -0
- package/esm/src/utils/parallel.d.ts.map +1 -0
- package/esm/src/utils/parallel.js +91 -0
- package/esm/src/utils/path-utils.d.ts +34 -0
- package/esm/src/utils/path-utils.d.ts.map +1 -0
- package/esm/src/utils/path-utils.js +138 -0
- package/esm/src/utils/perf-timer.d.ts +11 -0
- package/esm/src/utils/perf-timer.d.ts.map +1 -0
- package/esm/src/utils/perf-timer.js +114 -0
- package/esm/src/utils/platform.d.ts +9 -0
- package/esm/src/utils/platform.d.ts.map +1 -0
- package/esm/src/utils/platform.js +20 -0
- package/esm/src/utils/runtime-guards.d.ts +29 -0
- package/esm/src/utils/runtime-guards.d.ts.map +1 -0
- package/esm/src/utils/runtime-guards.js +23 -0
- package/esm/src/utils/version-constant.d.ts +3 -0
- package/esm/src/utils/version-constant.d.ts.map +1 -0
- package/esm/src/utils/version-constant.js +4 -0
- package/esm/src/utils/version.d.ts +17 -0
- package/esm/src/utils/version.d.ts.map +1 -0
- package/esm/src/utils/version.js +36 -0
- package/package.json +80 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin in-process shim for `@opentelemetry/api`.
|
|
3
|
+
*
|
|
4
|
+
* Core files that previously imported directly from `@opentelemetry/api` now
|
|
5
|
+
* import from this module. When the `ext-observability-opentelemetry` extension is present
|
|
6
|
+
* the real SDK provider is wired in via `setGlobalTracerProvider`; otherwise
|
|
7
|
+
* every call falls back to a no-op implementation so the core boots without the
|
|
8
|
+
* extension installed.
|
|
9
|
+
*
|
|
10
|
+
* **Tracing types and constants** (exported for call-site use):
|
|
11
|
+
* `Span`, `Tracer`, `TracerProvider`, `Context`, `TextMapPropagator`
|
|
12
|
+
* `SpanKind`, `SpanStatusCode`
|
|
13
|
+
*
|
|
14
|
+
* **Metrics types** (re-exported structural shapes for the metrics subsystem;
|
|
15
|
+
* not backed by a live SDK — the metrics subsystem is wired separately):
|
|
16
|
+
* `Meter`, `Counter`, `Histogram`, `ObservableGauge`, `UpDownCounter`,
|
|
17
|
+
* `ObservableResult`
|
|
18
|
+
*
|
|
19
|
+
* @module observability/tracing/api-shim
|
|
20
|
+
*/
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Span kind + status constants
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
export const SpanKind = {
|
|
25
|
+
INTERNAL: 0,
|
|
26
|
+
SERVER: 1,
|
|
27
|
+
CLIENT: 2,
|
|
28
|
+
PRODUCER: 3,
|
|
29
|
+
CONSUMER: 4,
|
|
30
|
+
};
|
|
31
|
+
export const SpanStatusCode = {
|
|
32
|
+
UNSET: 0,
|
|
33
|
+
OK: 1,
|
|
34
|
+
ERROR: 2,
|
|
35
|
+
};
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// No-op provider (default when ext-observability-opentelemetry is not installed)
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
function createNoopContext() {
|
|
40
|
+
return {
|
|
41
|
+
getValue: () => undefined,
|
|
42
|
+
setValue(_key, _value) {
|
|
43
|
+
return this;
|
|
44
|
+
},
|
|
45
|
+
deleteValue(_key) {
|
|
46
|
+
return this;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const NOOP_CONTEXT = createNoopContext();
|
|
51
|
+
const NOOP_SPAN_CONTEXT = {
|
|
52
|
+
traceId: "00000000000000000000000000000000",
|
|
53
|
+
spanId: "0000000000000000",
|
|
54
|
+
traceFlags: 0,
|
|
55
|
+
};
|
|
56
|
+
const NOOP_SPAN = {
|
|
57
|
+
setAttribute() {
|
|
58
|
+
return NOOP_SPAN;
|
|
59
|
+
},
|
|
60
|
+
setAttributes() {
|
|
61
|
+
return NOOP_SPAN;
|
|
62
|
+
},
|
|
63
|
+
setStatus() {
|
|
64
|
+
return NOOP_SPAN;
|
|
65
|
+
},
|
|
66
|
+
recordException() { },
|
|
67
|
+
addEvent() {
|
|
68
|
+
return NOOP_SPAN;
|
|
69
|
+
},
|
|
70
|
+
end() { },
|
|
71
|
+
spanContext() {
|
|
72
|
+
return NOOP_SPAN_CONTEXT;
|
|
73
|
+
},
|
|
74
|
+
updateName() { },
|
|
75
|
+
};
|
|
76
|
+
function createNoopTracer() {
|
|
77
|
+
return {
|
|
78
|
+
startSpan() {
|
|
79
|
+
return NOOP_SPAN;
|
|
80
|
+
},
|
|
81
|
+
startActiveSpan(_name, optionsOrFn, contextOrFn, fn) {
|
|
82
|
+
const callback = typeof optionsOrFn === "function"
|
|
83
|
+
? optionsOrFn
|
|
84
|
+
: typeof contextOrFn === "function"
|
|
85
|
+
? contextOrFn
|
|
86
|
+
: fn;
|
|
87
|
+
return callback(NOOP_SPAN);
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function createNoopProvider() {
|
|
92
|
+
const noopTracer = createNoopTracer();
|
|
93
|
+
return { getTracer: () => noopTracer };
|
|
94
|
+
}
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
// Global provider state
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
let _provider = createNoopProvider();
|
|
99
|
+
let _providerRevision = 0;
|
|
100
|
+
let _activeContext = NOOP_CONTEXT;
|
|
101
|
+
let _propagator = null;
|
|
102
|
+
/**
|
|
103
|
+
* Optional accessor for the currently active span. Wired by
|
|
104
|
+
* ext-observability-opentelemetry (via `setGlobalActiveSpanAccessor`) so `trace.getActiveSpan()`
|
|
105
|
+
* and `trace.getSpan()` return the real SDK span once the extension is active.
|
|
106
|
+
*/
|
|
107
|
+
let _activeSpanAccessor = null;
|
|
108
|
+
/**
|
|
109
|
+
* Register the real OTel trace API's span accessors. Called by the
|
|
110
|
+
* ext-observability-opentelemetry extension after it wires the SDK so that the shim's
|
|
111
|
+
* `trace.getActiveSpan()` / `trace.getSpan()` can return real spans.
|
|
112
|
+
*/
|
|
113
|
+
export function setGlobalActiveSpanAccessor(accessor) {
|
|
114
|
+
_activeSpanAccessor = accessor;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Wire in the real SDK TracerProvider.
|
|
118
|
+
* Called from `src/server/bootstrap.ts` after `orchestrateExtensions()` runs.
|
|
119
|
+
*/
|
|
120
|
+
export function setGlobalTracerProvider(p) {
|
|
121
|
+
_provider = p;
|
|
122
|
+
_providerRevision++;
|
|
123
|
+
}
|
|
124
|
+
export function getGlobalTracerProvider() {
|
|
125
|
+
return _provider;
|
|
126
|
+
}
|
|
127
|
+
export function getTracerProviderRevision() {
|
|
128
|
+
return _providerRevision;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get a tracer from the active provider.
|
|
132
|
+
* Returns the no-op tracer when ext-observability-opentelemetry is not installed.
|
|
133
|
+
*/
|
|
134
|
+
export function getTracer(name, version) {
|
|
135
|
+
return _provider.getTracer(name, version);
|
|
136
|
+
}
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
// Context API
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
export const context = {
|
|
141
|
+
active() {
|
|
142
|
+
return _activeContext;
|
|
143
|
+
},
|
|
144
|
+
with(ctx, fn) {
|
|
145
|
+
const prev = _activeContext;
|
|
146
|
+
_activeContext = ctx;
|
|
147
|
+
try {
|
|
148
|
+
return fn();
|
|
149
|
+
}
|
|
150
|
+
finally {
|
|
151
|
+
_activeContext = prev;
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
setGlobalContextManager(_mgr) {
|
|
155
|
+
// no-op in shim; real SDK sets this via the real OTel API
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
// Trace API (simplified subset used by core)
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
export const trace = {
|
|
162
|
+
getTracer(name, version) {
|
|
163
|
+
return _provider.getTracer(name, version);
|
|
164
|
+
},
|
|
165
|
+
setGlobalTracerProvider(p) {
|
|
166
|
+
_provider = p;
|
|
167
|
+
_providerRevision++;
|
|
168
|
+
},
|
|
169
|
+
getGlobalTracerProvider() {
|
|
170
|
+
return _provider;
|
|
171
|
+
},
|
|
172
|
+
setSpan(ctx, _span) {
|
|
173
|
+
return ctx;
|
|
174
|
+
},
|
|
175
|
+
getSpan(ctx) {
|
|
176
|
+
return _activeSpanAccessor?.getSpan(ctx);
|
|
177
|
+
},
|
|
178
|
+
getActiveSpan() {
|
|
179
|
+
return _activeSpanAccessor?.getActiveSpan();
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
// ---------------------------------------------------------------------------
|
|
183
|
+
// Propagation API
|
|
184
|
+
// ---------------------------------------------------------------------------
|
|
185
|
+
export const propagation = {
|
|
186
|
+
setGlobalPropagator(p) {
|
|
187
|
+
_propagator = p;
|
|
188
|
+
},
|
|
189
|
+
extract(ctx, carrier, getter) {
|
|
190
|
+
if (!_propagator)
|
|
191
|
+
return ctx;
|
|
192
|
+
return _propagator.extract(ctx, carrier, getter);
|
|
193
|
+
},
|
|
194
|
+
inject(ctx, carrier, setter) {
|
|
195
|
+
if (!_propagator)
|
|
196
|
+
return;
|
|
197
|
+
_propagator.inject(ctx, carrier, setter);
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
// ---------------------------------------------------------------------------
|
|
201
|
+
// defaultTextMapGetter / defaultTextMapSetter (used by proxy/tracing.ts)
|
|
202
|
+
// ---------------------------------------------------------------------------
|
|
203
|
+
export const defaultTextMapGetter = {
|
|
204
|
+
keys(carrier) {
|
|
205
|
+
return Object.keys(carrier);
|
|
206
|
+
},
|
|
207
|
+
get(carrier, key) {
|
|
208
|
+
return carrier[key];
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
export const defaultTextMapSetter = {
|
|
212
|
+
set(carrier, key, value) {
|
|
213
|
+
carrier[key] = value;
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
// ---------------------------------------------------------------------------
|
|
217
|
+
// Metrics API registry (injected by ext-observability-opentelemetry when active)
|
|
218
|
+
// ---------------------------------------------------------------------------
|
|
219
|
+
let _metricsApi = null;
|
|
220
|
+
/**
|
|
221
|
+
* Register the OTel Metrics API (from the SDK).
|
|
222
|
+
* Called by ext-observability-opentelemetry in its setup hook so the metrics subsystem
|
|
223
|
+
* can use `getMeter()` when available.
|
|
224
|
+
*/
|
|
225
|
+
export function setGlobalMetricsAPI(api) {
|
|
226
|
+
_metricsApi = api;
|
|
227
|
+
}
|
|
228
|
+
export function getGlobalMetricsAPI() {
|
|
229
|
+
return _metricsApi;
|
|
230
|
+
}
|
|
231
|
+
// ---------------------------------------------------------------------------
|
|
232
|
+
// Reset for tests
|
|
233
|
+
// ---------------------------------------------------------------------------
|
|
234
|
+
export function _resetShimForTests() {
|
|
235
|
+
_provider = createNoopProvider();
|
|
236
|
+
_providerRevision++;
|
|
237
|
+
_activeContext = NOOP_CONTEXT;
|
|
238
|
+
_propagator = null;
|
|
239
|
+
_metricsApi = null;
|
|
240
|
+
_activeSpanAccessor = null;
|
|
241
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**************************
|
|
2
|
+
* OpenTelemetry OTLP Setup
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper that delegates to the `ext-observability-opentelemetry` extension via the
|
|
5
|
+
* `TracingExporter` contract. When the extension is not installed, all span
|
|
6
|
+
* operations silently no-op.
|
|
7
|
+
*
|
|
8
|
+
* Reads configuration from environment variables:
|
|
9
|
+
* - OTEL_TRACES_ENABLED: "true" to enable tracing
|
|
10
|
+
* - OTEL_SERVICE_NAME: Service name for traces
|
|
11
|
+
* - OTEL_EXPORTER_OTLP_ENDPOINT: OTLP endpoint
|
|
12
|
+
* - OTEL_EXPORTER_OTLP_HEADERS: Auth headers
|
|
13
|
+
**************************/
|
|
14
|
+
import { type Context, type Span } from "./api-shim.js";
|
|
15
|
+
/** Configuration used by otlpconfig. */
|
|
16
|
+
export interface OTLPConfig {
|
|
17
|
+
serviceName: string;
|
|
18
|
+
endpoint: string;
|
|
19
|
+
headers?: Record<string, string>;
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** Initialize OTLP tracing export. */
|
|
23
|
+
export declare function initializeOTLP(): Promise<void>;
|
|
24
|
+
/** Shut down OTLP tracing export. */
|
|
25
|
+
export declare function shutdownOTLP(): Promise<void>;
|
|
26
|
+
/** Check whether OTLP export is enabled. */
|
|
27
|
+
export declare function isOTLPEnabled(): boolean;
|
|
28
|
+
/** Initialize OTLP tracing with explicit API adapters. */
|
|
29
|
+
export declare function initializeOTLPWithApis(): Promise<void>;
|
|
30
|
+
/** Applies span. */
|
|
31
|
+
export declare function withSpan<T>(name: string, fn: () => Promise<T>, attributes?: Record<string, string | number | boolean>): Promise<T>;
|
|
32
|
+
/** Applies span sync. */
|
|
33
|
+
export declare function withSpanSync<T>(name: string, fn: () => T, attributes?: Record<string, string | number | boolean>): T;
|
|
34
|
+
/** Context for extract. */
|
|
35
|
+
export declare function extractContext(headers: Headers): Context | undefined;
|
|
36
|
+
/** Context for inject. */
|
|
37
|
+
export declare function injectContext(headers: Headers): void;
|
|
38
|
+
/** Starts server span. */
|
|
39
|
+
export declare function startServerSpan(method: string, path: string, parentContext?: unknown): {
|
|
40
|
+
span: Span;
|
|
41
|
+
context: Context;
|
|
42
|
+
} | null;
|
|
43
|
+
/** End an active server tracing span. */
|
|
44
|
+
export declare function endServerSpan(span: unknown, statusCode: number, error?: Error): void;
|
|
45
|
+
/** Sets span attributes. */
|
|
46
|
+
export declare function setSpanAttributes(span: unknown, attributes: Record<string, string | number | boolean>): void;
|
|
47
|
+
/** Sets active span attributes. */
|
|
48
|
+
export declare function setActiveSpanAttributes(attributes: Record<string, string | number | boolean>): void;
|
|
49
|
+
/** Context for with. */
|
|
50
|
+
export declare function withContext<T>(spanContext: unknown, fn: () => Promise<T>): Promise<T>;
|
|
51
|
+
/** Context for get trace. */
|
|
52
|
+
export declare function getTraceContext(): {
|
|
53
|
+
traceId?: string;
|
|
54
|
+
spanId?: string;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=otlp-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otlp-setup.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/tracing/otlp-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;4BAY4B;AAI5B,OAAO,EACL,KAAK,OAAO,EAOZ,KAAK,IAAI,EAKV,MAAM,eAAe,CAAC;AAKvB,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;CAClB;AA6DD,sCAAsC;AACtC,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CASpD;AAED,qCAAqC;AACrC,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAGlD;AAED,4CAA4C;AAC5C,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED,0DAA0D;AAC1D,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5D;AAcD,oBAAoB;AACpB,wBAAsB,QAAQ,CAAC,CAAC,EAC9B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACrD,OAAO,CAAC,CAAC,CAAC,CAsBZ;AAED,yBAAyB;AACzB,wBAAgB,YAAY,CAAC,CAAC,EAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,CAAC,EACX,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACrD,CAAC,CAoBH;AAED,2BAA2B;AAC3B,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAKpE;AAED,0BAA0B;AAC1B,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAIpD;AAED,0BAA0B;AAC1B,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,aAAa,CAAC,EAAE,OAAO,GACtB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CASzC;AAED,yCAAyC;AACzC,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAoBpF;AAED,4BAA4B;AAC5B,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACpD,IAAI,CAKN;AAED,mCAAmC;AACnC,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACpD,IAAI,CAKN;AAED,wBAAwB;AACxB,wBAAsB,WAAW,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE3F;AAED,6BAA6B;AAC7B,wBAAgB,eAAe,IAAI;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAMvE"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**************************
|
|
2
|
+
* OpenTelemetry OTLP Setup
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper that delegates to the `ext-observability-opentelemetry` extension via the
|
|
5
|
+
* `TracingExporter` contract. When the extension is not installed, all span
|
|
6
|
+
* operations silently no-op.
|
|
7
|
+
*
|
|
8
|
+
* Reads configuration from environment variables:
|
|
9
|
+
* - OTEL_TRACES_ENABLED: "true" to enable tracing
|
|
10
|
+
* - OTEL_SERVICE_NAME: Service name for traces
|
|
11
|
+
* - OTEL_EXPORTER_OTLP_ENDPOINT: OTLP endpoint
|
|
12
|
+
* - OTEL_EXPORTER_OTLP_HEADERS: Auth headers
|
|
13
|
+
**************************/
|
|
14
|
+
import { isTruthyEnvValue } from "../../utils/constants/env.js";
|
|
15
|
+
import { serverLogger } from "../../utils/logger/logger.js";
|
|
16
|
+
import { context as shimContext, defaultTextMapGetter, defaultTextMapSetter, getTracer, getTracerProviderRevision, propagation as shimPropagation, SpanKind, SpanStatusCode, trace as shimTrace, } from "./api-shim.js";
|
|
17
|
+
import { getHostTelemetryEnv } from "./telemetry-env.js";
|
|
18
|
+
const logger = serverLogger.component("otel");
|
|
19
|
+
function parseHeaders(headerString) {
|
|
20
|
+
if (!headerString)
|
|
21
|
+
return {};
|
|
22
|
+
if (headerString.startsWith("Basic "))
|
|
23
|
+
return { Authorization: headerString };
|
|
24
|
+
if (headerString.startsWith("Authorization=")) {
|
|
25
|
+
return { Authorization: headerString.substring("Authorization=".length) };
|
|
26
|
+
}
|
|
27
|
+
const headers = {};
|
|
28
|
+
for (const part of headerString.split(",")) {
|
|
29
|
+
const [key, ...valueParts] = part.split("=");
|
|
30
|
+
if (!key || valueParts.length === 0)
|
|
31
|
+
continue;
|
|
32
|
+
headers[key.trim()] = valueParts.join("=").trim();
|
|
33
|
+
}
|
|
34
|
+
return headers;
|
|
35
|
+
}
|
|
36
|
+
function getConfig() {
|
|
37
|
+
// Span helpers can run during module initialization and test setup, before
|
|
38
|
+
// bootstrap has loaded .env files. Read tracing env directly here so no-op
|
|
39
|
+
// spans do not force early EnvironmentConfig initialization.
|
|
40
|
+
return {
|
|
41
|
+
enabled: isTruthyEnvValue(getHostTelemetryEnv("VERYFRONT_OTEL")) ||
|
|
42
|
+
isTruthyEnvValue(getHostTelemetryEnv("OTEL_TRACES_ENABLED")),
|
|
43
|
+
serviceName: getHostTelemetryEnv("OTEL_SERVICE_NAME") || "veryfront",
|
|
44
|
+
endpoint: getHostTelemetryEnv("OTEL_EXPORTER_OTLP_ENDPOINT") || "",
|
|
45
|
+
headers: parseHeaders(getHostTelemetryEnv("OTEL_EXPORTER_OTLP_HEADERS")),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
let cachedTracingRuntime;
|
|
49
|
+
function getTracingRuntime() {
|
|
50
|
+
const providerRevision = getTracerProviderRevision();
|
|
51
|
+
if (!cachedTracingRuntime || cachedTracingRuntime.providerRevision !== providerRevision) {
|
|
52
|
+
const config = getConfig();
|
|
53
|
+
cachedTracingRuntime = {
|
|
54
|
+
providerRevision,
|
|
55
|
+
config,
|
|
56
|
+
tracer: getTracer(config.serviceName),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return cachedTracingRuntime;
|
|
60
|
+
}
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// Legacy initialise / shutdown (now delegated to bootstrap.ts + ext)
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
let initialized = false;
|
|
65
|
+
/** Initialize OTLP tracing export. */
|
|
66
|
+
export async function initializeOTLP() {
|
|
67
|
+
if (initialized) {
|
|
68
|
+
logger.debug("Already initialized");
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// Actual provider setup is handled by ext-observability-opentelemetry via bootstrap.
|
|
72
|
+
// This is kept for backward compatibility.
|
|
73
|
+
initialized = true;
|
|
74
|
+
logger.debug("OTLP setup delegated to ext-observability-opentelemetry extension");
|
|
75
|
+
}
|
|
76
|
+
/** Shut down OTLP tracing export. */
|
|
77
|
+
export async function shutdownOTLP() {
|
|
78
|
+
// Actual shutdown is handled by the extension loader teardown.
|
|
79
|
+
logger.debug("OTLP shutdown delegated to ext-observability-opentelemetry extension");
|
|
80
|
+
}
|
|
81
|
+
/** Check whether OTLP export is enabled. */
|
|
82
|
+
export function isOTLPEnabled() {
|
|
83
|
+
return initialized;
|
|
84
|
+
}
|
|
85
|
+
/** Initialize OTLP tracing with explicit API adapters. */
|
|
86
|
+
export async function initializeOTLPWithApis() {
|
|
87
|
+
await initializeOTLP();
|
|
88
|
+
}
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// Span helpers — delegate to shim (which delegates to SDK if wired)
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
function setSpanErrorStatus(span, error) {
|
|
93
|
+
span.setStatus({
|
|
94
|
+
code: SpanStatusCode.ERROR,
|
|
95
|
+
message: error instanceof Error ? error.message : String(error),
|
|
96
|
+
});
|
|
97
|
+
if (error instanceof Error)
|
|
98
|
+
span.recordException(error);
|
|
99
|
+
}
|
|
100
|
+
/** Applies span. */
|
|
101
|
+
export async function withSpan(name, fn, attributes) {
|
|
102
|
+
const { tracer } = getTracingRuntime();
|
|
103
|
+
const parentContext = shimContext.active();
|
|
104
|
+
const span = tracer.startSpan(name, { kind: SpanKind.INTERNAL, attributes }, parentContext);
|
|
105
|
+
const spanContext = shimTrace.setSpan(parentContext, span);
|
|
106
|
+
try {
|
|
107
|
+
const result = await shimContext.with(spanContext, fn);
|
|
108
|
+
span.setStatus({ code: SpanStatusCode.OK });
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
setSpanErrorStatus(span, error);
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
span.end();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** Applies span sync. */
|
|
120
|
+
export function withSpanSync(name, fn, attributes) {
|
|
121
|
+
const { tracer } = getTracingRuntime();
|
|
122
|
+
const parentContext = shimContext.active();
|
|
123
|
+
const span = tracer.startSpan(name, { kind: SpanKind.INTERNAL, attributes }, parentContext);
|
|
124
|
+
try {
|
|
125
|
+
const result = fn();
|
|
126
|
+
span.setStatus({ code: SpanStatusCode.OK });
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
setSpanErrorStatus(span, error);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
span.end();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** Context for extract. */
|
|
138
|
+
export function extractContext(headers) {
|
|
139
|
+
const carrier = {};
|
|
140
|
+
for (const [k, v] of headers)
|
|
141
|
+
carrier[k.toLowerCase()] = v;
|
|
142
|
+
return shimPropagation.extract(shimContext.active(), carrier, defaultTextMapGetter);
|
|
143
|
+
}
|
|
144
|
+
/** Context for inject. */
|
|
145
|
+
export function injectContext(headers) {
|
|
146
|
+
const carrier = {};
|
|
147
|
+
shimPropagation.inject(shimContext.active(), carrier, defaultTextMapSetter);
|
|
148
|
+
for (const [k, v] of Object.entries(carrier))
|
|
149
|
+
headers.set(k, v);
|
|
150
|
+
}
|
|
151
|
+
/** Starts server span. */
|
|
152
|
+
export function startServerSpan(method, path, parentContext) {
|
|
153
|
+
const { tracer } = getTracingRuntime();
|
|
154
|
+
const ctx = (parentContext || shimContext.active());
|
|
155
|
+
const span = tracer.startSpan(`${method} ${path}`, { kind: SpanKind.SERVER }, ctx);
|
|
156
|
+
span.setAttribute("http.method", method);
|
|
157
|
+
span.setAttribute("http.target", path);
|
|
158
|
+
return { span, context: shimTrace.setSpan(ctx, span) };
|
|
159
|
+
}
|
|
160
|
+
/** End an active server tracing span. */
|
|
161
|
+
export function endServerSpan(span, statusCode, error) {
|
|
162
|
+
if (!span)
|
|
163
|
+
return;
|
|
164
|
+
const otelSpan = span;
|
|
165
|
+
otelSpan.setAttribute("http.status_code", statusCode);
|
|
166
|
+
if (error) {
|
|
167
|
+
setSpanErrorStatus(otelSpan, error);
|
|
168
|
+
otelSpan.end();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (statusCode >= 400) {
|
|
172
|
+
otelSpan.setStatus({ code: SpanStatusCode.ERROR });
|
|
173
|
+
otelSpan.end();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
otelSpan.setStatus({ code: SpanStatusCode.OK });
|
|
177
|
+
otelSpan.end();
|
|
178
|
+
}
|
|
179
|
+
/** Sets span attributes. */
|
|
180
|
+
export function setSpanAttributes(span, attributes) {
|
|
181
|
+
if (!span)
|
|
182
|
+
return;
|
|
183
|
+
const otelSpan = span;
|
|
184
|
+
for (const [key, value] of Object.entries(attributes))
|
|
185
|
+
otelSpan.setAttribute(key, value);
|
|
186
|
+
}
|
|
187
|
+
/** Sets active span attributes. */
|
|
188
|
+
export function setActiveSpanAttributes(attributes) {
|
|
189
|
+
const span = shimTrace.getActiveSpan?.();
|
|
190
|
+
if (!span)
|
|
191
|
+
return;
|
|
192
|
+
for (const [key, value] of Object.entries(attributes))
|
|
193
|
+
span.setAttribute(key, value);
|
|
194
|
+
}
|
|
195
|
+
/** Context for with. */
|
|
196
|
+
export async function withContext(spanContext, fn) {
|
|
197
|
+
return shimContext.with(spanContext, fn);
|
|
198
|
+
}
|
|
199
|
+
/** Context for get trace. */
|
|
200
|
+
export function getTraceContext() {
|
|
201
|
+
const span = shimTrace.getActiveSpan?.();
|
|
202
|
+
if (!span)
|
|
203
|
+
return {};
|
|
204
|
+
const ctx = span.spanContext();
|
|
205
|
+
return { traceId: ctx.traceId, spanId: ctx.spanId };
|
|
206
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-env.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/tracing/telemetry-env.ts"],"names":[],"mappings":"AAMA,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEnE;AAED,wBAAgB,sCAAsC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE3E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getHostEnv } from "../../platform/compat/process.js";
|
|
2
|
+
const RESERVED_SHARED_RUNTIME_TELEMETRY_ENV_KEYS = new Set([
|
|
3
|
+
"VERYFRONT_OTEL",
|
|
4
|
+
]);
|
|
5
|
+
export function getHostTelemetryEnv(key) {
|
|
6
|
+
return getHostEnv(key);
|
|
7
|
+
}
|
|
8
|
+
export function isReservedSharedRuntimeTelemetryEnvKey(key) {
|
|
9
|
+
return key.startsWith("OTEL_") || RESERVED_SHARED_RUNTIME_TELEMETRY_ENV_KEYS.has(key);
|
|
10
|
+
}
|