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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const CompositePlugin = require('../../../../dd-trace/src/plugins/composite')
|
|
4
|
-
const BedrockRuntimeTracing = require('./tracing')
|
|
5
4
|
const BedrockRuntimeLLMObsPlugin = require('../../../../dd-trace/src/llmobs/plugins/bedrockruntime')
|
|
5
|
+
const BedrockRuntimeTracing = require('./tracing')
|
|
6
6
|
class BedrockRuntimePlugin extends CompositePlugin {
|
|
7
7
|
static id = 'bedrockruntime'
|
|
8
8
|
|
|
@@ -109,7 +109,7 @@ class DynamoDb extends BaseAwsSdkPlugin {
|
|
|
109
109
|
/**
|
|
110
110
|
* Parses primary key config from the `DD_TRACE_DYNAMODB_TABLE_PRIMARY_KEYS` env var.
|
|
111
111
|
* Only runs when needed, and warns when missing or invalid config.
|
|
112
|
-
* @returns {
|
|
112
|
+
* @returns {object | undefined} Parsed config from env var or undefined if empty/missing/invalid config.
|
|
113
113
|
*/
|
|
114
114
|
getPrimaryKeyConfig () {
|
|
115
115
|
if (this.dynamoPrimaryKeyConfig) {
|
|
@@ -151,8 +151,8 @@ class DynamoDb extends BaseAwsSdkPlugin {
|
|
|
151
151
|
/**
|
|
152
152
|
* Calculates a hash for DynamoDB PutItem operations using table's configured primary keys.
|
|
153
153
|
* @param {string} tableName - Name of the DynamoDB table.
|
|
154
|
-
* @param {
|
|
155
|
-
* @param {
|
|
154
|
+
* @param {object} item - Complete PutItem item parameter to be put.
|
|
155
|
+
* @param {Record<string, Array<string>>} primaryKeyConfig - Mapping of table names to an Array of primary key names
|
|
156
156
|
* loaded from DD_TRACE_DYNAMODB_TABLE_PRIMARY_KEYS.
|
|
157
157
|
* @returns {string|undefined} Hash combining table name and primary key/value pairs, or undefined if unable.
|
|
158
158
|
*/
|
|
@@ -174,7 +174,7 @@ class DynamoDb extends BaseAwsSdkPlugin {
|
|
|
174
174
|
/**
|
|
175
175
|
* Calculates a hash for DynamoDB operations that have keys provided (UpdateItem, DeleteItem).
|
|
176
176
|
* @param {string} tableName - Name of the DynamoDB table.
|
|
177
|
-
* @param {
|
|
177
|
+
* @param {object} keysObject - Object containing primary key/value attributes in DynamoDB format.
|
|
178
178
|
* (e.g., { userId: { S: "123" }, sortKey: { N: "456" } })
|
|
179
179
|
* @returns {string|undefined} Hash value combining table name and primary key/value pairs, or undefined if unable.
|
|
180
180
|
*
|
|
@@ -18,8 +18,8 @@ class EventBridge extends BaseAwsSdkPlugin {
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* requestInject
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
21
|
+
* @param {import('../../../..').Span} span
|
|
22
|
+
* @param {object} request
|
|
23
23
|
*
|
|
24
24
|
* Docs: https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_PutEventsRequestEntry.html
|
|
25
25
|
* We cannot use the traceHeader field as that's reserved for X-Ray.
|
|
@@ -18,7 +18,7 @@ function generatePointerHash (components) {
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Encodes a DynamoDB attribute value to Buffer for span pointer hashing.
|
|
21
|
-
* @param {
|
|
21
|
+
* @param {object} valueObject - DynamoDB value in AWS format ({ S: string } or { N: string } or { B: Buffer })
|
|
22
22
|
* @returns {Buffer|undefined} Encoded value as Buffer, or undefined if invalid input.
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
@@ -55,7 +55,7 @@ function encodeValue (valueObject) {
|
|
|
55
55
|
* Handles tables with single-key and two-key scenarios.
|
|
56
56
|
*
|
|
57
57
|
* @param {Array<string>} keyNames - Set of primary key names.
|
|
58
|
-
* @param {
|
|
58
|
+
* @param {object} keyValuePairs - Object containing key/value pairs.
|
|
59
59
|
* @returns {Array|undefined} [key1Name, key1Value, key2Name, key2Value], or undefined if invalid input.
|
|
60
60
|
* key2 entries are empty strings in the single-key case.
|
|
61
61
|
* @example
|
|
@@ -90,7 +90,7 @@ const extractPrimaryKeys = (keyNames, keyValuePairs) => {
|
|
|
90
90
|
* Automatically detects AWS partitions (standard, China, GovCloud) from region.
|
|
91
91
|
*
|
|
92
92
|
* @param {string} queueURL - SQS queue URL in any supported format
|
|
93
|
-
* @returns {
|
|
93
|
+
* @returns {object | null} Object with queueName and arn, or null if URL format is invalid
|
|
94
94
|
*
|
|
95
95
|
* @example
|
|
96
96
|
* // Modern AWS SQS URLs
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const ProducerPlugin = require('./producer')
|
|
4
3
|
const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
4
|
+
const ProducerPlugin = require('./producer')
|
|
5
5
|
|
|
6
6
|
class AzureEventHubsPlugin extends CompositePlugin {
|
|
7
7
|
static get id () { return 'azure-event-hubs' }
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
|
|
4
4
|
const ProducerPlugin = require('../../dd-trace/src/plugins/producer')
|
|
5
5
|
|
|
6
|
+
const spanContexts = new WeakMap()
|
|
7
|
+
|
|
6
8
|
class AzureEventHubsProducerPlugin extends ProducerPlugin {
|
|
7
9
|
static get id () { return 'azure-event-hubs' }
|
|
8
10
|
static get operation () { return 'send' }
|
|
@@ -36,7 +38,12 @@ class AzureEventHubsProducerPlugin extends ProducerPlugin {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
if (batchLinksAreEnabled()) {
|
|
39
|
-
ctx.batch
|
|
41
|
+
const spanContext = spanContexts.get(ctx.batch)
|
|
42
|
+
if (spanContext) {
|
|
43
|
+
spanContext.push(span.context())
|
|
44
|
+
} else {
|
|
45
|
+
spanContexts.set(ctx.batch, [span.context()])
|
|
46
|
+
}
|
|
40
47
|
injectTraceContext(this.tracer, span, ctx.eventData)
|
|
41
48
|
}
|
|
42
49
|
}
|
|
@@ -53,9 +60,12 @@ class AzureEventHubsProducerPlugin extends ProducerPlugin {
|
|
|
53
60
|
})
|
|
54
61
|
} else {
|
|
55
62
|
if (batchLinksAreEnabled()) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
const contexts = spanContexts.get(eventData)
|
|
64
|
+
if (contexts) {
|
|
65
|
+
for (const spanContext of contexts) {
|
|
66
|
+
span.addLink(spanContext)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
59
69
|
}
|
|
60
70
|
}
|
|
61
71
|
}
|
|
@@ -63,7 +73,11 @@ class AzureEventHubsProducerPlugin extends ProducerPlugin {
|
|
|
63
73
|
}
|
|
64
74
|
|
|
65
75
|
asyncEnd (ctx) {
|
|
66
|
-
super.finish()
|
|
76
|
+
super.finish(ctx)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
end (ctx) {
|
|
80
|
+
super.finish(ctx)
|
|
67
81
|
}
|
|
68
82
|
}
|
|
69
83
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const ProducerPlugin = require('./producer')
|
|
4
3
|
const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
4
|
+
const ProducerPlugin = require('./producer')
|
|
5
5
|
|
|
6
6
|
class AzureServiceBusPlugin extends CompositePlugin {
|
|
7
7
|
static get id () { return 'azure-service-bus' }
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const ConsumerPlugin = require('../../dd-trace/src/plugins/consumer')
|
|
4
|
+
const { getMessageSize } = require('../../dd-trace/src/datastreams')
|
|
5
|
+
|
|
6
|
+
class BullmqConsumerPlugin extends ConsumerPlugin {
|
|
7
|
+
static id = 'bullmq'
|
|
8
|
+
static prefix = 'tracing:orchestrion:bullmq:Worker_callProcessJob'
|
|
9
|
+
|
|
10
|
+
asyncEnd (ctx) {
|
|
11
|
+
ctx.currentStore?.span?.finish()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
bindStart (ctx) {
|
|
15
|
+
const job = ctx.arguments?.[0]
|
|
16
|
+
const queueName = job?.queueName || job?.queue?.name || 'bullmq'
|
|
17
|
+
|
|
18
|
+
let childOf
|
|
19
|
+
const datadogContext = job?.data?._datadog
|
|
20
|
+
if (datadogContext) {
|
|
21
|
+
childOf = this.tracer.extract('text_map', datadogContext)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const span = this.startSpan({
|
|
25
|
+
childOf,
|
|
26
|
+
resource: queueName,
|
|
27
|
+
meta: {
|
|
28
|
+
component: 'bullmq',
|
|
29
|
+
'span.kind': 'consumer',
|
|
30
|
+
'messaging.system': 'bullmq',
|
|
31
|
+
'messaging.destination.name': queueName,
|
|
32
|
+
'messaging.operation': 'process'
|
|
33
|
+
}
|
|
34
|
+
}, ctx)
|
|
35
|
+
|
|
36
|
+
if (this.config.dsmEnabled) {
|
|
37
|
+
this.setConsumerCheckpoint(span, ctx)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return ctx.currentStore
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
setConsumerCheckpoint (span, ctx) {
|
|
44
|
+
const job = ctx.arguments?.[0]
|
|
45
|
+
if (!job) return
|
|
46
|
+
|
|
47
|
+
const queueName = job.queueName || job.queue?.name || 'bullmq'
|
|
48
|
+
const payloadSize = job.data ? getMessageSize(job.data) : 0
|
|
49
|
+
|
|
50
|
+
const datadogContext = job.data?._datadog
|
|
51
|
+
if (datadogContext) {
|
|
52
|
+
this.tracer.decodeDataStreamsContext(datadogContext)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const edgeTags = ['direction:in', `topic:${queueName}`, 'type:bullmq']
|
|
56
|
+
this.tracer.setCheckpoint(edgeTags, span, payloadSize)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = BullmqConsumerPlugin
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
4
|
+
const BullmqProducerPlugins = require('./producer')
|
|
5
|
+
const BullmqConsumerPlugin = require('./consumer')
|
|
6
|
+
|
|
7
|
+
class BullmqPlugin extends CompositePlugin {
|
|
8
|
+
static id = 'bullmq'
|
|
9
|
+
|
|
10
|
+
static plugins = {
|
|
11
|
+
queueAdd: BullmqProducerPlugins[0],
|
|
12
|
+
queueAddBulk: BullmqProducerPlugins[1],
|
|
13
|
+
flowProducerAdd: BullmqProducerPlugins[2],
|
|
14
|
+
consumer: BullmqConsumerPlugin
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports = BullmqPlugin
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const ProducerPlugin = require('../../dd-trace/src/plugins/producer')
|
|
4
|
+
const { DsmPathwayCodec, getMessageSize } = require('../../dd-trace/src/datastreams')
|
|
5
|
+
|
|
6
|
+
class BaseBullmqProducerPlugin extends ProducerPlugin {
|
|
7
|
+
static id = 'bullmq'
|
|
8
|
+
|
|
9
|
+
asyncEnd (ctx) {
|
|
10
|
+
ctx.currentStore?.span?.finish()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
bindStart (ctx) {
|
|
14
|
+
const { resource, meta } = this.getSpanData(ctx)
|
|
15
|
+
const span = this.startSpan({
|
|
16
|
+
resource,
|
|
17
|
+
meta: {
|
|
18
|
+
component: 'bullmq',
|
|
19
|
+
'span.kind': 'producer',
|
|
20
|
+
'messaging.system': 'bullmq',
|
|
21
|
+
'messaging.operation': 'publish',
|
|
22
|
+
...meta
|
|
23
|
+
}
|
|
24
|
+
}, ctx)
|
|
25
|
+
|
|
26
|
+
this.injectTraceContext(span, ctx)
|
|
27
|
+
|
|
28
|
+
if (this.config.dsmEnabled) {
|
|
29
|
+
this.setProducerCheckpoint(span, ctx)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return ctx.currentStore
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getSpanData (ctx) {
|
|
36
|
+
throw new Error('getSpanData must be implemented by subclass')
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
injectTraceContext (span, ctx) {
|
|
40
|
+
throw new Error('injectTraceContext must be implemented by subclass')
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
setProducerCheckpoint (span, ctx) {
|
|
44
|
+
const { queueName, payloadSize, injectTarget } = this.getDsmData(ctx)
|
|
45
|
+
const edgeTags = ['direction:out', `topic:${queueName}`, 'type:bullmq']
|
|
46
|
+
const dataStreamsContext = this.tracer.setCheckpoint(edgeTags, span, payloadSize)
|
|
47
|
+
if (injectTarget && typeof injectTarget === 'object') {
|
|
48
|
+
injectTarget._datadog = injectTarget._datadog || {}
|
|
49
|
+
DsmPathwayCodec.encode(dataStreamsContext, injectTarget._datadog)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
getDsmData (ctx) {
|
|
54
|
+
throw new Error('getDsmData must be implemented by subclass')
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class QueueAddPlugin extends BaseBullmqProducerPlugin {
|
|
59
|
+
static prefix = 'tracing:orchestrion:bullmq:Queue_add'
|
|
60
|
+
|
|
61
|
+
getSpanData (ctx) {
|
|
62
|
+
const queueName = ctx.self?.name || 'bullmq'
|
|
63
|
+
return {
|
|
64
|
+
resource: queueName,
|
|
65
|
+
meta: {
|
|
66
|
+
'messaging.destination.name': ctx.self?.name
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
injectTraceContext (span, ctx) {
|
|
72
|
+
const data = ctx.arguments?.[1]
|
|
73
|
+
if (data?.constructor?.name === 'Object') {
|
|
74
|
+
data._datadog = data._datadog || {}
|
|
75
|
+
this.tracer.inject(span, 'text_map', data._datadog)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
getDsmData (ctx) {
|
|
80
|
+
const data = ctx.arguments?.[1]
|
|
81
|
+
return {
|
|
82
|
+
queueName: ctx.self?.name || 'bullmq',
|
|
83
|
+
payloadSize: data ? getMessageSize(data) : 0,
|
|
84
|
+
injectTarget: data
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
class QueueAddBulkPlugin extends BaseBullmqProducerPlugin {
|
|
90
|
+
static prefix = 'tracing:orchestrion:bullmq:Queue_addBulk'
|
|
91
|
+
|
|
92
|
+
operationName () {
|
|
93
|
+
return 'bullmq.addBulk'
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
getSpanData (ctx) {
|
|
97
|
+
const queueName = ctx.self?.name || 'bullmq'
|
|
98
|
+
const jobs = ctx.arguments?.[0]
|
|
99
|
+
return {
|
|
100
|
+
resource: queueName,
|
|
101
|
+
meta: {
|
|
102
|
+
'messaging.destination.name': ctx.self?.name,
|
|
103
|
+
'messaging.batch.message_count': Array.isArray(jobs) ? jobs.length : undefined
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
injectTraceContext (span, ctx) {
|
|
109
|
+
const jobs = ctx.arguments?.[0]
|
|
110
|
+
if (!Array.isArray(jobs)) return
|
|
111
|
+
for (const job of jobs) {
|
|
112
|
+
if (job?.data?.constructor?.name !== 'Object') continue
|
|
113
|
+
job.data._datadog = job.data._datadog || {}
|
|
114
|
+
this.tracer.inject(span, 'text_map', job.data._datadog)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
getDsmData (ctx) {
|
|
119
|
+
const jobs = ctx.arguments?.[0] || []
|
|
120
|
+
const payloadSize = jobs.reduce((total, job) => {
|
|
121
|
+
return total + (job?.data ? getMessageSize(job.data) : 0)
|
|
122
|
+
}, 0)
|
|
123
|
+
return {
|
|
124
|
+
queueName: ctx.self?.name || 'bullmq',
|
|
125
|
+
payloadSize,
|
|
126
|
+
injectTarget: jobs[0]?.data
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
setProducerCheckpoint (span, ctx) {
|
|
131
|
+
const jobs = ctx.arguments?.[0] || []
|
|
132
|
+
const queueName = ctx.self?.name || 'bullmq'
|
|
133
|
+
const edgeTags = ['direction:out', `topic:${queueName}`, 'type:bullmq']
|
|
134
|
+
|
|
135
|
+
for (const job of jobs) {
|
|
136
|
+
if (job?.data && job.data !== null && job.data.constructor.name === 'Object') {
|
|
137
|
+
const payloadSize = getMessageSize(job.data)
|
|
138
|
+
const dataStreamsContext = this.tracer.setCheckpoint(edgeTags, span, payloadSize)
|
|
139
|
+
job.data._datadog = job.data._datadog || {}
|
|
140
|
+
DsmPathwayCodec.encode(dataStreamsContext, job.data._datadog)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
class FlowProducerAddPlugin extends BaseBullmqProducerPlugin {
|
|
147
|
+
static prefix = 'tracing:orchestrion:bullmq:FlowProducer_add'
|
|
148
|
+
|
|
149
|
+
getSpanData (ctx) {
|
|
150
|
+
const flow = ctx.arguments?.[0]
|
|
151
|
+
const queueName = flow?.queueName || 'bullmq'
|
|
152
|
+
return {
|
|
153
|
+
resource: queueName,
|
|
154
|
+
meta: {
|
|
155
|
+
'messaging.destination.name': flow?.queueName
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
injectTraceContext (span, ctx) {
|
|
161
|
+
const flow = ctx.arguments?.[0]
|
|
162
|
+
if (flow?.data?.constructor?.name === 'Object') {
|
|
163
|
+
flow.data._datadog = flow.data._datadog || {}
|
|
164
|
+
this.tracer.inject(span, 'text_map', flow.data._datadog)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
getDsmData (ctx) {
|
|
169
|
+
const flow = ctx.arguments?.[0]
|
|
170
|
+
return {
|
|
171
|
+
queueName: flow?.queueName || 'bullmq',
|
|
172
|
+
payloadSize: flow?.data ? getMessageSize(flow.data) : 0,
|
|
173
|
+
injectTarget: flow?.data
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
module.exports = [QueueAddPlugin, QueueAddBulkPlugin, FlowProducerAddPlugin]
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const KafkajsPlugin = require('../../datadog-plugin-kafkajs/src/index')
|
|
3
4
|
const ProducerPlugin = require('./producer')
|
|
4
5
|
const ConsumerPlugin = require('./consumer')
|
|
5
6
|
const BatchConsumerPlugin = require('./batch-consumer')
|
|
6
|
-
const KafkajsPlugin = require('../../datadog-plugin-kafkajs/src/index')
|
|
7
7
|
|
|
8
8
|
class ConfluentKafkaJsPlugin extends KafkajsPlugin {
|
|
9
9
|
/**
|
|
@@ -133,6 +133,14 @@ function getCypressCommand (details) {
|
|
|
133
133
|
return `${TEST_FRAMEWORK_NAME} ${details.specPattern || ''}`
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
function getIsTestIsolationEnabled (cypressConfig) {
|
|
137
|
+
if (!cypressConfig) {
|
|
138
|
+
// If we can't read testIsolation config parameter, we default to allowing retries
|
|
139
|
+
return true
|
|
140
|
+
}
|
|
141
|
+
return cypressConfig.testIsolation === undefined ? true : cypressConfig.testIsolation
|
|
142
|
+
}
|
|
143
|
+
|
|
136
144
|
function getLibraryConfiguration (tracer, testConfiguration) {
|
|
137
145
|
return new Promise(resolve => {
|
|
138
146
|
if (!tracer._tracer._exporter?.getLibraryConfiguration) {
|
|
@@ -296,6 +304,12 @@ class CypressPlugin {
|
|
|
296
304
|
this.tracer = tracer
|
|
297
305
|
this.cypressConfig = cypressConfig
|
|
298
306
|
|
|
307
|
+
this.isTestIsolationEnabled = getIsTestIsolationEnabled(cypressConfig)
|
|
308
|
+
|
|
309
|
+
if (!this.isTestIsolationEnabled) {
|
|
310
|
+
log.warn('Test isolation is disabled, retries will not be enabled')
|
|
311
|
+
}
|
|
312
|
+
|
|
299
313
|
// we have to do it here because the tracer is not initialized in the constructor
|
|
300
314
|
this.testEnvironmentMetadata[DD_TEST_IS_USER_PROVIDED_SERVICE] =
|
|
301
315
|
tracer._tracer._config.isServiceUserProvided ? 'true' : 'false'
|
|
@@ -324,7 +338,7 @@ class CypressPlugin {
|
|
|
324
338
|
this.isEarlyFlakeDetectionEnabled = isEarlyFlakeDetectionEnabled
|
|
325
339
|
this.earlyFlakeDetectionNumRetries = earlyFlakeDetectionNumRetries
|
|
326
340
|
this.isKnownTestsEnabled = isKnownTestsEnabled
|
|
327
|
-
if (isFlakyTestRetriesEnabled) {
|
|
341
|
+
if (isFlakyTestRetriesEnabled && this.isTestIsolationEnabled) {
|
|
328
342
|
this.isFlakyTestRetriesEnabled = true
|
|
329
343
|
this.cypressConfig.retries.runMode = flakyTestRetriesCount
|
|
330
344
|
}
|
|
@@ -467,6 +481,7 @@ class CypressPlugin {
|
|
|
467
481
|
// We need to make sure that the plugin is initialized before running the tests
|
|
468
482
|
// This is for the case where the user has not returned the promise from the init function
|
|
469
483
|
await this.libraryConfigurationPromise
|
|
484
|
+
|
|
470
485
|
this.command = getCypressCommand(details)
|
|
471
486
|
this.frameworkVersion = getCypressVersion(details)
|
|
472
487
|
this.rootDir = getRootDir(details)
|
|
@@ -801,7 +816,8 @@ class CypressPlugin {
|
|
|
801
816
|
testManagementTests: this.getTestSuiteProperties(testSuite),
|
|
802
817
|
isImpactedTestsEnabled: this.isImpactedTestsEnabled,
|
|
803
818
|
isModifiedTest: this.getIsTestModified(testSuiteAbsolutePath),
|
|
804
|
-
repositoryRoot: this.repositoryRoot
|
|
819
|
+
repositoryRoot: this.repositoryRoot,
|
|
820
|
+
isTestIsolationEnabled: this.isTestIsolationEnabled
|
|
805
821
|
}
|
|
806
822
|
|
|
807
823
|
if (this.testSuiteSpan) {
|
|
@@ -962,6 +978,11 @@ class CypressPlugin {
|
|
|
962
978
|
this.activeTestSpan.addTags(tags)
|
|
963
979
|
}
|
|
964
980
|
return null
|
|
981
|
+
},
|
|
982
|
+
'dd:log': (message) => {
|
|
983
|
+
// eslint-disable-next-line no-console
|
|
984
|
+
console.log(`[datadog] ${message}`)
|
|
985
|
+
return null
|
|
965
986
|
}
|
|
966
987
|
}
|
|
967
988
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const NoopTracer = require('../../dd-trace/src/noop/tracer')
|
|
4
|
-
const
|
|
5
|
-
const satisfies = require('semifies')
|
|
4
|
+
const satisfies = require('../../../vendor/dist/semifies')
|
|
6
5
|
const { DD_MAJOR } = require('../../../version')
|
|
6
|
+
const cypressPlugin = require('./cypress-plugin')
|
|
7
7
|
|
|
8
8
|
const noopTask = {
|
|
9
9
|
'dd:testSuiteStart': () => {
|
|
@@ -9,6 +9,9 @@ let testManagementAttemptToFixRetries = 0
|
|
|
9
9
|
let testManagementTests = {}
|
|
10
10
|
let isImpactedTestsEnabled = false
|
|
11
11
|
let isModifiedTest = false
|
|
12
|
+
let isTestIsolationEnabled = false
|
|
13
|
+
// Array of test names that have been retried and the reason
|
|
14
|
+
const retryReasonsByTestName = new Map()
|
|
12
15
|
|
|
13
16
|
// We need to grab the original window as soon as possible,
|
|
14
17
|
// in case the test changes the origin. If the test does change the origin,
|
|
@@ -43,17 +46,20 @@ function getTestProperties (testName) {
|
|
|
43
46
|
return { isAttemptToFix, isDisabled, isQuarantined }
|
|
44
47
|
}
|
|
45
48
|
|
|
46
|
-
function
|
|
49
|
+
function getRetriedTests (test, numRetries, tags) {
|
|
50
|
+
const retriedTests = []
|
|
47
51
|
for (let retryIndex = 0; retryIndex < numRetries; retryIndex++) {
|
|
48
|
-
const clonedTest = test.clone()
|
|
49
52
|
// TODO: signal in framework logs that this is a retry.
|
|
50
53
|
// TODO: Change it so these tests are allowed to fail.
|
|
51
|
-
|
|
52
|
-
suiteTests.unshift(clonedTest)
|
|
54
|
+
const clonedTest = test.clone()
|
|
53
55
|
tags.forEach(tag => {
|
|
54
|
-
|
|
56
|
+
if (tag) {
|
|
57
|
+
clonedTest[tag] = true
|
|
58
|
+
}
|
|
55
59
|
})
|
|
60
|
+
retriedTests.push(clonedTest)
|
|
56
61
|
}
|
|
62
|
+
return retriedTests
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
const oldRunTests = Cypress.mocha.getRunner().runTests
|
|
@@ -61,45 +67,80 @@ Cypress.mocha.getRunner().runTests = function (suite, fn) {
|
|
|
61
67
|
if (!isKnownTestsEnabled && !isTestManagementEnabled && !isImpactedTestsEnabled) {
|
|
62
68
|
return oldRunTests.apply(this, arguments)
|
|
63
69
|
}
|
|
64
|
-
// We copy the
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
const testName = test.fullTitle()
|
|
70
|
+
// We copy the tests array and add retries to it, then assign it back to suite.tests
|
|
71
|
+
// to avoid modifying the array while iterating over it
|
|
72
|
+
const testsWithRetries = []
|
|
68
73
|
|
|
74
|
+
for (let testIndex = 0; testIndex < suite.tests.length; testIndex++) {
|
|
75
|
+
const test = suite.tests[testIndex]
|
|
76
|
+
const testName = test.fullTitle()
|
|
69
77
|
const { isAttemptToFix } = getTestProperties(testName)
|
|
78
|
+
const isSkipped = test.isPending()
|
|
70
79
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
const isAtemptToFix = isTestManagementEnabled && isAttemptToFix && !isSkipped
|
|
81
|
+
const isModified = isImpactedTestsEnabled && isModifiedTest
|
|
82
|
+
const isNew = isKnownTestsEnabled && !isSkipped && isNewTest(test)
|
|
83
|
+
|
|
84
|
+
// We want is_modified and is_new regardless of the retry reason
|
|
85
|
+
if (isModified) {
|
|
76
86
|
test._ddIsModified = true
|
|
77
|
-
if (isEarlyFlakeDetectionEnabled && !isAttemptToFix) {
|
|
78
|
-
retryTest(
|
|
79
|
-
test,
|
|
80
|
-
suite.tests,
|
|
81
|
-
earlyFlakeDetectionNumRetries,
|
|
82
|
-
['_ddIsModified', '_ddIsEfdRetry', isKnownTestsEnabled && isNewTest(test) && '_ddIsNew']
|
|
83
|
-
)
|
|
84
|
-
}
|
|
85
87
|
}
|
|
86
|
-
if (
|
|
88
|
+
if (isNew) {
|
|
87
89
|
test._ddIsNew = true
|
|
88
|
-
if (isImpactedTestsEnabled && isModifiedTest) {
|
|
89
|
-
test._ddIsModified = true
|
|
90
|
-
}
|
|
91
|
-
if (isEarlyFlakeDetectionEnabled && !isAttemptToFix && !isModifiedTest) {
|
|
92
|
-
retryTest(test, suite.tests, earlyFlakeDetectionNumRetries, ['_ddIsNew', '_ddIsEfdRetry'])
|
|
93
|
-
}
|
|
94
90
|
}
|
|
95
|
-
|
|
91
|
+
|
|
92
|
+
// Add the original test first
|
|
93
|
+
testsWithRetries.push(test)
|
|
94
|
+
|
|
95
|
+
if (!isTestIsolationEnabled) {
|
|
96
|
+
continue
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Then add retries right after it
|
|
100
|
+
let retriedTests = []
|
|
101
|
+
let retryMessage = ''
|
|
102
|
+
if (isAtemptToFix) {
|
|
103
|
+
test._ddIsAttemptToFix = true
|
|
104
|
+
retryMessage = 'because it is an attempt to fix'
|
|
105
|
+
retriedTests = getRetriedTests(test, testManagementAttemptToFixRetries, ['_ddIsAttemptToFix'])
|
|
106
|
+
} else if (isModified && isEarlyFlakeDetectionEnabled) {
|
|
107
|
+
retryMessage = 'to detect flakes because it is modified'
|
|
108
|
+
retriedTests = getRetriedTests(test, earlyFlakeDetectionNumRetries, [
|
|
109
|
+
'_ddIsModified',
|
|
110
|
+
'_ddIsEfdRetry',
|
|
111
|
+
isKnownTestsEnabled && isNewTest(test) && '_ddIsNew'
|
|
112
|
+
])
|
|
113
|
+
} else if (isNew && isEarlyFlakeDetectionEnabled) {
|
|
114
|
+
retryMessage = 'to detect flakes because it is new'
|
|
115
|
+
retriedTests = getRetriedTests(test, earlyFlakeDetectionNumRetries, ['_ddIsNew', '_ddIsEfdRetry'])
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
testsWithRetries.push(...retriedTests)
|
|
119
|
+
|
|
120
|
+
if (retryMessage) {
|
|
121
|
+
retryReasonsByTestName.set(testName, retryMessage)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
suite.tests = testsWithRetries
|
|
96
126
|
|
|
97
127
|
return oldRunTests.apply(this, [suite, fn])
|
|
98
128
|
}
|
|
99
129
|
|
|
100
130
|
beforeEach(function () {
|
|
131
|
+
const testName = Cypress.mocha.getRunner().suite.ctx.currentTest.fullTitle()
|
|
132
|
+
|
|
133
|
+
const retryMessage = retryReasonsByTestName.get(testName)
|
|
134
|
+
if (retryMessage) {
|
|
135
|
+
cy.task(
|
|
136
|
+
'dd:log',
|
|
137
|
+
`Retrying "${testName}" ${retryMessage}`
|
|
138
|
+
)
|
|
139
|
+
retryReasonsByTestName.delete(testName)
|
|
140
|
+
}
|
|
141
|
+
|
|
101
142
|
cy.task('dd:beforeEach', {
|
|
102
|
-
testName
|
|
143
|
+
testName,
|
|
103
144
|
testSuite: Cypress.mocha.getRootSuite().file
|
|
104
145
|
}).then(({ traceId, shouldSkip }) => {
|
|
105
146
|
Cypress.env('traceId', traceId)
|
|
@@ -127,6 +168,7 @@ before(function () {
|
|
|
127
168
|
testManagementTests = suiteConfig.testManagementTests
|
|
128
169
|
isImpactedTestsEnabled = suiteConfig.isImpactedTestsEnabled
|
|
129
170
|
isModifiedTest = suiteConfig.isModifiedTest
|
|
171
|
+
isTestIsolationEnabled = suiteConfig.isTestIsolationEnabled
|
|
130
172
|
}
|
|
131
173
|
})
|
|
132
174
|
})
|