dd-trace 6.16.0 → 6.17.0
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/ci/diagnose.js +0 -23
- package/ci/test-optimization-validation/approval-artifacts.js +0 -3
- package/ci/test-optimization-validation/approval.js +0 -6
- package/ci/test-optimization-validation/artifact-id.js +0 -1
- package/ci/test-optimization-validation/bounded-json.js +0 -1
- package/ci/test-optimization-validation/cli.js +0 -12
- package/ci/test-optimization-validation/command-output-policy.js +0 -1
- package/ci/test-optimization-validation/command-runner.js +0 -3
- package/ci/test-optimization-validation/environment.js +0 -4
- package/ci/test-optimization-validation/executable-approval.js +0 -1
- package/ci/test-optimization-validation/executable.js +0 -5
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +0 -6
- package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -3
- package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -6
- package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -4
- package/ci/test-optimization-validation/generated-test-contract.js +0 -5
- package/ci/test-optimization-validation/generated-verifier.js +0 -1
- package/ci/test-optimization-validation/literal-environment.js +0 -1
- package/ci/test-optimization-validation/manifest-scaffold.js +0 -17
- package/ci/test-optimization-validation/manifest-schema.js +0 -21
- package/ci/test-optimization-validation/offline-fixtures.js +0 -4
- package/ci/test-optimization-validation/plan-writer.js +0 -11
- package/ci/test-optimization-validation/preflight-runner.js +0 -1
- package/ci/test-optimization-validation/redaction.js +0 -4
- package/ci/test-optimization-validation/report-writer.js +0 -16
- package/ci/test-optimization-validation/runner-command.js +0 -3
- package/ci/test-optimization-validation/runner-contract.js +0 -4
- package/ci/test-optimization-validation/safe-files.js +0 -1
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -1
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +0 -1
- package/ci/test-optimization-validation/source-text.js +0 -3
- package/ci/vitest-no-worker-init-setup.mjs +41 -16
- package/index.d.ts +165 -0
- package/package.json +17 -16
- package/packages/datadog-esbuild/src/utils.js +0 -2
- package/packages/datadog-instrumentations/src/aerospike.js +28 -6
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +0 -2
- package/packages/datadog-instrumentations/src/aws-sdk.js +0 -2
- package/packages/datadog-instrumentations/src/claude-agent-sdk.js +0 -2
- package/packages/datadog-instrumentations/src/console.js +97 -0
- package/packages/datadog-instrumentations/src/cucumber.js +72 -12
- package/packages/datadog-instrumentations/src/cypress-config.js +0 -23
- package/packages/datadog-instrumentations/src/helpers/channel.js +0 -2
- package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +0 -5
- package/packages/datadog-instrumentations/src/helpers/hooks.js +8 -0
- package/packages/datadog-instrumentations/src/helpers/instrumentation-utils.js +0 -3
- package/packages/datadog-instrumentations/src/helpers/pool-acquire.js +0 -6
- package/packages/datadog-instrumentations/src/helpers/register.js +4 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +72 -24
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +39 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +3 -17
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +12 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +36 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/supabase.js +128 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +16 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +388 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +0 -5
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +0 -1
- package/packages/datadog-instrumentations/src/jest.js +141 -51
- package/packages/datadog-instrumentations/src/knex.js +0 -1
- package/packages/datadog-instrumentations/src/mariadb-bundle.js +0 -24
- package/packages/datadog-instrumentations/src/mariadb.js +0 -2
- package/packages/datadog-instrumentations/src/mocha/common.js +0 -1
- package/packages/datadog-instrumentations/src/mocha/main.js +22 -25
- package/packages/datadog-instrumentations/src/mocha/utils.js +119 -49
- package/packages/datadog-instrumentations/src/mocha/webdriverio-protocol.js +0 -6
- package/packages/datadog-instrumentations/src/mocha/worker.js +14 -17
- package/packages/datadog-instrumentations/src/mysql2.js +0 -2
- package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +241 -0
- package/packages/datadog-instrumentations/src/openai-realtime/events.js +76 -0
- package/packages/datadog-instrumentations/src/openai-realtime/index.js +301 -0
- package/packages/datadog-instrumentations/src/openai-realtime/session.js +998 -0
- package/packages/datadog-instrumentations/src/openai-realtime/turns.js +211 -0
- package/packages/datadog-instrumentations/src/openai.js +51 -12
- package/packages/datadog-instrumentations/src/oracledb.js +9 -3
- package/packages/datadog-instrumentations/src/playwright-reporter.js +3 -16
- package/packages/datadog-instrumentations/src/playwright.js +238 -55
- package/packages/datadog-instrumentations/src/postgres.js +7 -0
- package/packages/datadog-instrumentations/src/router.js +0 -2
- package/packages/datadog-instrumentations/src/rum-browser-scripts.js +0 -2
- package/packages/datadog-instrumentations/src/sequelize.js +0 -1
- package/packages/datadog-instrumentations/src/supabase.js +15 -0
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +18 -18
- package/packages/datadog-instrumentations/src/vitest-main.js +37 -17
- package/packages/datadog-instrumentations/src/vitest-util.js +7 -1
- package/packages/datadog-instrumentations/src/vitest-worker.js +49 -13
- package/packages/datadog-instrumentations/src/webdriverio.js +23 -42
- package/packages/datadog-instrumentations/src/ws.js +0 -1
- package/packages/datadog-plugin-ai/src/utils.js +0 -2
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/trace-checkpoint.js +0 -1
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/util.js +0 -2
- package/packages/datadog-plugin-aws-sdk/src/base.js +0 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +0 -1
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +0 -1
- package/packages/datadog-plugin-aws-sdk/src/util.js +0 -1
- package/packages/datadog-plugin-azure-durable-functions/src/index.js +0 -1
- package/packages/datadog-plugin-cucumber/src/index.js +10 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +171 -75
- package/packages/datadog-plugin-cypress/src/finalization.js +0 -3
- package/packages/datadog-plugin-cypress/src/source-map-utils.js +0 -4
- package/packages/datadog-plugin-cypress/src/support.js +52 -7
- package/packages/datadog-plugin-graphql/src/resolve-error.js +1 -2
- package/packages/datadog-plugin-graphql/src/utils.js +0 -5
- package/packages/datadog-plugin-jest/src/index.js +13 -0
- package/packages/datadog-plugin-kafkajs/src/producer.js +0 -1
- package/packages/datadog-plugin-mocha/src/index.js +39 -11
- package/packages/datadog-plugin-mongodb-core/src/query.js +0 -1
- package/packages/datadog-plugin-openai/src/index.js +16 -1
- package/packages/datadog-plugin-openai/src/realtime.js +144 -0
- package/packages/datadog-plugin-openai-agents/src/integration.js +0 -4
- package/packages/datadog-plugin-openai-agents/src/util.js +0 -1
- package/packages/datadog-plugin-playwright/src/index.js +76 -9
- package/packages/datadog-plugin-postgres/src/index.js +167 -0
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +0 -1
- package/packages/datadog-plugin-redis/src/index.js +15 -1
- package/packages/datadog-plugin-supabase/src/error.js +18 -0
- package/packages/datadog-plugin-supabase/src/index.js +21 -0
- package/packages/datadog-plugin-supabase/src/supabase-auth-js-gotrueclient-getuser.js +69 -0
- package/packages/datadog-plugin-supabase/src/supabase-functions-js-functionsclient-invoke.js +70 -0
- package/packages/datadog-plugin-supabase/src/supabase-postgrest-js-postgrestbuilder-then.js +122 -0
- package/packages/datadog-plugin-supabase/src/supabase-realtime-js-realtimechannel-send.js +66 -0
- package/packages/datadog-plugin-supabase/src/supabase-storage-js-handle-request.js +93 -0
- package/packages/datadog-plugin-supabase/src/url.js +17 -0
- package/packages/datadog-plugin-vitest/src/index.js +10 -0
- package/packages/datadog-plugin-ws/src/util.js +0 -4
- package/packages/datadog-turbopack/index.js +0 -6
- package/packages/datadog-turbopack/src/loader.js +0 -16
- package/packages/datadog-webpack/src/loader.js +0 -1
- package/packages/dd-trace/src/aiguard/client.js +2 -3
- package/packages/dd-trace/src/aiguard/evaluation.js +6 -12
- package/packages/dd-trace/src/aiguard/index.js +2 -2
- package/packages/dd-trace/src/aiguard/integrations/index.js +1 -1
- package/packages/dd-trace/src/aiguard/integrations/openai.js +81 -7
- package/packages/dd-trace/src/aiguard/messages/anthropic.js +0 -2
- package/packages/dd-trace/src/aiguard/messages/openai.js +64 -1
- package/packages/dd-trace/src/aiguard/messages/utils.js +0 -1
- package/packages/dd-trace/src/aiguard/redaction.js +0 -1
- package/packages/dd-trace/src/aiguard/sdk.js +1 -1
- package/packages/dd-trace/src/appsec/activation.js +1 -1
- package/packages/dd-trace/src/appsec/api_security/normalized-route.js +0 -5
- package/packages/dd-trace/src/appsec/api_security/sampler.js +0 -4
- package/packages/dd-trace/src/appsec/blocking/index.js +3 -3
- package/packages/dd-trace/src/appsec/downstream_requests.js +1 -4
- package/packages/dd-trace/src/appsec/iast/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +5 -5
- package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +3 -3
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +8 -10
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +2 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +4 -1
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +7 -7
- package/packages/dd-trace/src/appsec/index.js +2 -2
- package/packages/dd-trace/src/appsec/lambda.js +71 -2
- package/packages/dd-trace/src/appsec/rasp/utils.js +5 -1
- package/packages/dd-trace/src/appsec/remote_config.js +8 -6
- package/packages/dd-trace/src/appsec/reporter.js +10 -6
- package/packages/dd-trace/src/appsec/rule_manager.js +3 -3
- package/packages/dd-trace/src/appsec/sdk/track_event.js +0 -2
- package/packages/dd-trace/src/appsec/waf/index.js +2 -2
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +8 -5
- package/packages/dd-trace/src/carrier.js +0 -5
- package/packages/dd-trace/src/ci-visibility/dynamic-atr-retries.js +104 -0
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +0 -2
- package/packages/dd-trace/src/ci-visibility/efd-retry-policy.js +34 -3
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -4
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +37 -15
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +0 -3
- package/packages/dd-trace/src/ci-visibility/exporters/request.js +0 -11
- package/packages/dd-trace/src/ci-visibility/exporters/settings-cache-key.js +0 -1
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +0 -1
- package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +0 -6
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +2 -2
- package/packages/dd-trace/src/ci-visibility/requests/rate-limit.js +0 -1
- package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +0 -5
- package/packages/dd-trace/src/ci-visibility/requests/video-request.js +0 -1
- package/packages/dd-trace/src/ci-visibility/telemetry.js +13 -0
- package/packages/dd-trace/src/ci-visibility/test-optimization-cache.js +0 -1
- package/packages/dd-trace/src/ci-visibility/test-screenshot.js +0 -2
- package/packages/dd-trace/src/ci-visibility/test-video.js +0 -1
- package/packages/dd-trace/src/config/defaults.js +3 -2
- package/packages/dd-trace/src/config/generated-config-types.d.ts +73 -67
- package/packages/dd-trace/src/config/helper.js +0 -1
- package/packages/dd-trace/src/config/index.js +24 -24
- package/packages/dd-trace/src/config/parsers.js +34 -6
- package/packages/dd-trace/src/config/remote_config.js +25 -109
- package/packages/dd-trace/src/config/supported-configurations.json +139 -10
- package/packages/dd-trace/src/datastreams/encoding.js +0 -1
- package/packages/dd-trace/src/datastreams/pathway.js +0 -1
- package/packages/dd-trace/src/debugger/constants.js +10 -0
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +62 -10
- package/packages/dd-trace/src/debugger/devtools_client/config.js +2 -0
- package/packages/dd-trace/src/debugger/devtools_client/guardrail-metrics.js +15 -0
- package/packages/dd-trace/src/debugger/devtools_client/index.js +103 -27
- package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +50 -7
- package/packages/dd-trace/src/debugger/devtools_client/log.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/probe_sampler.js +21 -8
- package/packages/dd-trace/src/debugger/devtools_client/send.js +40 -14
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +53 -13
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +118 -71
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +0 -3
- package/packages/dd-trace/src/debugger/devtools_client/status.js +20 -6
- package/packages/dd-trace/src/debugger/guardrail-metrics.js +167 -0
- package/packages/dd-trace/src/debugger/index.js +50 -2
- package/packages/dd-trace/src/debugger/inspect-segment.js +0 -3
- package/packages/dd-trace/src/debugger/probe_sampler.js +133 -9
- package/packages/dd-trace/src/debugger/probe_sampler_constants.js +31 -1
- package/packages/dd-trace/src/dogstatsd.js +0 -23
- package/packages/dd-trace/src/encode/0.4-cross-payload.js +0 -3
- package/packages/dd-trace/src/encode/0.4.js +0 -7
- package/packages/dd-trace/src/encode/0.5.js +0 -2
- package/packages/dd-trace/src/encode/tags-processors.js +0 -1
- package/packages/dd-trace/src/evp_proxy/discovery.js +0 -1
- package/packages/dd-trace/src/evp_proxy/path.js +0 -2
- package/packages/dd-trace/src/exporters/agent/writer.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/index.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/intake.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/writer.js +0 -3
- package/packages/dd-trace/src/exporters/common/final-flush-request-tracker.js +0 -6
- package/packages/dd-trace/src/exporters/common/request.js +1 -0
- package/packages/dd-trace/src/exporters/common/url.js +0 -2
- package/packages/dd-trace/src/exporters/common/writer.js +0 -2
- package/packages/dd-trace/src/id.js +0 -11
- package/packages/dd-trace/src/llmobs/audio-codec.js +192 -0
- package/packages/dd-trace/src/llmobs/audio-utils.js +121 -0
- package/packages/dd-trace/src/llmobs/constants/audio.js +35 -0
- package/packages/dd-trace/src/llmobs/constants/prompts.js +14 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +17 -0
- package/packages/dd-trace/src/llmobs/eval-metric.js +0 -6
- package/packages/dd-trace/src/llmobs/experiments/dataset.js +0 -4
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +0 -3
- package/packages/dd-trace/src/llmobs/experiments/index.js +7 -6
- package/packages/dd-trace/src/llmobs/experiments/util.js +1 -11
- package/packages/dd-trace/src/llmobs/index.js +1 -3
- package/packages/dd-trace/src/llmobs/noop.js +10 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +0 -4
- package/packages/dd-trace/src/llmobs/plugins/anthropic/util.js +0 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +0 -4
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +4 -6
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +285 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +16 -3
- package/packages/dd-trace/src/llmobs/prompts/cache.js +272 -0
- package/packages/dd-trace/src/llmobs/prompts/manager.js +639 -0
- package/packages/dd-trace/src/llmobs/prompts/noop.js +29 -0
- package/packages/dd-trace/src/llmobs/prompts/prompt.js +92 -0
- package/packages/dd-trace/src/llmobs/sdk.js +21 -6
- package/packages/dd-trace/src/llmobs/span_processor.js +81 -2
- package/packages/dd-trace/src/llmobs/tagger.js +30 -7
- package/packages/dd-trace/src/llmobs/telemetry.js +36 -4
- package/packages/dd-trace/src/llmobs/util.js +0 -34
- package/packages/dd-trace/src/llmobs/writers/base.js +0 -1
- package/packages/dd-trace/src/llmobs/writers/util.js +1 -2
- package/packages/dd-trace/src/log/channels.js +3 -0
- package/packages/dd-trace/src/log/index.js +23 -5
- package/packages/dd-trace/src/log-submission/log-submission-plugin.js +74 -6
- package/packages/dd-trace/src/msgpack/chunk.js +0 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +0 -12
- package/packages/dd-trace/src/openfeature/encoding.js +0 -2
- package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +0 -1
- package/packages/dd-trace/src/openfeature/index.js +0 -4
- package/packages/dd-trace/src/openfeature/span-enrichment-hook.js +0 -1
- package/packages/dd-trace/src/openfeature/span-enrichment.js +0 -4
- package/packages/dd-trace/src/openfeature/writers/base.js +0 -6
- package/packages/dd-trace/src/openfeature/writers/exposures.js +0 -5
- package/packages/dd-trace/src/openfeature/writers/util.js +0 -4
- package/packages/dd-trace/src/opentelemetry/logs/logger.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +0 -2
- package/packages/dd-trace/src/opentelemetry/metrics/meter_provider.js +0 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js +0 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +0 -1
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +1 -14
- package/packages/dd-trace/src/opentelemetry/metrics/time.js +0 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +30 -13
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +0 -1
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +0 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +0 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +0 -3
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +0 -6
- package/packages/dd-trace/src/opentracing/span_context.js +0 -1
- package/packages/dd-trace/src/otel-thread-ctx.js +38 -11
- package/packages/dd-trace/src/payload-tagging/tagging.js +15 -3
- package/packages/dd-trace/src/plugins/ci_plugin.js +0 -1
- package/packages/dd-trace/src/plugins/database.js +2 -6
- package/packages/dd-trace/src/plugins/index.js +7 -0
- package/packages/dd-trace/src/plugins/plugin.js +0 -4
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/git.js +1 -3
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +0 -1
- package/packages/dd-trace/src/plugins/util/llm.js +0 -2
- package/packages/dd-trace/src/plugins/util/status-validator.js +0 -1
- package/packages/dd-trace/src/plugins/util/test.js +21 -20
- package/packages/dd-trace/src/plugins/util/url.js +0 -5
- package/packages/dd-trace/src/priority_sampler.js +0 -6
- package/packages/dd-trace/src/process-tags/index.js +0 -1
- package/packages/dd-trace/src/profiler.js +132 -35
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +0 -1
- package/packages/dd-trace/src/profiling/profiler.js +101 -41
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +29 -15
- package/packages/dd-trace/src/propagation-hash/index.js +0 -1
- package/packages/dd-trace/src/proxy.js +21 -45
- package/packages/dd-trace/src/random_sampler.js +0 -4
- package/packages/dd-trace/src/rate_limiter.js +0 -4
- package/packages/dd-trace/src/remote_config/capabilities.js +1 -9
- package/packages/dd-trace/src/remote_config/index.js +0 -1
- package/packages/dd-trace/src/runtime_metrics/otlp_runtime_metrics.js +0 -3
- package/packages/dd-trace/src/sampler.js +0 -4
- package/packages/dd-trace/src/sampling_rule.js +0 -7
- package/packages/dd-trace/src/serverless/vercel.js +0 -1
- package/packages/dd-trace/src/serverless.js +0 -1
- package/packages/dd-trace/src/service-naming/index.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/util.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +7 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +5 -0
- package/packages/dd-trace/src/span_processor.js +2 -2
- package/packages/dd-trace/src/span_sampler.js +0 -1
- package/packages/dd-trace/src/standalone/product.js +2 -2
- package/packages/dd-trace/src/standalone/tracesource.js +0 -1
- package/packages/dd-trace/src/startup-log.js +1 -1
- package/packages/dd-trace/src/telemetry/endpoints.js +0 -8
- package/packages/dd-trace/src/telemetry/logs/index.js +16 -5
- package/packages/dd-trace/src/telemetry/logs/log-collector.js +16 -6
- package/packages/dd-trace/src/telemetry/metrics.js +0 -2
- package/packages/dd-trace/src/telemetry/telemetry.js +4 -1
- package/packages/dd-trace/src/util.js +13 -1
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { Writable } = require('node:stream')
|
|
4
|
+
const { formatWithOptions } = require('node:util')
|
|
4
5
|
|
|
6
|
+
const { channel } = require('dc-polyfill')
|
|
7
|
+
|
|
8
|
+
const { LOG } = require('../../../../ext/formats')
|
|
9
|
+
const { SPAN_TYPE } = require('../../../../ext/tags')
|
|
10
|
+
const { storage } = require('../../../datadog-core')
|
|
5
11
|
const FinalFlushRequestTracker = require('../exporters/common/final-flush-request-tracker')
|
|
6
12
|
const request = require('../exporters/common/request')
|
|
7
13
|
const log = require('../log')
|
|
@@ -11,6 +17,13 @@ const MAX_BATCH_BYTES = 5 * 1024 * 1024
|
|
|
11
17
|
const MAX_BATCH_LOGS = 1000
|
|
12
18
|
const BATCH_FLUSH_INTERVAL = 1000
|
|
13
19
|
const FINAL_FLUSH_TIMEOUT = 60_000
|
|
20
|
+
const CONSOLE_METHOD_TO_STATUS = {
|
|
21
|
+
error: 'error',
|
|
22
|
+
warn: 'warn',
|
|
23
|
+
}
|
|
24
|
+
const TEST_OPTIMIZATION_SPAN_TYPES = new Set(['test', 'test_session_end', 'test_suite_end'])
|
|
25
|
+
const consoleConfigureCh = channel('ci:log-submission:console:configure')
|
|
26
|
+
const legacyStorage = storage('legacy')
|
|
14
27
|
|
|
15
28
|
/**
|
|
16
29
|
* @returns {Error & { code: string }}
|
|
@@ -59,12 +72,36 @@ function asTracerConfig (config) {
|
|
|
59
72
|
/**
|
|
60
73
|
* @param {import('../config/config-base')} config
|
|
61
74
|
* @param {string} source
|
|
62
|
-
* @returns {string}
|
|
63
75
|
*/
|
|
64
76
|
function getLogSubmissionPath (config, source) {
|
|
65
77
|
return `/api/v2/logs?${new URLSearchParams({ ddsource: source, service: config.service })}`
|
|
66
78
|
}
|
|
67
79
|
|
|
80
|
+
/**
|
|
81
|
+
* @param {object | undefined} store
|
|
82
|
+
*/
|
|
83
|
+
function getTestOptimizationSpan (store) {
|
|
84
|
+
const activeSpan = store?.span
|
|
85
|
+
if (activeSpan && TEST_OPTIMIZATION_SPAN_TYPES.has(activeSpan.context().getTag(SPAN_TYPE))) {
|
|
86
|
+
return activeSpan
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Child instrumentation spans replace store.span, so recover the enclosing test from their trace.
|
|
90
|
+
const traceSpans = activeSpan?.context()._trace?.started
|
|
91
|
+
if (traceSpans) {
|
|
92
|
+
let nestedTestSuiteSpan
|
|
93
|
+
for (const span of traceSpans) {
|
|
94
|
+
const spanType = span.context().getTag(SPAN_TYPE)
|
|
95
|
+
if (spanType === 'test') return span
|
|
96
|
+
if (spanType === 'test_suite_end') nestedTestSuiteSpan = span
|
|
97
|
+
}
|
|
98
|
+
if (nestedTestSuiteSpan) return nestedTestSuiteSpan
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const testSuiteSpan = store?.testSuiteSpan
|
|
102
|
+
if (testSuiteSpan?.context().getTag(SPAN_TYPE) === 'test_suite_end') return testSuiteSpan
|
|
103
|
+
}
|
|
104
|
+
|
|
68
105
|
class LogSubmissionPlugin extends Plugin {
|
|
69
106
|
static id = 'log-submission'
|
|
70
107
|
|
|
@@ -79,6 +116,22 @@ class LogSubmissionPlugin extends Plugin {
|
|
|
79
116
|
#timer
|
|
80
117
|
#beforeExitHandler = () => this.#flushLogs()
|
|
81
118
|
#createWinstonJsonFormat
|
|
119
|
+
#getConsoleLogHolder = () => {
|
|
120
|
+
if (!this._enabled ||
|
|
121
|
+
!this.#logSubmissionUrl ||
|
|
122
|
+
!this.#config?.isCiVisibility ||
|
|
123
|
+
!this.#config.DD_AGENTLESS_LOG_SUBMISSION_ENABLED) return
|
|
124
|
+
|
|
125
|
+
const store = legacyStorage.getStore()
|
|
126
|
+
if (store?.noop) return
|
|
127
|
+
const span = getTestOptimizationSpan(store)
|
|
128
|
+
if (!span) return
|
|
129
|
+
|
|
130
|
+
const logHolder = {}
|
|
131
|
+
this.tracer.inject(span, LOG, logHolder)
|
|
132
|
+
return logHolder.dd ? logHolder : undefined
|
|
133
|
+
}
|
|
134
|
+
|
|
82
135
|
#winstonStreamClass
|
|
83
136
|
// Winston formats records inside its transports, not at logger.write time, so (unlike Bunyan/Pino)
|
|
84
137
|
// the instrumentation can't publish a post-format line. A Stream transport pipes format.json()
|
|
@@ -135,6 +188,20 @@ class LogSubmissionPlugin extends Plugin {
|
|
|
135
188
|
this.addSub('ci:log-submission:log', (payload) => {
|
|
136
189
|
this.#enqueueLog(payload)
|
|
137
190
|
})
|
|
191
|
+
this.addSub('ci:log-submission:console', ({ args, logHolder, method }) => {
|
|
192
|
+
let message
|
|
193
|
+
try {
|
|
194
|
+
message = formatWithOptions({}, ...args)
|
|
195
|
+
} catch (error) {
|
|
196
|
+
log.error('Could not format console log for automatic submission', error)
|
|
197
|
+
return
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
this.#enqueueLog({
|
|
201
|
+
source: 'nodejs',
|
|
202
|
+
message: { dd: logHolder.dd, message, status: CONSOLE_METHOD_TO_STATUS[method] },
|
|
203
|
+
})
|
|
204
|
+
})
|
|
138
205
|
this.addSub('ci:log-submission:flush', ({ onDone } = {}) => {
|
|
139
206
|
if (!onDone) {
|
|
140
207
|
this.#flushLogs()
|
|
@@ -149,7 +216,6 @@ class LogSubmissionPlugin extends Plugin {
|
|
|
149
216
|
|
|
150
217
|
/**
|
|
151
218
|
* @param {boolean | (Record<string, unknown> & { enabled: boolean })} config
|
|
152
|
-
* @returns {void}
|
|
153
219
|
*/
|
|
154
220
|
configure (config) {
|
|
155
221
|
if (this._enabled) this.#flushLogs()
|
|
@@ -160,6 +226,12 @@ class LogSubmissionPlugin extends Plugin {
|
|
|
160
226
|
? getLogSubmissionUrl(this.#config)
|
|
161
227
|
: undefined
|
|
162
228
|
super.configure(config)
|
|
229
|
+
if (this._enabled &&
|
|
230
|
+
this.#logSubmissionUrl &&
|
|
231
|
+
this.#config?.isCiVisibility &&
|
|
232
|
+
this.#config.DD_AGENTLESS_LOG_SUBMISSION_ENABLED) {
|
|
233
|
+
consoleConfigureCh.publish({ getLogHolder: this.#getConsoleLogHolder })
|
|
234
|
+
}
|
|
163
235
|
|
|
164
236
|
const beforeExitHandlers = globalThis[Symbol.for('dd-trace')].beforeExitHandlers
|
|
165
237
|
if (this._enabled) {
|
|
@@ -171,7 +243,6 @@ class LogSubmissionPlugin extends Plugin {
|
|
|
171
243
|
|
|
172
244
|
/**
|
|
173
245
|
* @param {{ source: string, message: string | Record<string, unknown> }} payload
|
|
174
|
-
* @returns {void}
|
|
175
246
|
*/
|
|
176
247
|
#enqueueLog ({ source, message }) {
|
|
177
248
|
if (!this.#logSubmissionUrl) return
|
|
@@ -210,9 +281,6 @@ class LogSubmissionPlugin extends Plugin {
|
|
|
210
281
|
}
|
|
211
282
|
}
|
|
212
283
|
|
|
213
|
-
/**
|
|
214
|
-
* @returns {void}
|
|
215
|
-
*/
|
|
216
284
|
#flushLogs () {
|
|
217
285
|
clearTimeout(this.#timer)
|
|
218
286
|
this.#timer = undefined
|
|
@@ -64,9 +64,6 @@ class AgentlessConfigurationSource {
|
|
|
64
64
|
this.#applyConfiguration = applyConfiguration
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
/**
|
|
68
|
-
* @returns {void}
|
|
69
|
-
*/
|
|
70
67
|
start () {
|
|
71
68
|
if (this.#abortController) return
|
|
72
69
|
|
|
@@ -75,9 +72,6 @@ class AgentlessConfigurationSource {
|
|
|
75
72
|
this.#poll(abortController)
|
|
76
73
|
}
|
|
77
74
|
|
|
78
|
-
/**
|
|
79
|
-
* @returns {void}
|
|
80
|
-
*/
|
|
81
75
|
stop () {
|
|
82
76
|
this.#abortController?.abort()
|
|
83
77
|
this.#abortController = undefined
|
|
@@ -175,7 +169,6 @@ class AgentlessConfigurationSource {
|
|
|
175
169
|
|
|
176
170
|
/**
|
|
177
171
|
* @param {PollResponse} response
|
|
178
|
-
* @returns {void}
|
|
179
172
|
*/
|
|
180
173
|
#apply (response) {
|
|
181
174
|
const statusCode = response.statusCode
|
|
@@ -218,7 +211,6 @@ class AgentlessConfigurationSource {
|
|
|
218
211
|
* @param {number | undefined} statusCode
|
|
219
212
|
* @param {unknown} error
|
|
220
213
|
* @param {number} attempts
|
|
221
|
-
* @returns {void}
|
|
222
214
|
*/
|
|
223
215
|
#warnFailure (statusCode, error, attempts) {
|
|
224
216
|
const category = statusCode === 401 || statusCode === 403
|
|
@@ -279,7 +271,6 @@ function parseConfiguration (body) {
|
|
|
279
271
|
|
|
280
272
|
/**
|
|
281
273
|
* @param {unknown} error
|
|
282
|
-
* @returns {string}
|
|
283
274
|
*/
|
|
284
275
|
function errorMessage (error) {
|
|
285
276
|
return error instanceof Error ? error.message : String(error ?? 'request was not sent')
|
|
@@ -287,7 +278,6 @@ function errorMessage (error) {
|
|
|
287
278
|
|
|
288
279
|
/**
|
|
289
280
|
* @param {number | undefined} status
|
|
290
|
-
* @returns {boolean}
|
|
291
281
|
*/
|
|
292
282
|
function isRetryableStatus (status) {
|
|
293
283
|
return status === 408 || status === 429 || (status >= 500 && status <= 599)
|
|
@@ -297,7 +287,6 @@ function isRetryableStatus (status) {
|
|
|
297
287
|
* @param {number} pollIntervalMs
|
|
298
288
|
* @param {number} attempt
|
|
299
289
|
* @param {number} random
|
|
300
|
-
* @returns {number}
|
|
301
290
|
*/
|
|
302
291
|
function retryDelay (pollIntervalMs, attempt, random) {
|
|
303
292
|
const base = attempt === 1
|
|
@@ -310,7 +299,6 @@ function retryDelay (pollIntervalMs, attempt, random) {
|
|
|
310
299
|
* @param {number} value
|
|
311
300
|
* @param {number} minimum
|
|
312
301
|
* @param {number} maximum
|
|
313
|
-
* @returns {number}
|
|
314
302
|
*/
|
|
315
303
|
function clamp (value, minimum, maximum) {
|
|
316
304
|
return Math.max(minimum, Math.min(maximum, value))
|
|
@@ -29,7 +29,6 @@ function encodeVarint (value) {
|
|
|
29
29
|
* 4. Base64 encode the result
|
|
30
30
|
*
|
|
31
31
|
* @param {Set<number>} serialIds - Set of serial IDs to encode
|
|
32
|
-
* @returns {string} Base64-encoded delta-varint string
|
|
33
32
|
*/
|
|
34
33
|
function encodeDeltaVarint (serialIds) {
|
|
35
34
|
if (!serialIds || serialIds.size === 0) {
|
|
@@ -57,7 +56,6 @@ function encodeDeltaVarint (serialIds) {
|
|
|
57
56
|
* Hash a targeting key using SHA256.
|
|
58
57
|
*
|
|
59
58
|
* @param {string} targetingKey - The targeting key to hash
|
|
60
|
-
* @returns {string} Lowercase hex digest of the SHA256 hash
|
|
61
59
|
*/
|
|
62
60
|
function hashTargetingKey (targetingKey) {
|
|
63
61
|
return crypto.createHash('sha256').update(targetingKey).digest('hex')
|
|
@@ -72,7 +72,6 @@ class EvalMetricsHook {
|
|
|
72
72
|
* @param {{ flagKey: string }} hookContext - Hook context containing the flag key
|
|
73
73
|
* @param {{ variant?: string, reason?: string, errorCode?: string, flagMetadata?: object }} evaluationDetails
|
|
74
74
|
* - Full evaluation details
|
|
75
|
-
* @returns {void}
|
|
76
75
|
*/
|
|
77
76
|
finally (hookContext, evaluationDetails) {
|
|
78
77
|
if (!this.#enabled) return
|
|
@@ -13,7 +13,6 @@ let exposuresWriter = null
|
|
|
13
13
|
/**
|
|
14
14
|
* @private
|
|
15
15
|
* @param {object | Array<object>} exposureEvents - Exposure events channel subscriber
|
|
16
|
-
* @returns {void}
|
|
17
16
|
*/
|
|
18
17
|
function _handleExposureSubmit (exposureEvents) {
|
|
19
18
|
if (!exposuresWriter) return
|
|
@@ -23,7 +22,6 @@ function _handleExposureSubmit (exposureEvents) {
|
|
|
23
22
|
/**
|
|
24
23
|
* Channel subscriber for manually flushing the exposures writer
|
|
25
24
|
* @private
|
|
26
|
-
* @returns {void}
|
|
27
25
|
*/
|
|
28
26
|
function _handleFlush () {
|
|
29
27
|
exposuresWriter?.flush()
|
|
@@ -32,7 +30,6 @@ function _handleFlush () {
|
|
|
32
30
|
/**
|
|
33
31
|
* Enables the OpenFeature module and sets up FF&E writer and channel subscribers
|
|
34
32
|
* @param {import('../config')} config - Tracer configuration object
|
|
35
|
-
* @returns {void}
|
|
36
33
|
*/
|
|
37
34
|
function enable (config) {
|
|
38
35
|
if (exposuresWriter) {
|
|
@@ -54,7 +51,6 @@ function enable (config) {
|
|
|
54
51
|
|
|
55
52
|
/**
|
|
56
53
|
* Disables the OpenFeature module and cleans up resources
|
|
57
|
-
* @returns {void}
|
|
58
54
|
*/
|
|
59
55
|
function disable () {
|
|
60
56
|
if (!exposuresWriter) return
|
|
@@ -69,7 +69,6 @@ class SpanEnrichmentHook {
|
|
|
69
69
|
* @param {boolean} [evaluationDetails.flagMetadata.__dd_do_log] - Whether to log subject
|
|
70
70
|
* @param {string} [evaluationDetails.variant] - Variant key if flag was found in UFC
|
|
71
71
|
* @param {boolean|string|number|object} [evaluationDetails.value] - Evaluated value
|
|
72
|
-
* @returns {void}
|
|
73
72
|
*/
|
|
74
73
|
finally (hookContext, evaluationDetails) {
|
|
75
74
|
try {
|
|
@@ -30,7 +30,6 @@ class SpanEnrichmentState {
|
|
|
30
30
|
* Add a serial ID from a flag evaluation.
|
|
31
31
|
*
|
|
32
32
|
* @param {number} serialId - The serial ID to add
|
|
33
|
-
* @returns {boolean} True if added, false if limit reached
|
|
34
33
|
*/
|
|
35
34
|
addSerialId (serialId) {
|
|
36
35
|
if (this._serialIds.size >= MAX_SERIAL_IDS) {
|
|
@@ -47,7 +46,6 @@ class SpanEnrichmentState {
|
|
|
47
46
|
*
|
|
48
47
|
* @param {string} targetingKey - The targeting key (will be hashed)
|
|
49
48
|
* @param {number} serialId - The serial ID associated with this evaluation
|
|
50
|
-
* @returns {boolean} True if added, false if limit reached
|
|
51
49
|
*/
|
|
52
50
|
addSubject (targetingKey, serialId) {
|
|
53
51
|
const hashedKey = hashTargetingKey(targetingKey)
|
|
@@ -77,7 +75,6 @@ class SpanEnrichmentState {
|
|
|
77
75
|
*
|
|
78
76
|
* @param {string} flagKey - The flag key
|
|
79
77
|
* @param {boolean|string|number|object} defaultValue - The default value used
|
|
80
|
-
* @returns {boolean} True if added, false if limit reached
|
|
81
78
|
*/
|
|
82
79
|
addDefault (flagKey, defaultValue) {
|
|
83
80
|
if (this._defaults.has(flagKey)) {
|
|
@@ -106,7 +103,6 @@ class SpanEnrichmentState {
|
|
|
106
103
|
* Note: _subjects is not checked because addSubject() is never called without first
|
|
107
104
|
* calling addSerialId(), so _subjects having data necessitates _serialIds having data.
|
|
108
105
|
*
|
|
109
|
-
* @returns {boolean} True if there is data to add
|
|
110
106
|
*/
|
|
111
107
|
hasData () {
|
|
112
108
|
return this._serialIds.size > 0 || this._defaults.size > 0
|
|
@@ -37,7 +37,6 @@ const log = require('../../log')
|
|
|
37
37
|
*
|
|
38
38
|
* @param {Error | null} error - Request error
|
|
39
39
|
* @param {number | undefined} statusCode - HTTP response status
|
|
40
|
-
* @returns {boolean} Whether direct retry is safe
|
|
41
40
|
*/
|
|
42
41
|
function isDefinitiveRejection (error, statusCode) {
|
|
43
42
|
return error?.code === 'EAI_AGAIN' || error?.code === 'ECONNREFUSED' ||
|
|
@@ -49,7 +48,6 @@ function isDefinitiveRejection (error, statusCode) {
|
|
|
49
48
|
* Tests whether a local route can have accepted an event batch before failing.
|
|
50
49
|
*
|
|
51
50
|
* @param {Error | null} error - Request error
|
|
52
|
-
* @returns {boolean} Whether the delivery result is ambiguous
|
|
53
51
|
*/
|
|
54
52
|
function isAmbiguousNetworkFailure (error) {
|
|
55
53
|
return error?.code === 'ECONNRESET' || error?.code === 'EPIPE' || error?.code === 'ETIMEDOUT'
|
|
@@ -189,7 +187,6 @@ class BaseFFEWriter {
|
|
|
189
187
|
/**
|
|
190
188
|
* @private
|
|
191
189
|
* @param {Array<object>} payload - Payload to encode
|
|
192
|
-
* @returns {string} JSON-stringified payload
|
|
193
190
|
*/
|
|
194
191
|
_encode (payload) {
|
|
195
192
|
return JSON.stringify(payload)
|
|
@@ -200,7 +197,6 @@ class BaseFFEWriter {
|
|
|
200
197
|
*
|
|
201
198
|
* @param {WriterRoute} route - Active route
|
|
202
199
|
* @param {WriterRoute} [fallbackRoute] - Direct fallback route
|
|
203
|
-
* @returns {void}
|
|
204
200
|
*/
|
|
205
201
|
_setRoutes (route, fallbackRoute) {
|
|
206
202
|
this.#activateRoute(this.#createRoute(route))
|
|
@@ -251,7 +247,6 @@ class BaseFFEWriter {
|
|
|
251
247
|
* Makes a route active for future event batches.
|
|
252
248
|
*
|
|
253
249
|
* @param {ActiveWriterRoute} route - Route state
|
|
254
|
-
* @returns {void}
|
|
255
250
|
*/
|
|
256
251
|
#activateRoute (route) {
|
|
257
252
|
this._baseUrl = route.url
|
|
@@ -266,7 +261,6 @@ class BaseFFEWriter {
|
|
|
266
261
|
* @param {number} eventCount - Event count
|
|
267
262
|
* @param {ActiveWriterRoute} route - Selected route
|
|
268
263
|
* @param {ActiveWriterRoute} [fallbackRoute] - Direct fallback route
|
|
269
|
-
* @returns {void}
|
|
270
264
|
*/
|
|
271
265
|
#sendRequest (payload, eventCount, route, fallbackRoute) {
|
|
272
266
|
request(payload, route.requestOptions, (error, response, statusCode) => {
|
|
@@ -114,7 +114,6 @@ class ExposuresWriter extends BaseFFEWriter {
|
|
|
114
114
|
/**
|
|
115
115
|
* @param {boolean} enabled - Whether to enable the writer
|
|
116
116
|
* @param {ExposureRoute} [route] - Selected EVP route
|
|
117
|
-
* @returns {void}
|
|
118
117
|
*/
|
|
119
118
|
setEnabled (enabled, route) {
|
|
120
119
|
if (route) {
|
|
@@ -134,7 +133,6 @@ class ExposuresWriter extends BaseFFEWriter {
|
|
|
134
133
|
* Applies caller-supplied route data without performing discovery.
|
|
135
134
|
*
|
|
136
135
|
* @param {ExposureRoute} route - Selected EVP route
|
|
137
|
-
* @returns {void}
|
|
138
136
|
*/
|
|
139
137
|
#setRoute (route) {
|
|
140
138
|
const fallbackRoute = route.fallback && {
|
|
@@ -180,9 +178,6 @@ class ExposuresWriter extends BaseFFEWriter {
|
|
|
180
178
|
}
|
|
181
179
|
}
|
|
182
180
|
|
|
183
|
-
/**
|
|
184
|
-
* @returns {number} Cumulative number of exposure events dropped due to buffer overflow.
|
|
185
|
-
*/
|
|
186
181
|
get droppedEventCount () {
|
|
187
182
|
return this._droppedEvents
|
|
188
183
|
}
|
|
@@ -15,7 +15,6 @@ let missingRouteWarningLogged = false
|
|
|
15
15
|
/**
|
|
16
16
|
* Logs the unavailable exposure-delivery warning once.
|
|
17
17
|
*
|
|
18
|
-
* @returns {void}
|
|
19
18
|
*/
|
|
20
19
|
function warnExposureDeliveryUnavailable () {
|
|
21
20
|
if (missingRouteWarningLogged) return
|
|
@@ -31,7 +30,6 @@ function warnExposureDeliveryUnavailable () {
|
|
|
31
30
|
*
|
|
32
31
|
* @param {import('../../config')} config - Tracer configuration object
|
|
33
32
|
* @param {Function} setWriterEnabledValue - Callback to set the writer enabled state
|
|
34
|
-
* @returns {void}
|
|
35
33
|
*/
|
|
36
34
|
function setAgentStrategy (config, setWriterEnabledValue) {
|
|
37
35
|
discoverEVPProxy(config.url, {
|
|
@@ -61,7 +59,6 @@ function setAgentStrategy (config, setWriterEnabledValue) {
|
|
|
61
59
|
*
|
|
62
60
|
* @param {import('../../config')} config - Tracer configuration object
|
|
63
61
|
* @param {Function} setWriterEnabledValue - Callback to set the writer enabled state
|
|
64
|
-
* @returns {void}
|
|
65
62
|
*/
|
|
66
63
|
function setAgentlessStrategy (config, setWriterEnabledValue) {
|
|
67
64
|
const directRoute = createDirectEVPRoute(config, EVP_EVENT_PLATFORM_SUBDOMAIN)
|
|
@@ -105,7 +102,6 @@ function setAgentlessStrategy (config, setWriterEnabledValue) {
|
|
|
105
102
|
*
|
|
106
103
|
* @param {import('../../config')} config - Tracer configuration object
|
|
107
104
|
* @param {Function} setWriterEnabledValue - Callback to set the writer enabled state
|
|
108
|
-
* @returns {void}
|
|
109
105
|
*/
|
|
110
106
|
function setExposureDeliveryStrategy (config, setWriterEnabledValue) {
|
|
111
107
|
if (config.featureFlags?.DD_FEATURE_FLAGS_CONFIGURATION_SOURCE === 'agentless') {
|
|
@@ -49,7 +49,6 @@ class OtlpHttpLogExporter extends OtlpHttpExporterBase {
|
|
|
49
49
|
* @param {LogRecord[]} logRecords - Array of enriched log records to export
|
|
50
50
|
* @param {Function} resultCallback - Callback function for export result
|
|
51
51
|
*
|
|
52
|
-
* @returns {void}
|
|
53
52
|
*/
|
|
54
53
|
export (logRecords, resultCallback) {
|
|
55
54
|
if (logRecords.length === 0) {
|
|
@@ -43,7 +43,6 @@ const NANOSECONDS_PER_SECOND = 1_000_000_000n
|
|
|
43
43
|
/**
|
|
44
44
|
* Converts an OpenTelemetry HrTime to an exact OTLP uint64 decimal string.
|
|
45
45
|
* @param {import('@opentelemetry/api').HrTime} hrTime
|
|
46
|
-
* @returns {string}
|
|
47
46
|
*/
|
|
48
47
|
function encodeHrTime (hrTime) {
|
|
49
48
|
return (BigInt(hrTime[0]) * NANOSECONDS_PER_SECOND + BigInt(hrTime[1])).toString()
|
|
@@ -205,7 +204,6 @@ class OtlpTransformer extends OtlpTransformerBase {
|
|
|
205
204
|
/**
|
|
206
205
|
* Maps OpenTelemetry severity number to protobuf severity number.
|
|
207
206
|
* @param {number} severityNumber - OpenTelemetry severity number
|
|
208
|
-
* @returns {number} Protobuf severity number
|
|
209
207
|
*/
|
|
210
208
|
#mapSeverityNumber (severityNumber) {
|
|
211
209
|
const { protoSeverityNumber } = getProtobufTypes()
|
|
@@ -148,7 +148,6 @@ class OtlpStatsTransformer extends OtlpTransformerBase {
|
|
|
148
148
|
* @param {string} baseKey
|
|
149
149
|
* @param {boolean} topLevel
|
|
150
150
|
* @param {string} statusCode
|
|
151
|
-
* @returns {void}
|
|
152
151
|
*/
|
|
153
152
|
#addDistribution (distributions, sketch, startNano, endNano, baseAttributes, baseKey, topLevel, statusCode) {
|
|
154
153
|
if (!sketch || sketch.count === 0) return
|
|
@@ -237,7 +237,6 @@ class OtlpTransformer extends OtlpTransformerBase {
|
|
|
237
237
|
*
|
|
238
238
|
* @param {NumberDataPoint} dataPoint - The number data point to assign a value to
|
|
239
239
|
* @param {number} value - The value to assign
|
|
240
|
-
* @returns {void}
|
|
241
240
|
*/
|
|
242
241
|
#assignNumberValue (dataPoint, value) {
|
|
243
242
|
if (Number.isInteger(value)) {
|
|
@@ -178,9 +178,9 @@ class PeriodicMetricReader {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
/**
|
|
181
|
+
* Returns the matching index, or `-1` when no batch callback matches.
|
|
181
182
|
* @param {Function} callback
|
|
182
183
|
* @param {Set} instruments
|
|
183
|
-
* @returns {number} index in #batchCallbacks, or -1
|
|
184
184
|
*/
|
|
185
185
|
#findBatchCallback (callback, instruments) {
|
|
186
186
|
return this.#batchCallbacks.findIndex(record =>
|
|
@@ -215,7 +215,6 @@ class PeriodicMetricReader {
|
|
|
215
215
|
/**
|
|
216
216
|
* Forces an immediate collection and export of all metrics.
|
|
217
217
|
* @param {(error: Error | null) => void} [done] Called after the metric export completes
|
|
218
|
-
* @returns {void}
|
|
219
218
|
*/
|
|
220
219
|
forceFlush (done) {
|
|
221
220
|
if (this.#isShutdown) {
|
|
@@ -230,7 +229,6 @@ class PeriodicMetricReader {
|
|
|
230
229
|
/**
|
|
231
230
|
* Shuts down the reader and stops periodic collection.
|
|
232
231
|
* @param {(error: Error | null) => void} [done] Called after the final export and exporter shutdown complete
|
|
233
|
-
* @returns {void}
|
|
234
232
|
*/
|
|
235
233
|
shutdown (done) {
|
|
236
234
|
if (this.#isShutdown) {
|
|
@@ -273,14 +271,12 @@ class PeriodicMetricReader {
|
|
|
273
271
|
/**
|
|
274
272
|
* @param {boolean} flushExporter Whether to flush the exporter after export
|
|
275
273
|
* @param {(error: Error | null) => void} [done] Called when the queued export completes
|
|
276
|
-
* @returns {void}
|
|
277
274
|
*/
|
|
278
275
|
#enqueueExport (flushExporter, done) {
|
|
279
276
|
this.#exportQueue.push({ flushExporter, done })
|
|
280
277
|
this.#drainExportQueue()
|
|
281
278
|
}
|
|
282
279
|
|
|
283
|
-
/** @returns {void} */
|
|
284
280
|
#drainExportQueue () {
|
|
285
281
|
if (this.#isExporting || this.#exportQueue.length === 0) return
|
|
286
282
|
|
|
@@ -318,7 +314,6 @@ class PeriodicMetricReader {
|
|
|
318
314
|
|
|
319
315
|
/**
|
|
320
316
|
* @param {Error} [exportError] Error from the final export
|
|
321
|
-
* @returns {void}
|
|
322
317
|
*/
|
|
323
318
|
#shutdownExporter (exportError) {
|
|
324
319
|
let completed = false
|
|
@@ -425,7 +420,6 @@ class MetricAggregator {
|
|
|
425
420
|
* Gets the temporality for a given metric type.
|
|
426
421
|
*
|
|
427
422
|
* @param {string} type - Metric type from METRIC_TYPES
|
|
428
|
-
* @returns {string} Temporality from TEMPORALITY
|
|
429
423
|
*/
|
|
430
424
|
#getTemporality (type) {
|
|
431
425
|
// UpDownCounter and Observable UpDownCounter always use CUMULATIVE
|
|
@@ -520,7 +514,6 @@ class MetricAggregator {
|
|
|
520
514
|
* Gets unique identifier for a given instrumentation scope.
|
|
521
515
|
*
|
|
522
516
|
* @param {InstrumentationScope} instrumentationScope - The instrumentation scope
|
|
523
|
-
* @returns {string} - The scope identifier
|
|
524
517
|
*/
|
|
525
518
|
#getScopeKey (instrumentationScope) {
|
|
526
519
|
return `${instrumentationScope.name}@${instrumentationScope.version}@${instrumentationScope.schemaUrl}`
|
|
@@ -533,7 +526,6 @@ class MetricAggregator {
|
|
|
533
526
|
* @param {string} name - The metric name
|
|
534
527
|
* @param {string} type - The metric type from METRIC_TYPES
|
|
535
528
|
* @param {string} attrKey - The attribute key
|
|
536
|
-
* @returns {string} - The metric identifier
|
|
537
529
|
*/
|
|
538
530
|
#getStateKey (scopeKey, name, type, attrKey) {
|
|
539
531
|
return `${scopeKey}:${name}:${type}:${attrKey}`
|
|
@@ -543,7 +535,6 @@ class MetricAggregator {
|
|
|
543
535
|
* Checks if a given metric type is a delta type.
|
|
544
536
|
*
|
|
545
537
|
* @param {string} type - The metric type from METRIC_TYPES
|
|
546
|
-
* @returns {boolean} - True if the metric type is a delta type
|
|
547
538
|
*/
|
|
548
539
|
#isDeltaType (type) {
|
|
549
540
|
return type === METRIC_TYPES.COUNTER ||
|
|
@@ -556,7 +547,6 @@ class MetricAggregator {
|
|
|
556
547
|
*
|
|
557
548
|
* @param {Iterable<AggregatedMetric>} metrics - The metrics to apply delta temporality to
|
|
558
549
|
* @param {Map<string, LastExportedStateValue>} lastExportedState - The last exported state of the metrics
|
|
559
|
-
* @returns {void}
|
|
560
550
|
*/
|
|
561
551
|
#applyDeltaTemporality (metrics, lastExportedState) {
|
|
562
552
|
for (const metric of metrics) {
|
|
@@ -681,7 +671,6 @@ class MetricAggregator {
|
|
|
681
671
|
* @param {number} timestamp - The timestamp of the measurement
|
|
682
672
|
* @param {string} stateKey - The state key
|
|
683
673
|
* @param {Map<string, CumulativeStateValue>} cumulativeState - The cumulative state of the metrics
|
|
684
|
-
* @returns {void}
|
|
685
674
|
*/
|
|
686
675
|
#aggregateHistogram (metric, value, attributes, attrKey, timestamp, stateKey, cumulativeState) {
|
|
687
676
|
if (!cumulativeState.has(stateKey)) {
|
|
@@ -733,7 +722,6 @@ class MetricAggregator {
|
|
|
733
722
|
|
|
734
723
|
/**
|
|
735
724
|
* @param {object} x
|
|
736
|
-
* @returns {boolean}
|
|
737
725
|
*/
|
|
738
726
|
function isObservableInstrument (x) {
|
|
739
727
|
return x instanceof ObservableInstrument
|
|
@@ -742,7 +730,6 @@ function isObservableInstrument (x) {
|
|
|
742
730
|
/**
|
|
743
731
|
* @param {Set} a
|
|
744
732
|
* @param {Set} b
|
|
745
|
-
* @returns {boolean}
|
|
746
733
|
*/
|
|
747
734
|
function setEquals (a, b) {
|
|
748
735
|
if (a.size !== b.size) return false
|
|
@@ -10,7 +10,6 @@ const { timeOrigin } = performance
|
|
|
10
10
|
* the value on the epoch while `performance.now()` keeps it monotonic, so a
|
|
11
11
|
* backward wall-clock jump can't make `timeUnixNano` precede `startTimeUnixNano`.
|
|
12
12
|
*
|
|
13
|
-
* @returns {number} Nanoseconds since the UNIX epoch
|
|
14
13
|
*/
|
|
15
14
|
function nowUnixNano () {
|
|
16
15
|
return Math.round((timeOrigin + performance.now()) * 1e6)
|