dd-trace 5.80.0 → 5.82.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/LICENSE-3rdparty.csv +79 -88
- package/ext/tags.d.ts +1 -0
- package/ext/tags.js +1 -0
- package/index.d.ts +42 -35
- package/loader-hook.mjs +16 -4
- package/package.json +33 -56
- package/packages/datadog-core/src/utils/src/parse-tags.js +1 -1
- package/packages/datadog-esbuild/index.js +44 -26
- package/packages/datadog-esbuild/src/utils.js +14 -2
- package/packages/datadog-instrumentations/index.js +1 -0
- package/packages/datadog-instrumentations/src/aerospike.js +3 -2
- package/packages/datadog-instrumentations/src/ai.js +2 -2
- package/packages/datadog-instrumentations/src/amqp10.js +1 -1
- package/packages/datadog-instrumentations/src/amqplib.js +4 -4
- package/packages/datadog-instrumentations/src/anthropic.js +14 -2
- package/packages/datadog-instrumentations/src/apollo-server-core.js +2 -2
- package/packages/datadog-instrumentations/src/apollo-server.js +1 -1
- package/packages/datadog-instrumentations/src/apollo.js +3 -2
- package/packages/datadog-instrumentations/src/avsc.js +1 -1
- package/packages/datadog-instrumentations/src/aws-sdk.js +6 -2
- package/packages/datadog-instrumentations/src/azure-event-hubs.js +4 -3
- package/packages/datadog-instrumentations/src/azure-functions.js +2 -2
- package/packages/datadog-instrumentations/src/azure-service-bus.js +3 -4
- package/packages/datadog-instrumentations/src/bluebird.js +1 -1
- package/packages/datadog-instrumentations/src/bullmq.js +11 -0
- package/packages/datadog-instrumentations/src/bunyan.js +1 -1
- package/packages/datadog-instrumentations/src/cassandra-driver.js +1 -1
- package/packages/datadog-instrumentations/src/child_process.js +2 -2
- package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +3 -3
- package/packages/datadog-instrumentations/src/couchbase.js +1 -1
- package/packages/datadog-instrumentations/src/crypto.js +1 -1
- package/packages/datadog-instrumentations/src/cucumber.js +12 -13
- package/packages/datadog-instrumentations/src/cypress.js +1 -1
- package/packages/datadog-instrumentations/src/dns.js +1 -1
- package/packages/datadog-instrumentations/src/elasticsearch.js +1 -1
- package/packages/datadog-instrumentations/src/express-mongo-sanitize.js +1 -1
- package/packages/datadog-instrumentations/src/express.js +1 -1
- package/packages/datadog-instrumentations/src/find-my-way.js +6 -5
- package/packages/datadog-instrumentations/src/fs.js +1 -1
- package/packages/datadog-instrumentations/src/generic-pool.js +1 -1
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +137 -15
- package/packages/datadog-instrumentations/src/google-cloud-vertexai.js +2 -3
- package/packages/datadog-instrumentations/src/google-genai.js +120 -0
- package/packages/datadog-instrumentations/src/graphql.js +21 -1
- package/packages/datadog-instrumentations/src/grpc/client.js +1 -1
- package/packages/datadog-instrumentations/src/grpc/server.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/hook.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +5 -1
- package/packages/datadog-instrumentations/src/helpers/instrument.js +11 -1
- package/packages/datadog-instrumentations/src/helpers/register.js +12 -5
- package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +27 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +152 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/bullmq.json +106 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +6 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/langchain.js +237 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/loader.js +9 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/loader.mjs +11 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +139 -0
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/shared-utils.js +9 -0
- package/packages/datadog-instrumentations/src/hono.js +55 -10
- package/packages/datadog-instrumentations/src/ioredis.js +1 -1
- package/packages/datadog-instrumentations/src/iovalkey.js +1 -1
- package/packages/datadog-instrumentations/src/jest.js +2 -2
- package/packages/datadog-instrumentations/src/kafkajs.js +3 -3
- package/packages/datadog-instrumentations/src/knex.js +1 -1
- package/packages/datadog-instrumentations/src/langchain.js +3 -109
- package/packages/datadog-instrumentations/src/ldapjs.js +1 -1
- package/packages/datadog-instrumentations/src/light-my-request.js +93 -0
- package/packages/datadog-instrumentations/src/limitd-client.js +1 -1
- package/packages/datadog-instrumentations/src/lodash.js +1 -2
- package/packages/datadog-instrumentations/src/mariadb.js +1 -2
- package/packages/datadog-instrumentations/src/memcached.js +1 -1
- package/packages/datadog-instrumentations/src/mocha/main.js +1 -1
- package/packages/datadog-instrumentations/src/mongodb-core.js +1 -1
- package/packages/datadog-instrumentations/src/mongodb.js +1 -1
- package/packages/datadog-instrumentations/src/mongoose.js +1 -1
- package/packages/datadog-instrumentations/src/mquery.js +1 -1
- package/packages/datadog-instrumentations/src/mysql.js +1 -1
- package/packages/datadog-instrumentations/src/mysql2.js +2 -2
- package/packages/datadog-instrumentations/src/net.js +1 -1
- package/packages/datadog-instrumentations/src/next.js +1 -1
- package/packages/datadog-instrumentations/src/nyc.js +1 -1
- package/packages/datadog-instrumentations/src/openai.js +2 -2
- package/packages/datadog-instrumentations/src/opensearch.js +1 -1
- package/packages/datadog-instrumentations/src/oracledb.js +1 -1
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +1 -1
- package/packages/datadog-instrumentations/src/pg.js +3 -3
- package/packages/datadog-instrumentations/src/pino.js +1 -1
- package/packages/datadog-instrumentations/src/playwright.js +46 -17
- package/packages/datadog-instrumentations/src/prisma.js +52 -37
- package/packages/datadog-instrumentations/src/process.js +1 -1
- package/packages/datadog-instrumentations/src/promise-js.js +1 -1
- package/packages/datadog-instrumentations/src/promise.js +1 -1
- package/packages/datadog-instrumentations/src/protobufjs.js +1 -1
- package/packages/datadog-instrumentations/src/q.js +1 -1
- package/packages/datadog-instrumentations/src/redis.js +1 -1
- package/packages/datadog-instrumentations/src/rhea.js +1 -1
- package/packages/datadog-instrumentations/src/router.js +1 -1
- package/packages/datadog-instrumentations/src/selenium.js +4 -2
- package/packages/datadog-instrumentations/src/sequelize.js +1 -2
- package/packages/datadog-instrumentations/src/sharedb.js +1 -1
- package/packages/datadog-instrumentations/src/tedious.js +1 -1
- package/packages/datadog-instrumentations/src/undici.js +4 -4
- package/packages/datadog-instrumentations/src/url.js +1 -1
- package/packages/datadog-instrumentations/src/vitest.js +1 -1
- package/packages/datadog-instrumentations/src/vm.js +1 -1
- package/packages/datadog-instrumentations/src/when.js +1 -1
- package/packages/datadog-instrumentations/src/winston.js +1 -1
- package/packages/datadog-instrumentations/src/ws.js +38 -19
- package/packages/datadog-plugin-amqp10/src/index.js +1 -1
- package/packages/datadog-plugin-amqplib/src/index.js +1 -1
- package/packages/datadog-plugin-anthropic/src/index.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/index.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +4 -4
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +2 -2
- package/packages/datadog-plugin-aws-sdk/src/util.js +3 -3
- package/packages/datadog-plugin-azure-event-hubs/src/index.js +1 -1
- package/packages/datadog-plugin-azure-event-hubs/src/producer.js +19 -5
- package/packages/datadog-plugin-azure-service-bus/src/index.js +1 -1
- package/packages/datadog-plugin-azure-service-bus/src/producer.js +4 -0
- package/packages/datadog-plugin-bullmq/src/consumer.js +60 -0
- package/packages/datadog-plugin-bullmq/src/index.js +18 -0
- package/packages/datadog-plugin-bullmq/src/producer.js +178 -0
- package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +1 -1
- package/packages/datadog-plugin-confluentinc-kafka-javascript/src/index.js +1 -1
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +23 -2
- package/packages/datadog-plugin-cypress/src/plugin.js +2 -2
- package/packages/datadog-plugin-cypress/src/support.js +73 -31
- package/packages/datadog-plugin-express/src/index.js +1 -1
- package/packages/datadog-plugin-fastify/src/index.js +1 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +13 -3
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +171 -12
- package/packages/datadog-plugin-google-cloud-pubsub/src/index.js +1 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +160 -13
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +217 -0
- package/packages/datadog-plugin-google-cloud-vertexai/src/index.js +1 -1
- package/packages/datadog-plugin-google-genai/src/index.js +17 -0
- package/packages/datadog-plugin-google-genai/src/tracing.js +41 -0
- package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +5 -4
- package/packages/datadog-plugin-grpc/src/index.js +1 -1
- package/packages/datadog-plugin-http/src/client.js +2 -1
- package/packages/datadog-plugin-http/src/index.js +25 -5
- package/packages/datadog-plugin-http2/src/client.js +2 -2
- package/packages/datadog-plugin-http2/src/index.js +1 -1
- package/packages/datadog-plugin-jest/src/util.js +1 -1
- package/packages/datadog-plugin-kafkajs/src/index.js +1 -1
- package/packages/datadog-plugin-langchain/src/index.js +1 -1
- package/packages/datadog-plugin-langchain/src/tracing.js +7 -3
- package/packages/datadog-plugin-moleculer/src/index.js +1 -1
- package/packages/datadog-plugin-mongodb-core/src/index.js +6 -2
- package/packages/datadog-plugin-next/src/index.js +11 -3
- package/packages/datadog-plugin-openai/src/index.js +1 -1
- package/packages/datadog-plugin-openai/src/stream-helpers.js +30 -10
- package/packages/datadog-plugin-openai/src/tracing.js +2 -2
- package/packages/datadog-plugin-rhea/src/index.js +1 -1
- package/packages/datadog-plugin-ws/src/close.js +56 -3
- package/packages/datadog-plugin-ws/src/index.js +4 -0
- package/packages/datadog-plugin-ws/src/producer.js +39 -4
- package/packages/datadog-plugin-ws/src/receiver.js +39 -3
- package/packages/datadog-plugin-ws/src/server.js +13 -1
- package/packages/datadog-plugin-ws/src/util.js +107 -0
- package/packages/datadog-shimmer/src/shimmer.js +2 -2
- package/packages/dd-trace/src/aiguard/sdk.js +21 -13
- package/packages/dd-trace/src/appsec/api_security_sampler.js +1 -1
- package/packages/dd-trace/src/appsec/graphql.js +2 -2
- package/packages/dd-trace/src/appsec/iast/analyzers/code-injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/command-injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-base-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/ldap-injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +3 -3
- package/packages/dd-trace/src/appsec/iast/analyzers/path-traversal-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/ssrf-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/untrusted-deserialization-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/unvalidated-redirect-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-cipher-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-hash-analyzer.js +3 -2
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-randomness-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/iast-plugin.js +3 -3
- package/packages/dd-trace/src/appsec/iast/index.js +5 -5
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +1 -1
- package/packages/dd-trace/src/appsec/iast/security-controls/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +1 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/operations-taint-object.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-esm.mjs +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +11 -16
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +1 -1
- package/packages/dd-trace/src/appsec/iast/telemetry/namespaces.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +4 -4
- package/packages/dd-trace/src/appsec/index.js +8 -8
- package/packages/dd-trace/src/appsec/rasp/command_injection.js +1 -1
- package/packages/dd-trace/src/appsec/rasp/index.js +1 -1
- package/packages/dd-trace/src/appsec/rasp/lfi.js +1 -1
- package/packages/dd-trace/src/appsec/rc-products.js +10 -0
- package/packages/dd-trace/src/appsec/recommended.json +230 -3
- package/packages/dd-trace/src/appsec/remote_config.js +177 -0
- package/packages/dd-trace/src/appsec/reporter.js +3 -7
- package/packages/dd-trace/src/appsec/rule_manager.js +37 -20
- package/packages/dd-trace/src/appsec/sdk/index.js +1 -1
- package/packages/dd-trace/src/appsec/sdk/set_user.js +1 -1
- package/packages/dd-trace/src/appsec/sdk/track_event.js +2 -2
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +2 -2
- package/packages/dd-trace/src/appsec/user_tracking.js +2 -2
- package/packages/dd-trace/src/appsec/waf/index.js +17 -3
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +11 -0
- package/packages/dd-trace/src/azure_metadata.js +8 -2
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +8 -6
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/index.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +1 -1
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +1 -1
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +4 -2
- package/packages/dd-trace/src/config/remote_config.js +34 -0
- package/packages/dd-trace/src/config.js +109 -34
- package/packages/dd-trace/src/config_defaults.js +16 -3
- package/packages/dd-trace/src/constants.js +5 -0
- package/packages/dd-trace/src/crashtracking/crashtracker.js +10 -1
- package/packages/dd-trace/src/datastreams/checkpointer.js +2 -2
- package/packages/dd-trace/src/datastreams/encoding.js +23 -6
- package/packages/dd-trace/src/datastreams/index.js +1 -1
- package/packages/dd-trace/src/datastreams/pathway.js +41 -2
- package/packages/dd-trace/src/datastreams/processor.js +3 -3
- package/packages/dd-trace/src/datastreams/schemas/schema_builder.js +1 -1
- package/packages/dd-trace/src/datastreams/writer.js +2 -2
- package/packages/dd-trace/src/debugger/config.js +1 -0
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +15 -5
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/config.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/index.js +37 -17
- package/packages/dd-trace/src/debugger/devtools_client/inspector_promises_polyfill.js +2 -0
- package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +24 -18
- package/packages/dd-trace/src/debugger/devtools_client/send.js +21 -11
- package/packages/dd-trace/src/debugger/devtools_client/session.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +103 -15
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/constants.js +25 -0
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +56 -25
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +64 -23
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/symbols.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +404 -0
- package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/state.js +8 -3
- package/packages/dd-trace/src/debugger/devtools_client/status.js +3 -3
- package/packages/dd-trace/src/debugger/index.js +2 -2
- package/packages/dd-trace/src/dogstatsd.js +3 -2
- package/packages/dd-trace/src/encode/0.4.js +1 -1
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +2 -2
- package/packages/dd-trace/src/encode/coverage-ci-visibility.js +1 -1
- package/packages/dd-trace/src/encode/span-stats.js +13 -2
- package/packages/dd-trace/src/exporter.js +2 -2
- package/packages/dd-trace/src/exporters/agent/index.js +1 -1
- package/packages/dd-trace/src/exporters/common/agent-info-exporter.js +1 -1
- package/packages/dd-trace/src/exporters/common/request.js +2 -2
- package/packages/dd-trace/src/exporters/common/writer.js +1 -1
- package/packages/dd-trace/src/exporters/span-stats/index.js +1 -1
- package/packages/dd-trace/src/external-logger/src/index.js +1 -2
- package/packages/dd-trace/src/flare/index.js +1 -1
- package/packages/dd-trace/src/guardrails/index.js +6 -3
- package/packages/dd-trace/src/histogram.js +1 -1
- package/packages/dd-trace/src/id.js +60 -0
- package/packages/dd-trace/src/index.js +1 -1
- package/packages/dd-trace/src/lambda/handler.js +4 -4
- package/packages/dd-trace/src/lambda/index.js +1 -1
- package/packages/dd-trace/src/lambda/runtime/patch.js +4 -4
- package/packages/dd-trace/src/lambda/runtime/ritm.js +2 -2
- package/packages/dd-trace/src/llmobs/constants/tags.js +8 -1
- package/packages/dd-trace/src/llmobs/index.js +8 -9
- package/packages/dd-trace/src/llmobs/plugins/ai/index.js +38 -7
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +30 -9
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +3 -3
- package/packages/dd-trace/src/llmobs/plugins/genai/index.js +104 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +486 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chain.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/embedding.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/llm.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/vectorstore.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +2 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +16 -0
- package/packages/dd-trace/src/llmobs/plugins/{openai.js → openai/index.js} +63 -6
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +126 -0
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +1 -1
- package/packages/dd-trace/src/llmobs/sdk.js +20 -22
- package/packages/dd-trace/src/llmobs/span_processor.js +15 -14
- package/packages/dd-trace/src/llmobs/tagger.js +4 -0
- package/packages/dd-trace/src/llmobs/telemetry.js +3 -4
- package/packages/dd-trace/src/llmobs/writers/base.js +2 -2
- package/packages/dd-trace/src/llmobs/writers/spans.js +1 -2
- package/packages/dd-trace/src/log/index.js +1 -1
- package/packages/dd-trace/src/noop/proxy.js +2 -2
- package/packages/dd-trace/src/noop/span.js +1 -1
- package/packages/dd-trace/src/openfeature/index.js +2 -2
- package/packages/dd-trace/src/openfeature/noop.js +14 -14
- package/packages/dd-trace/src/openfeature/remote_config.js +31 -0
- package/packages/dd-trace/src/openfeature/writers/base.js +5 -5
- package/packages/dd-trace/src/openfeature/writers/exposures.js +9 -9
- package/packages/dd-trace/src/opentelemetry/context_manager.js +2 -2
- package/packages/dd-trace/src/opentelemetry/logs/index.js +2 -2
- package/packages/dd-trace/src/opentelemetry/logs/logger.js +3 -2
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +4 -4
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +5 -3
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +17 -16
- package/packages/dd-trace/src/opentelemetry/metrics/constants.js +34 -0
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +81 -0
- package/packages/dd-trace/src/opentelemetry/metrics/instruments.js +225 -0
- package/packages/dd-trace/src/opentelemetry/metrics/meter.js +171 -0
- package/packages/dd-trace/src/opentelemetry/metrics/meter_provider.js +54 -0
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +62 -0
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +251 -0
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +557 -0
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +10 -18
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +47 -32
- package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +1 -1
- package/packages/dd-trace/src/opentelemetry/span.js +3 -3
- package/packages/dd-trace/src/opentelemetry/tracer.js +4 -4
- package/packages/dd-trace/src/opentelemetry/tracer_provider.js +1 -1
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +24 -8
- package/packages/dd-trace/src/opentracing/span.js +3 -3
- package/packages/dd-trace/src/opentracing/tracer.js +5 -5
- package/packages/dd-trace/src/payload-tagging/index.js +8 -4
- package/packages/dd-trace/src/plugin_manager.js +5 -3
- package/packages/dd-trace/src/plugins/apollo.js +1 -1
- package/packages/dd-trace/src/plugins/ci_plugin.js +27 -27
- package/packages/dd-trace/src/plugins/database.js +1 -1
- package/packages/dd-trace/src/plugins/index.js +6 -1
- package/packages/dd-trace/src/plugins/log_plugin.js +1 -1
- package/packages/dd-trace/src/plugins/outbound.js +1 -1
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/ci.js +1 -1
- package/packages/dd-trace/src/plugins/util/git.js +8 -8
- package/packages/dd-trace/src/plugins/util/stacktrace.js +1 -1
- package/packages/dd-trace/src/plugins/util/test.js +27 -27
- package/packages/dd-trace/src/plugins/util/url.js +119 -1
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +1 -1
- package/packages/dd-trace/src/plugins/util/web.js +18 -46
- package/packages/dd-trace/src/priority_sampler.js +15 -16
- package/packages/dd-trace/src/process-tags/index.js +83 -0
- package/packages/dd-trace/src/profiling/config.js +33 -22
- package/packages/dd-trace/src/profiling/exporter_cli.js +4 -4
- package/packages/dd-trace/src/profiling/exporters/agent.js +5 -5
- package/packages/dd-trace/src/profiling/index.js +1 -1
- package/packages/dd-trace/src/profiling/libuv-size.js +1 -1
- package/packages/dd-trace/src/profiling/profiler.js +4 -5
- package/packages/dd-trace/src/profiling/profilers/event_plugins/event.js +1 -1
- package/packages/dd-trace/src/profiling/profilers/events.js +11 -2
- package/packages/dd-trace/src/profiling/profilers/wall.js +4 -4
- package/packages/dd-trace/src/proxy.js +17 -18
- package/packages/dd-trace/src/rate_limiter.js +1 -1
- package/packages/dd-trace/src/remote_config/index.js +541 -137
- package/packages/dd-trace/src/require-package-json.js +1 -1
- package/packages/dd-trace/src/ritm.js +50 -27
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +1 -1
- package/packages/dd-trace/src/serverless.js +16 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +8 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +4 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +8 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/web.js +4 -0
- package/packages/dd-trace/src/span_format.js +10 -5
- package/packages/dd-trace/src/span_processor.js +8 -3
- package/packages/dd-trace/src/span_stats.js +21 -8
- package/packages/dd-trace/src/spanleak.js +1 -1
- package/packages/dd-trace/src/standalone/index.js +1 -1
- package/packages/dd-trace/src/startup-log.js +3 -3
- package/packages/dd-trace/src/supported-configurations.json +16 -0
- package/packages/dd-trace/src/telemetry/dependencies.js +4 -4
- package/packages/dd-trace/src/telemetry/endpoints.js +8 -8
- package/packages/dd-trace/src/telemetry/logs/index.js +1 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +22 -8
- package/packages/dd-trace/src/tracer.js +3 -3
- package/packages/dd-trace/src/tracer_metadata.js +19 -15
- package/vendor/dist/@datadog/sketches-js/LICENSE +39 -0
- package/vendor/dist/@datadog/sketches-js/index.js +1 -0
- package/vendor/dist/@datadog/source-map/LICENSE +28 -0
- package/vendor/dist/@datadog/source-map/index.js +1 -0
- package/vendor/dist/@isaacs/ttlcache/LICENSE +55 -0
- package/vendor/dist/@isaacs/ttlcache/index.js +1 -0
- package/vendor/dist/@opentelemetry/core/LICENSE +201 -0
- package/vendor/dist/@opentelemetry/core/index.js +1 -0
- package/vendor/dist/@opentelemetry/resources/LICENSE +201 -0
- package/vendor/dist/@opentelemetry/resources/index.js +1 -0
- package/vendor/dist/astring/LICENSE +19 -0
- package/vendor/dist/astring/index.js +1 -0
- package/vendor/dist/crypto-randomuuid/index.js +1 -0
- package/vendor/dist/escape-string-regexp/LICENSE +9 -0
- package/vendor/dist/escape-string-regexp/index.js +1 -0
- package/vendor/dist/esquery/LICENSE +24 -0
- package/vendor/dist/esquery/index.js +1 -0
- package/vendor/dist/ignore/LICENSE +21 -0
- package/vendor/dist/ignore/index.js +1 -0
- package/vendor/dist/istanbul-lib-coverage/LICENSE +24 -0
- package/vendor/dist/istanbul-lib-coverage/index.js +1 -0
- package/vendor/dist/jest-docblock/LICENSE +21 -0
- package/vendor/dist/jest-docblock/index.js +1 -0
- package/vendor/dist/jsonpath-plus/LICENSE +22 -0
- package/vendor/dist/jsonpath-plus/index.js +1 -0
- package/vendor/dist/limiter/LICENSE +19 -0
- package/vendor/dist/limiter/index.js +1 -0
- package/vendor/dist/lodash.sortby/LICENSE +47 -0
- package/vendor/dist/lodash.sortby/index.js +1 -0
- package/vendor/dist/lru-cache/LICENSE +15 -0
- package/vendor/dist/lru-cache/index.js +1 -0
- package/vendor/dist/meriyah/LICENSE +7 -0
- package/vendor/dist/meriyah/index.js +1 -0
- package/vendor/dist/module-details-from-path/LICENSE +21 -0
- package/vendor/dist/module-details-from-path/index.js +1 -0
- package/vendor/dist/mutexify/promise/LICENSE +21 -0
- package/vendor/dist/mutexify/promise/index.js +1 -0
- package/vendor/dist/opentracing/LICENSE +201 -0
- package/vendor/dist/opentracing/binary_carrier.d.ts +11 -0
- package/vendor/dist/opentracing/constants.d.ts +61 -0
- package/vendor/dist/opentracing/examples/demo/demo.d.ts +2 -0
- package/vendor/dist/opentracing/ext/tags.d.ts +90 -0
- package/vendor/dist/opentracing/functions.d.ts +20 -0
- package/vendor/dist/opentracing/global_tracer.d.ts +14 -0
- package/vendor/dist/opentracing/index.d.ts +12 -0
- package/vendor/dist/opentracing/index.js +1 -0
- package/vendor/dist/opentracing/mock_tracer/index.d.ts +5 -0
- package/vendor/dist/opentracing/mock_tracer/mock_context.d.ts +13 -0
- package/vendor/dist/opentracing/mock_tracer/mock_report.d.ts +16 -0
- package/vendor/dist/opentracing/mock_tracer/mock_span.d.ts +50 -0
- package/vendor/dist/opentracing/mock_tracer/mock_tracer.d.ts +26 -0
- package/vendor/dist/opentracing/noop.d.ts +8 -0
- package/vendor/dist/opentracing/reference.d.ts +33 -0
- package/vendor/dist/opentracing/span.d.ts +147 -0
- package/vendor/dist/opentracing/span_context.d.ts +26 -0
- package/vendor/dist/opentracing/test/api_compatibility.d.ts +16 -0
- package/vendor/dist/opentracing/test/mocktracer_implemenation.d.ts +3 -0
- package/vendor/dist/opentracing/test/noop_implementation.d.ts +4 -0
- package/vendor/dist/opentracing/test/opentracing_api.d.ts +3 -0
- package/vendor/dist/opentracing/test/unittest.d.ts +2 -0
- package/vendor/dist/opentracing/tracer.d.ts +127 -0
- package/vendor/dist/path-to-regexp/LICENSE +21 -0
- package/vendor/dist/path-to-regexp/index.js +1 -0
- package/vendor/dist/pprof-format/LICENSE +8 -0
- package/vendor/dist/pprof-format/index.js +1 -0
- package/vendor/dist/protobufjs/LICENSE +39 -0
- package/vendor/dist/protobufjs/index.js +1 -0
- package/vendor/dist/protobufjs/minimal/LICENSE +39 -0
- package/vendor/dist/protobufjs/minimal/index.js +1 -0
- package/vendor/dist/retry/LICENSE +21 -0
- package/vendor/dist/retry/index.js +1 -0
- package/vendor/dist/rfdc/LICENSE +15 -0
- package/vendor/dist/rfdc/index.js +1 -0
- package/vendor/dist/semifies/LICENSE +201 -0
- package/vendor/dist/semifies/index.js +1 -0
- package/vendor/dist/shell-quote/LICENSE +24 -0
- package/vendor/dist/shell-quote/index.js +1 -0
- package/vendor/dist/source-map/LICENSE +28 -0
- package/vendor/dist/source-map/index.js +1 -0
- package/vendor/dist/source-map/lib/util/LICENSE +28 -0
- package/vendor/dist/source-map/lib/util/index.js +1 -0
- package/vendor/dist/source-map/mappings.wasm +0 -0
- package/vendor/dist/tlhunter-sorted-set/LICENSE +21 -0
- package/vendor/dist/tlhunter-sorted-set/index.js +1 -0
- package/vendor/dist/ttl-set/LICENSE +21 -0
- package/vendor/dist/ttl-set/index.js +1 -0
- package/packages/dd-trace/src/remote_config/manager.js +0 -368
|
@@ -4,6 +4,7 @@ const log = require('../../log')
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {import('@opentelemetry/api').Attributes} Attributes
|
|
7
|
+
* @typedef {import('@opentelemetry/api').AttributeValue} AttributeValue
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -25,7 +26,7 @@ class OtlpTransformerBase {
|
|
|
25
26
|
* @param {string} signalType - Signal type for warning messages (e.g., 'logs', 'metrics')
|
|
26
27
|
*/
|
|
27
28
|
constructor (resourceAttributes, protocol, signalType) {
|
|
28
|
-
this.#resourceAttributes = this.
|
|
29
|
+
this.#resourceAttributes = this.transformAttributes(resourceAttributes)
|
|
29
30
|
if (protocol === 'grpc') {
|
|
30
31
|
log.warn(`OTLP gRPC protocol is not supported for ${signalType}. ` +
|
|
31
32
|
'Defaulting to http/protobuf. gRPC protobuf support may be added in a future release.')
|
|
@@ -40,12 +41,12 @@ class OtlpTransformerBase {
|
|
|
40
41
|
* @returns {Map<string, Array>} Map of instrumentation scope key to items
|
|
41
42
|
* @protected
|
|
42
43
|
*/
|
|
43
|
-
|
|
44
|
+
groupByInstrumentationScope (items) {
|
|
44
45
|
const grouped = new Map()
|
|
45
46
|
|
|
46
47
|
for (const item of items) {
|
|
47
48
|
const instrumentationScope = item.instrumentationScope || { name: '', version: '', schemaUrl: '', attributes: {} }
|
|
48
|
-
const attrsKey =
|
|
49
|
+
const attrsKey = stableStringify(instrumentationScope.attributes || {})
|
|
49
50
|
const key = `${instrumentationScope.name}@${instrumentationScope.version}@` +
|
|
50
51
|
`${instrumentationScope.schemaUrl}@${attrsKey}`
|
|
51
52
|
|
|
@@ -61,10 +62,10 @@ class OtlpTransformerBase {
|
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
64
|
* Transforms resource attributes to OTLP resource format.
|
|
64
|
-
* @returns {
|
|
65
|
+
* @returns {object} OTLP resource object
|
|
65
66
|
* @protected
|
|
66
67
|
*/
|
|
67
|
-
|
|
68
|
+
transformResource () {
|
|
68
69
|
return {
|
|
69
70
|
attributes: this.#resourceAttributes,
|
|
70
71
|
droppedAttributesCount: 0
|
|
@@ -73,26 +74,24 @@ class OtlpTransformerBase {
|
|
|
73
74
|
|
|
74
75
|
/**
|
|
75
76
|
* Transforms attributes to OTLP KeyValue format.
|
|
76
|
-
* @param {
|
|
77
|
-
* @returns {
|
|
77
|
+
* @param {Attributes} attributes - Attributes to transform
|
|
78
|
+
* @returns {object[]} Array of OTLP KeyValue objects
|
|
78
79
|
* @protected
|
|
79
80
|
*/
|
|
80
|
-
|
|
81
|
-
if (!attributes) return []
|
|
82
|
-
|
|
81
|
+
transformAttributes (attributes) {
|
|
83
82
|
return Object.entries(attributes).map(([key, value]) => ({
|
|
84
83
|
key,
|
|
85
|
-
value: this.
|
|
84
|
+
value: this.transformAnyValue(value)
|
|
86
85
|
}))
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
/**
|
|
90
89
|
* Transforms attributes to JSON format (simplified).
|
|
91
|
-
* @param {
|
|
92
|
-
* @returns {
|
|
90
|
+
* @param {object} attributes - Attributes to transform
|
|
91
|
+
* @returns {object[]} Array of OTLP KeyValue objects with string values
|
|
93
92
|
* @protected
|
|
94
93
|
*/
|
|
95
|
-
|
|
94
|
+
attributesToJson (attributes) {
|
|
96
95
|
if (!attributes) return []
|
|
97
96
|
|
|
98
97
|
return Object.entries(attributes).map(([key, value]) => ({
|
|
@@ -103,11 +102,13 @@ class OtlpTransformerBase {
|
|
|
103
102
|
|
|
104
103
|
/**
|
|
105
104
|
* Transforms any value to OTLP AnyValue format.
|
|
106
|
-
*
|
|
107
|
-
*
|
|
105
|
+
* Supports: strings, numbers (int/double), booleans, arrays.
|
|
106
|
+
* Objects are filtered out by sanitizeAttributes before reaching this method.
|
|
107
|
+
* @param {AttributeValue | null | undefined} value - Value to transform
|
|
108
|
+
* @returns {object} OTLP AnyValue object
|
|
108
109
|
* @protected
|
|
109
110
|
*/
|
|
110
|
-
|
|
111
|
+
transformAnyValue (value) {
|
|
111
112
|
if (typeof value === 'string') {
|
|
112
113
|
return { stringValue: value }
|
|
113
114
|
} else if (typeof value === 'number') {
|
|
@@ -120,30 +121,22 @@ class OtlpTransformerBase {
|
|
|
120
121
|
} else if (Array.isArray(value)) {
|
|
121
122
|
return {
|
|
122
123
|
arrayValue: {
|
|
123
|
-
values: value.map(v => this.
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
} else if (value && typeof value === 'object') {
|
|
127
|
-
return {
|
|
128
|
-
kvlistValue: {
|
|
129
|
-
values: Object.entries(value).map(([k, v]) => ({
|
|
130
|
-
key: k,
|
|
131
|
-
value: this._transformAnyValue(v)
|
|
132
|
-
}))
|
|
124
|
+
values: value.map(v => this.transformAnyValue(v))
|
|
133
125
|
}
|
|
134
126
|
}
|
|
135
127
|
}
|
|
128
|
+
// Fallback for any unexpected types
|
|
136
129
|
return { stringValue: String(value) }
|
|
137
130
|
}
|
|
138
131
|
|
|
139
132
|
/**
|
|
140
133
|
* Serializes data to protobuf format.
|
|
141
|
-
* @param {
|
|
142
|
-
* @param {
|
|
134
|
+
* @param {object} protoType - Protobuf type from protobuf_loader
|
|
135
|
+
* @param {object} data - Data to serialize
|
|
143
136
|
* @returns {Buffer} Protobuf-encoded data
|
|
144
137
|
* @protected
|
|
145
138
|
*/
|
|
146
|
-
|
|
139
|
+
serializeToProtobuf (protoType, data) {
|
|
147
140
|
const message = protoType.create(data)
|
|
148
141
|
const buffer = protoType.encode(message).finish()
|
|
149
142
|
return buffer
|
|
@@ -151,13 +144,35 @@ class OtlpTransformerBase {
|
|
|
151
144
|
|
|
152
145
|
/**
|
|
153
146
|
* Serializes data to JSON format.
|
|
154
|
-
* @param {
|
|
147
|
+
* @param {object} data - Data to serialize
|
|
155
148
|
* @returns {Buffer} JSON-encoded data
|
|
156
149
|
* @protected
|
|
157
150
|
*/
|
|
158
|
-
|
|
151
|
+
serializeToJson (data) {
|
|
159
152
|
return Buffer.from(JSON.stringify(data))
|
|
160
153
|
}
|
|
161
154
|
}
|
|
162
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Stable stringification of OpenTelemetry Attributes.
|
|
158
|
+
* Ensures consistent serialization regardless of key order by sorting keys.
|
|
159
|
+
* Supports string keys with primitive values or arrays of primitives.
|
|
160
|
+
*
|
|
161
|
+
* @param {Attributes} attributes - Attributes object to stringify
|
|
162
|
+
* @returns {string} Stable string representation
|
|
163
|
+
*/
|
|
164
|
+
function stableStringify (attributes) {
|
|
165
|
+
if (attributes == null) {
|
|
166
|
+
return JSON.stringify(attributes)
|
|
167
|
+
}
|
|
168
|
+
// Attributes are sorted by key to ensure consistent serialization regardless of key order.
|
|
169
|
+
// Keys are always strings and values are always strings, numbers, booleans,
|
|
170
|
+
// or arrays of strings, numbers, or booleans.
|
|
171
|
+
return Object.keys(attributes)
|
|
172
|
+
.sort()
|
|
173
|
+
.map(key => `${key}:${JSON.stringify(attributes[key])}`)
|
|
174
|
+
.join(',')
|
|
175
|
+
}
|
|
176
|
+
|
|
163
177
|
module.exports = OtlpTransformerBase
|
|
178
|
+
module.exports.stableStringify = stableStringify
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* - https://github.com/open-telemetry/opentelemetry-proto (v1.7.0)
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
const protobuf = require('protobufjs')
|
|
18
17
|
const path = require('path')
|
|
18
|
+
const protobuf = require('../../../../../vendor/dist/protobufjs')
|
|
19
19
|
|
|
20
20
|
let _root = null
|
|
21
21
|
let protoLogsService = null
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { performance } = require('perf_hooks')
|
|
3
4
|
const api = require('@opentelemetry/api')
|
|
4
5
|
|
|
5
|
-
const { performance } = require('perf_hooks')
|
|
6
6
|
const { timeOrigin } = performance
|
|
7
7
|
|
|
8
|
-
const { timeInputToHrTime } = require('
|
|
8
|
+
const { timeInputToHrTime } = require('../../../../vendor/dist/@opentelemetry/core')
|
|
9
9
|
|
|
10
10
|
const tracer = require('../../')
|
|
11
11
|
const DatadogSpan = require('../opentracing/span')
|
|
@@ -13,8 +13,8 @@ const { ERROR_MESSAGE, ERROR_TYPE, ERROR_STACK, IGNORE_OTEL_ERROR } = require('.
|
|
|
13
13
|
const { SERVICE_NAME, RESOURCE_NAME, SPAN_KIND } = require('../../../../ext/tags')
|
|
14
14
|
const kinds = require('../../../../ext/kinds')
|
|
15
15
|
|
|
16
|
-
const SpanContext = require('./span_context')
|
|
17
16
|
const id = require('../id')
|
|
17
|
+
const SpanContext = require('./span_context')
|
|
18
18
|
|
|
19
19
|
// The one built into OTel rounds so we lose sub-millisecond precision.
|
|
20
20
|
function hrTimeToMilliseconds (time) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const api = require('@opentelemetry/api')
|
|
4
|
-
const { sanitizeAttributes } = require('
|
|
4
|
+
const { sanitizeAttributes } = require('../../../../vendor/dist/@opentelemetry/core')
|
|
5
5
|
|
|
6
|
-
const Sampler = require('./sampler')
|
|
7
|
-
const Span = require('./span')
|
|
8
6
|
const id = require('../id')
|
|
9
7
|
const log = require('../log')
|
|
10
|
-
const SpanContext = require('./span_context')
|
|
11
8
|
const TextMapPropagator = require('../opentracing/propagation/text_map')
|
|
12
9
|
const TraceState = require('../opentracing/propagation/tracestate')
|
|
10
|
+
const SpanContext = require('./span_context')
|
|
11
|
+
const Span = require('./span')
|
|
12
|
+
const Sampler = require('./sampler')
|
|
13
13
|
|
|
14
14
|
class Tracer {
|
|
15
15
|
constructor (library, config, tracerProvider) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { trace, context, propagation } = require('@opentelemetry/api')
|
|
4
|
-
const { W3CTraceContextPropagator } = require('
|
|
4
|
+
const { W3CTraceContextPropagator } = require('../../../../vendor/dist/@opentelemetry/core')
|
|
5
5
|
|
|
6
6
|
const tracer = require('../../')
|
|
7
7
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { channel } = require('dc-polyfill')
|
|
3
4
|
const pick = require('../../../../datadog-core/src/utils/src/pick')
|
|
4
5
|
const id = require('../../id')
|
|
5
6
|
const DatadogSpanContext = require('../span_context')
|
|
6
7
|
const log = require('../../log')
|
|
7
|
-
const TraceState = require('./tracestate')
|
|
8
8
|
const tags = require('../../../../../ext/tags')
|
|
9
|
-
const { channel } = require('dc-polyfill')
|
|
10
9
|
const { setBaggageItem, getAllBaggageItems, removeAllBaggageItems } = require('../../baggage')
|
|
11
10
|
const telemetryMetrics = require('../../telemetry/metrics')
|
|
12
11
|
|
|
13
12
|
const { AUTO_KEEP, AUTO_REJECT, USER_KEEP } = require('../../../../../ext/priority')
|
|
13
|
+
const TraceState = require('./tracestate')
|
|
14
14
|
|
|
15
15
|
const tracerMetrics = telemetryMetrics.manager.namespace('tracers')
|
|
16
16
|
|
|
@@ -36,6 +36,9 @@ const b3HeaderExpr = /^(([0-9a-f]{16}){1,2}-[0-9a-f]{16}(-[01d](-[0-9a-f]{16})?)
|
|
|
36
36
|
const baggageExpr = new RegExp(`^${baggagePrefix}(.+)$`)
|
|
37
37
|
const tagKeyExpr = /^_dd\.p\.[\x21-\x2B\x2D-\x7E]+$/ // ASCII minus spaces and commas
|
|
38
38
|
const tagValueExpr = /^[\x20-\x2B\x2D-\x7E]*$/ // ASCII minus commas
|
|
39
|
+
// RFC7230 token (used by HTTP header field-name) and compatible with Node's header name validation.
|
|
40
|
+
// See https://www.rfc-editor.org/rfc/rfc7230#section-3.2.6
|
|
41
|
+
const httpHeaderNameExpr = /^[0-9A-Za-z!#$%&'*+\-.^_`|~]+$/
|
|
39
42
|
const traceparentExpr = /^([a-f0-9]{2})-([a-f0-9]{32})-([a-f0-9]{16})-([a-f0-9]{2})(-.*)?$/i
|
|
40
43
|
const traceparentKey = 'traceparent'
|
|
41
44
|
const tracestateKey = 'tracestate'
|
|
@@ -130,9 +133,21 @@ class TextMapPropagator {
|
|
|
130
133
|
|
|
131
134
|
_injectBaggageItems (spanContext, carrier) {
|
|
132
135
|
if (this._config.legacyBaggageEnabled) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
const baggageItems = spanContext?._baggageItems
|
|
137
|
+
if (baggageItems) {
|
|
138
|
+
for (const key of Object.keys(baggageItems)) {
|
|
139
|
+
const headerName = baggagePrefix + key
|
|
140
|
+
|
|
141
|
+
// Legacy OpenTracing baggage is propagated as individual headers (ot-baggage-*),
|
|
142
|
+
// so it must always be representable as a valid HTTP header name.
|
|
143
|
+
if (!httpHeaderNameExpr.test(headerName)) {
|
|
144
|
+
tracerMetrics.count('context_header_style.malformed', ['header_style:baggage']).inc()
|
|
145
|
+
continue
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
carrier[headerName] = String(baggageItems[key])
|
|
149
|
+
}
|
|
150
|
+
}
|
|
136
151
|
}
|
|
137
152
|
if (this._hasPropagationStyle('inject', 'baggage')) {
|
|
138
153
|
let baggage = ''
|
|
@@ -646,9 +661,10 @@ class TextMapPropagator {
|
|
|
646
661
|
|
|
647
662
|
_extractBaggageItems (carrier, spanContext) {
|
|
648
663
|
if (!this._hasPropagationStyle('extract', 'baggage')) return
|
|
649
|
-
if (!carrier
|
|
664
|
+
if (!carrier?.baggage) return
|
|
650
665
|
const baggages = carrier.baggage.split(',')
|
|
651
|
-
const
|
|
666
|
+
const tagAllKeys = this._config.baggageTagKeys === '*'
|
|
667
|
+
const keysToSpanTag = tagAllKeys
|
|
652
668
|
? undefined
|
|
653
669
|
: new Set(this._config.baggageTagKeys.split(','))
|
|
654
670
|
for (const keyValue of baggages) {
|
|
@@ -665,7 +681,7 @@ class TextMapPropagator {
|
|
|
665
681
|
removeAllBaggageItems()
|
|
666
682
|
return
|
|
667
683
|
}
|
|
668
|
-
if (spanContext && (
|
|
684
|
+
if (spanContext && (tagAllKeys || keysToSpanTag?.has(key))) {
|
|
669
685
|
spanContext._trace.tags['baggage.' + key] = value
|
|
670
686
|
}
|
|
671
687
|
setBaggageItem(key, value)
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
const { performance } = require('perf_hooks')
|
|
5
5
|
const now = performance.now.bind(performance)
|
|
6
6
|
const dateNow = Date.now
|
|
7
|
-
const
|
|
7
|
+
const util = require('util')
|
|
8
|
+
const { channel } = require('dc-polyfill')
|
|
8
9
|
const id = require('../id')
|
|
9
10
|
const tagger = require('../tagger')
|
|
10
11
|
const runtimeMetrics = require('../runtime_metrics')
|
|
11
12
|
const log = require('../log')
|
|
12
13
|
const { storage } = require('../../../datadog-core')
|
|
13
14
|
const telemetryMetrics = require('../telemetry/metrics')
|
|
14
|
-
const { channel } = require('dc-polyfill')
|
|
15
|
-
const util = require('util')
|
|
16
15
|
const { getEnvironmentVariable } = require('../config-helper')
|
|
16
|
+
const SpanContext = require('./span_context')
|
|
17
17
|
|
|
18
18
|
const tracerMetrics = telemetryMetrics.manager.namespace('tracers')
|
|
19
19
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const os = require('os')
|
|
4
|
-
const Span = require('./span')
|
|
5
4
|
const SpanProcessor = require('../span_processor')
|
|
6
5
|
const PrioritySampler = require('../priority_sampler')
|
|
6
|
+
const formats = require('../../../../ext/formats')
|
|
7
|
+
const log = require('../log')
|
|
8
|
+
const runtimeMetrics = require('../runtime_metrics')
|
|
9
|
+
const getExporter = require('../exporter')
|
|
10
|
+
const Span = require('./span')
|
|
7
11
|
const TextMapPropagator = require('./propagation/text_map')
|
|
8
12
|
const DSMTextMapPropagator = require('./propagation/text_map_dsm')
|
|
9
13
|
const HttpPropagator = require('./propagation/http')
|
|
10
14
|
const BinaryPropagator = require('./propagation/binary')
|
|
11
15
|
const LogPropagator = require('./propagation/log')
|
|
12
|
-
const formats = require('../../../../ext/formats')
|
|
13
16
|
|
|
14
|
-
const log = require('../log')
|
|
15
|
-
const runtimeMetrics = require('../runtime_metrics')
|
|
16
|
-
const getExporter = require('../exporter')
|
|
17
17
|
const SpanContext = require('./span_context')
|
|
18
18
|
|
|
19
19
|
const REFERENCE_CHILD_OF = 'child_of'
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const rfdc = require('rfdc')({ proto: false, circles: false })
|
|
3
|
+
const rfdc = require('../../../../vendor/dist/rfdc')({ proto: false, circles: false })
|
|
4
4
|
|
|
5
5
|
const {
|
|
6
6
|
PAYLOAD_TAG_REQUEST_PREFIX,
|
|
7
7
|
PAYLOAD_TAG_RESPONSE_PREFIX
|
|
8
8
|
} = require('../constants')
|
|
9
9
|
|
|
10
|
-
const jsonpath = require('jsonpath-plus').JSONPath
|
|
10
|
+
const jsonpath = require('../../../../vendor/dist/jsonpath-plus').JSONPath
|
|
11
11
|
|
|
12
12
|
const { tagsFromObject } = require('./tagging')
|
|
13
13
|
|
|
@@ -38,7 +38,9 @@ function maybeJSONParseValue (value) {
|
|
|
38
38
|
function expand (object, expansionRules) {
|
|
39
39
|
for (const rule of expansionRules) {
|
|
40
40
|
jsonpath(rule, object, (value, _type, desc) => {
|
|
41
|
-
desc.parent
|
|
41
|
+
if (desc.parent && desc.parentProperty) {
|
|
42
|
+
desc.parent[desc.parentProperty] = maybeJSONParseValue(value)
|
|
43
|
+
}
|
|
42
44
|
})
|
|
43
45
|
}
|
|
44
46
|
}
|
|
@@ -52,7 +54,9 @@ function expand (object, expansionRules) {
|
|
|
52
54
|
function redact (object, redactionRules) {
|
|
53
55
|
for (const rule of redactionRules) {
|
|
54
56
|
jsonpath(rule, object, (_value, _type, desc) => {
|
|
55
|
-
desc.parent
|
|
57
|
+
if (desc.parent && desc.parentProperty) {
|
|
58
|
+
desc.parent[desc.parentProperty] = 'redacted'
|
|
59
|
+
}
|
|
56
60
|
})
|
|
57
61
|
}
|
|
58
62
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { channel } = require('dc-polyfill')
|
|
4
|
+
const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
|
|
4
5
|
const { isFalse, isTrue, normalizePluginEnvName } = require('./util')
|
|
5
6
|
const plugins = require('./plugins')
|
|
6
7
|
const log = require('./log')
|
|
7
|
-
const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
|
|
8
8
|
|
|
9
9
|
// Test optimization plugins that should only be enabled when isCiVisibility is true
|
|
10
10
|
const TEST_OPTIMIZATION_PLUGINS = new Set([
|
|
@@ -165,7 +165,8 @@ module.exports = class PluginManager {
|
|
|
165
165
|
traceWebsocketMessagesEnabled,
|
|
166
166
|
traceWebsocketMessagesInheritSampling,
|
|
167
167
|
traceWebsocketMessagesSeparateTraces,
|
|
168
|
-
experimental
|
|
168
|
+
experimental,
|
|
169
|
+
resourceRenamingEnabled
|
|
169
170
|
} = this._tracerConfig
|
|
170
171
|
|
|
171
172
|
const sharedConfig = {
|
|
@@ -184,7 +185,8 @@ module.exports = class PluginManager {
|
|
|
184
185
|
traceWebsocketMessagesEnabled,
|
|
185
186
|
traceWebsocketMessagesInheritSampling,
|
|
186
187
|
traceWebsocketMessagesSeparateTraces,
|
|
187
|
-
experimental
|
|
188
|
+
experimental,
|
|
189
|
+
resourceRenamingEnabled
|
|
188
190
|
}
|
|
189
191
|
|
|
190
192
|
if (logInjection !== undefined) {
|
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { storage } = require('../../../datadog-core')
|
|
4
|
+
const { COMPONENT } = require('../constants')
|
|
5
|
+
const log = require('../log')
|
|
6
|
+
const {
|
|
7
|
+
incrementCountMetric,
|
|
8
|
+
distributionMetric,
|
|
9
|
+
TELEMETRY_EVENT_CREATED,
|
|
10
|
+
TELEMETRY_ITR_SKIPPED
|
|
11
|
+
} = require('../ci-visibility/telemetry')
|
|
12
|
+
const getDiClient = require('../ci-visibility/dynamic-instrumentation')
|
|
13
|
+
const { DD_MAJOR } = require('../../../../version')
|
|
14
|
+
const id = require('../id')
|
|
15
|
+
const { OS_VERSION, OS_PLATFORM, OS_ARCHITECTURE, RUNTIME_NAME, RUNTIME_VERSION } = require('./util/env')
|
|
16
|
+
const {
|
|
17
|
+
CI_PROVIDER_NAME,
|
|
18
|
+
GIT_REPOSITORY_URL,
|
|
19
|
+
GIT_COMMIT_SHA,
|
|
20
|
+
GIT_BRANCH,
|
|
21
|
+
CI_WORKSPACE_PATH,
|
|
22
|
+
GIT_COMMIT_MESSAGE,
|
|
23
|
+
GIT_TAG,
|
|
24
|
+
GIT_PULL_REQUEST_BASE_BRANCH_SHA,
|
|
25
|
+
GIT_COMMIT_HEAD_SHA,
|
|
26
|
+
GIT_PULL_REQUEST_BASE_BRANCH,
|
|
27
|
+
GIT_COMMIT_HEAD_MESSAGE
|
|
28
|
+
} = require('./util/tags')
|
|
29
|
+
const Plugin = require('./plugin')
|
|
30
|
+
const { getRepositoryRoot } = require('./util/git')
|
|
4
31
|
const {
|
|
5
32
|
getTestEnvironmentMetadata,
|
|
6
33
|
getTestSessionName,
|
|
@@ -37,33 +64,6 @@ const {
|
|
|
37
64
|
getPullRequestBaseBranch,
|
|
38
65
|
TEST_IS_TEST_FRAMEWORK_WORKER
|
|
39
66
|
} = require('./util/test')
|
|
40
|
-
const { getRepositoryRoot } = require('./util/git')
|
|
41
|
-
const Plugin = require('./plugin')
|
|
42
|
-
const { COMPONENT } = require('../constants')
|
|
43
|
-
const log = require('../log')
|
|
44
|
-
const {
|
|
45
|
-
incrementCountMetric,
|
|
46
|
-
distributionMetric,
|
|
47
|
-
TELEMETRY_EVENT_CREATED,
|
|
48
|
-
TELEMETRY_ITR_SKIPPED
|
|
49
|
-
} = require('../ci-visibility/telemetry')
|
|
50
|
-
const {
|
|
51
|
-
CI_PROVIDER_NAME,
|
|
52
|
-
GIT_REPOSITORY_URL,
|
|
53
|
-
GIT_COMMIT_SHA,
|
|
54
|
-
GIT_BRANCH,
|
|
55
|
-
CI_WORKSPACE_PATH,
|
|
56
|
-
GIT_COMMIT_MESSAGE,
|
|
57
|
-
GIT_TAG,
|
|
58
|
-
GIT_PULL_REQUEST_BASE_BRANCH_SHA,
|
|
59
|
-
GIT_COMMIT_HEAD_SHA,
|
|
60
|
-
GIT_PULL_REQUEST_BASE_BRANCH,
|
|
61
|
-
GIT_COMMIT_HEAD_MESSAGE
|
|
62
|
-
} = require('./util/tags')
|
|
63
|
-
const { OS_VERSION, OS_PLATFORM, OS_ARCHITECTURE, RUNTIME_NAME, RUNTIME_VERSION } = require('./util/env')
|
|
64
|
-
const getDiClient = require('../ci-visibility/dynamic-instrumentation')
|
|
65
|
-
const { DD_MAJOR } = require('../../../../version')
|
|
66
|
-
const id = require('../id')
|
|
67
67
|
|
|
68
68
|
const FRAMEWORK_TO_TRIMMED_COMMAND = {
|
|
69
69
|
vitest: 'vitest run',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const plugins = {
|
|
4
4
|
get '@anthropic-ai/sdk' () { return require('../../../datadog-plugin-anthropic/src') },
|
|
5
5
|
get '@apollo/gateway' () { return require('../../../datadog-plugin-apollo/src') },
|
|
6
6
|
get '@aws-sdk/smithy-client' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
@@ -13,6 +13,7 @@ module.exports = {
|
|
|
13
13
|
get '@elastic/transport' () { return require('../../../datadog-plugin-elasticsearch/src') },
|
|
14
14
|
get '@google-cloud/pubsub' () { return require('../../../datadog-plugin-google-cloud-pubsub/src') },
|
|
15
15
|
get '@google-cloud/vertexai' () { return require('../../../datadog-plugin-google-cloud-vertexai/src') },
|
|
16
|
+
get '@google/genai' () { return require('../../../datadog-plugin-google-genai/src') },
|
|
16
17
|
get '@grpc/grpc-js' () { return require('../../../datadog-plugin-grpc/src') },
|
|
17
18
|
get '@hapi/hapi' () { return require('../../../datadog-plugin-hapi/src') },
|
|
18
19
|
get '@happy-dom/jest-environment' () { return require('../../../datadog-plugin-jest/src') },
|
|
@@ -25,6 +26,7 @@ module.exports = {
|
|
|
25
26
|
get '@node-redis/client' () { return require('../../../datadog-plugin-redis/src') },
|
|
26
27
|
get '@opensearch-project/opensearch' () { return require('../../../datadog-plugin-opensearch/src') },
|
|
27
28
|
get '@prisma/client' () { return require('../../../datadog-plugin-prisma/src') },
|
|
29
|
+
get './runtime/library.js' () { return require('../../../datadog-plugin-prisma/src') },
|
|
28
30
|
get '@redis/client' () { return require('../../../datadog-plugin-redis/src') },
|
|
29
31
|
get '@smithy/smithy-client' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
30
32
|
get '@vitest/runner' () { return require('../../../datadog-plugin-vitest/src') },
|
|
@@ -34,6 +36,7 @@ module.exports = {
|
|
|
34
36
|
get amqplib () { return require('../../../datadog-plugin-amqplib/src') },
|
|
35
37
|
get avsc () { return require('../../../datadog-plugin-avsc/src') },
|
|
36
38
|
get 'aws-sdk' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
39
|
+
get bullmq () { return require('../../../datadog-plugin-bullmq/src') },
|
|
37
40
|
get bunyan () { return require('../../../datadog-plugin-bunyan/src') },
|
|
38
41
|
get 'cassandra-driver' () { return require('../../../datadog-plugin-cassandra-driver/src') },
|
|
39
42
|
get child_process () { return require('../../../datadog-plugin-child_process/src') },
|
|
@@ -109,3 +112,5 @@ module.exports = {
|
|
|
109
112
|
get winston () { return require('../../../datadog-plugin-winston/src') },
|
|
110
113
|
get ws () { return require('../../../datadog-plugin-ws/src') }
|
|
111
114
|
}
|
|
115
|
+
|
|
116
|
+
module.exports = plugins
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { LOG } = require('../../../../ext/formats')
|
|
4
|
-
const Plugin = require('./plugin')
|
|
5
4
|
const { storage } = require('../../../datadog-core')
|
|
5
|
+
const Plugin = require('./plugin')
|
|
6
6
|
|
|
7
7
|
function messageProxy (message, holder) {
|
|
8
8
|
return new Proxy(message, {
|
|
@@ -6,9 +6,9 @@ const {
|
|
|
6
6
|
PEER_SERVICE_SOURCE_KEY,
|
|
7
7
|
PEER_SERVICE_REMAP_KEY
|
|
8
8
|
} = require('../constants')
|
|
9
|
-
const TracingPlugin = require('./tracing')
|
|
10
9
|
const { exitTags } = require('../../../datadog-code-origin')
|
|
11
10
|
const { storage } = require('../../../datadog-core')
|
|
11
|
+
const TracingPlugin = require('./tracing')
|
|
12
12
|
|
|
13
13
|
const COMMON_PEER_SVC_SOURCE_TAGS = [
|
|
14
14
|
'net.peer.name',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const Plugin = require('./plugin')
|
|
4
3
|
const { storage } = require('../../../datadog-core')
|
|
5
4
|
const analyticsSampler = require('../analytics_sampler')
|
|
6
5
|
const { COMPONENT } = require('../constants')
|
|
6
|
+
const Plugin = require('./plugin')
|
|
7
7
|
|
|
8
8
|
class TracingPlugin extends Plugin {
|
|
9
9
|
constructor (...args) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { readFileSync } = require('fs')
|
|
4
|
+
const { getEnvironmentVariable, getEnvironmentVariables } = require('../../config-helper')
|
|
4
5
|
const {
|
|
5
6
|
GIT_BRANCH,
|
|
6
7
|
GIT_COMMIT_SHA,
|
|
@@ -32,7 +33,6 @@ const {
|
|
|
32
33
|
GIT_PULL_REQUEST_BASE_BRANCH_HEAD_SHA
|
|
33
34
|
} = require('./tags')
|
|
34
35
|
const { filterSensitiveInfoFromRepository } = require('./url')
|
|
35
|
-
const { getEnvironmentVariable, getEnvironmentVariables } = require('../../config-helper')
|
|
36
36
|
|
|
37
37
|
// Receives a string with the form 'John Doe <john.doe@gmail.com>'
|
|
38
38
|
// and returns { name: 'John Doe', email: 'john.doe@gmail.com' }
|
|
@@ -5,6 +5,14 @@ const path = require('path')
|
|
|
5
5
|
const fs = require('fs')
|
|
6
6
|
|
|
7
7
|
const log = require('../../log')
|
|
8
|
+
const {
|
|
9
|
+
incrementCountMetric,
|
|
10
|
+
distributionMetric,
|
|
11
|
+
TELEMETRY_GIT_COMMAND,
|
|
12
|
+
TELEMETRY_GIT_COMMAND_MS,
|
|
13
|
+
TELEMETRY_GIT_COMMAND_ERRORS
|
|
14
|
+
} = require('../../ci-visibility/telemetry')
|
|
15
|
+
const { storage } = require('../../../../datadog-core')
|
|
8
16
|
const {
|
|
9
17
|
GIT_COMMIT_SHA,
|
|
10
18
|
GIT_BRANCH,
|
|
@@ -26,15 +34,7 @@ const {
|
|
|
26
34
|
GIT_COMMIT_HEAD_COMMITTER_NAME,
|
|
27
35
|
GIT_COMMIT_HEAD_MESSAGE
|
|
28
36
|
} = require('./tags')
|
|
29
|
-
const {
|
|
30
|
-
incrementCountMetric,
|
|
31
|
-
distributionMetric,
|
|
32
|
-
TELEMETRY_GIT_COMMAND,
|
|
33
|
-
TELEMETRY_GIT_COMMAND_MS,
|
|
34
|
-
TELEMETRY_GIT_COMMAND_ERRORS
|
|
35
|
-
} = require('../../ci-visibility/telemetry')
|
|
36
37
|
const { filterSensitiveInfoFromRepository } = require('./url')
|
|
37
|
-
const { storage } = require('../../../../datadog-core')
|
|
38
38
|
const { cachedExec } = require('./git-cache')
|
|
39
39
|
|
|
40
40
|
const GIT_REV_LIST_MAX_BUFFER = 12 * 1024 * 1024 // 12MB
|
|
@@ -72,7 +72,7 @@ function parseUserLandFrames (stack, limit = Infinity) {
|
|
|
72
72
|
* @param {number} end - The end index of the line to parse within the stack trace.
|
|
73
73
|
* @returns {StackFrame|undefined} The parsed frame if it is a user frame, `undefined` otherwise.
|
|
74
74
|
*
|
|
75
|
-
* @typedef {
|
|
75
|
+
* @typedef {object} StackFrame
|
|
76
76
|
* @property {string} fileName - The file name of the frame.
|
|
77
77
|
* @property {string} lineNumber - The line number of the frame.
|
|
78
78
|
* @property {string} columnNumber - The column number of the frame.
|