dd-trace 5.81.0 → 5.83.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 +78 -79
- package/ci/init.js +6 -6
- package/index.d.ts +159 -3
- package/loader-hook.mjs +8 -3
- package/package.json +64 -66
- package/packages/datadog-core/src/storage.js +7 -7
- package/packages/datadog-core/src/utils/src/parse-tags.js +1 -1
- package/packages/datadog-esbuild/index.js +14 -7
- package/packages/datadog-esbuild/src/utils.js +14 -2
- package/packages/datadog-instrumentations/src/aerospike.js +3 -2
- package/packages/datadog-instrumentations/src/ai.js +9 -5
- 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 +2 -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 +1 -1
- 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 +3 -3
- 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 +13 -14
- 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/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 +3 -3
- package/packages/datadog-instrumentations/src/graphql.js +2 -2
- 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 +4 -1
- package/packages/datadog-instrumentations/src/helpers/instrument.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/instrumentations.js +4 -3
- package/packages/datadog-instrumentations/src/helpers/register.js +9 -11
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +2 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/bullmq.json +106 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +2 -1
- 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/http/client.js +2 -2
- 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 +37 -16
- package/packages/datadog-instrumentations/src/kafkajs.js +3 -3
- package/packages/datadog-instrumentations/src/knex.js +1 -1
- package/packages/datadog-instrumentations/src/koa.js +2 -1
- 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 +2 -2
- package/packages/datadog-instrumentations/src/mocha/worker.js +1 -1
- package/packages/datadog-instrumentations/src/mocha.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 +2 -2
- package/packages/datadog-instrumentations/src/mysql2.js +3 -3
- package/packages/datadog-instrumentations/src/net.js +14 -6
- package/packages/datadog-instrumentations/src/next.js +1 -1
- package/packages/datadog-instrumentations/src/nyc.js +2 -2
- 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 +5 -5
- package/packages/datadog-instrumentations/src/pg.js +7 -5
- package/packages/datadog-instrumentations/src/pino.js +1 -1
- package/packages/datadog-instrumentations/src/playwright.js +4 -4
- 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/selenium.js +3 -3
- 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 +15 -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 +3 -2
- 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/base.js +4 -4
- 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 +21 -7
- package/packages/datadog-plugin-azure-service-bus/src/index.js +1 -1
- package/packages/datadog-plugin-azure-service-bus/src/producer.js +6 -2
- 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-confluentinc-kafka-javascript/src/index.js +1 -1
- package/packages/datadog-plugin-cucumber/src/index.js +2 -2
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +2 -2
- package/packages/datadog-plugin-cypress/src/plugin.js +1 -1
- package/packages/datadog-plugin-dd-trace-api/src/index.js +2 -2
- package/packages/datadog-plugin-express/src/code_origin.js +21 -15
- package/packages/datadog-plugin-express/src/index.js +1 -1
- package/packages/datadog-plugin-fastify/src/code_origin.js +17 -4
- 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 +1 -1
- package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
- 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/index.js +2 -2
- package/packages/datadog-plugin-kafkajs/src/index.js +1 -1
- package/packages/datadog-plugin-langchain/src/index.js +1 -1
- package/packages/datadog-plugin-mocha/src/index.js +2 -2
- package/packages/datadog-plugin-moleculer/src/index.js +1 -1
- package/packages/datadog-plugin-mongodb-core/src/index.js +8 -4
- 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-playwright/src/index.js +3 -3
- package/packages/datadog-plugin-rhea/src/index.js +1 -1
- package/packages/datadog-plugin-undici/src/index.js +305 -2
- package/packages/datadog-plugin-vitest/src/index.js +5 -5
- 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/index.js +19 -0
- package/packages/dd-trace/src/aiguard/sdk.js +3 -3
- 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/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.js +11 -15
- 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 +3 -3
- 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 +3 -5
- 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 -3
- 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 +15 -4
- package/packages/dd-trace/src/baggage.js +36 -11
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +5 -1
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +6 -0
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/index.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +4 -3
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +3 -3
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +5 -5
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/writer.js +1 -1
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +2 -2
- package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +4 -4
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +4 -4
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +2 -2
- package/packages/dd-trace/src/{config_defaults.js → config/defaults.js} +5 -4
- package/packages/dd-trace/src/{config-helper.js → config/helper.js} +88 -15
- package/packages/dd-trace/src/{config.js → config/index.js} +115 -67
- package/packages/dd-trace/src/config/remote_config.js +202 -0
- package/packages/dd-trace/src/{config_stable.js → config/stable.js} +20 -32
- package/packages/dd-trace/src/{supported-configurations.json → config/supported-configurations.json} +5 -0
- package/packages/dd-trace/src/constants.js +5 -0
- package/packages/dd-trace/src/crashtracking/crashtracker.js +11 -2
- package/packages/dd-trace/src/datastreams/checkpointer.js +2 -2
- package/packages/dd-trace/src/datastreams/index.js +1 -1
- package/packages/dd-trace/src/datastreams/pathway.js +7 -7
- package/packages/dd-trace/src/datastreams/processor.js +3 -3
- package/packages/dd-trace/src/datastreams/writer.js +3 -3
- package/packages/dd-trace/src/debugger/config.js +1 -0
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/config.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/index.js +7 -2
- package/packages/dd-trace/src/debugger/devtools_client/send.js +6 -6
- package/packages/dd-trace/src/debugger/devtools_client/session.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +5 -5
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/constants.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +2 -2
- package/packages/dd-trace/src/debugger/devtools_client/state.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/status.js +2 -2
- package/packages/dd-trace/src/debugger/index.js +84 -16
- package/packages/dd-trace/src/dogstatsd.js +5 -4
- package/packages/dd-trace/src/encode/0.4.js +3 -3
- 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 +6 -1
- package/packages/dd-trace/src/exporter.js +2 -2
- package/packages/dd-trace/src/exporters/agent/index.js +2 -4
- package/packages/dd-trace/src/exporters/agent/writer.js +9 -14
- package/packages/dd-trace/src/exporters/common/agent-info-exporter.js +2 -2
- package/packages/dd-trace/src/exporters/common/docker.js +2 -2
- package/packages/dd-trace/src/exporters/common/request.js +3 -3
- package/packages/dd-trace/src/exporters/common/util.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 +2 -2
- package/packages/dd-trace/src/guardrails/index.js +6 -3
- package/packages/dd-trace/src/guardrails/telemetry.js +1 -1
- package/packages/dd-trace/src/id.js +1 -1
- package/packages/dd-trace/src/index.js +4 -4
- package/packages/dd-trace/src/lambda/handler.js +5 -5
- package/packages/dd-trace/src/lambda/index.js +2 -2
- package/packages/dd-trace/src/lambda/runtime/patch.js +6 -6
- package/packages/dd-trace/src/lambda/runtime/ritm.js +3 -3
- package/packages/dd-trace/src/llmobs/constants/tags.js +14 -1
- package/packages/dd-trace/src/llmobs/index.js +10 -11
- package/packages/dd-trace/src/llmobs/noop.js +2 -0
- 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/util.js +2 -2
- 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/openai/constants.js +16 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +19 -5
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +22 -10
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +1 -1
- package/packages/dd-trace/src/llmobs/sdk.js +46 -26
- package/packages/dd-trace/src/llmobs/span_processor.js +26 -20
- package/packages/dd-trace/src/llmobs/tagger.js +175 -1
- package/packages/dd-trace/src/llmobs/telemetry.js +3 -4
- package/packages/dd-trace/src/llmobs/writers/base.js +117 -38
- package/packages/dd-trace/src/llmobs/writers/spans.js +5 -5
- package/packages/dd-trace/src/log/index.js +5 -5
- package/packages/dd-trace/src/noop/proxy.js +5 -5
- 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 +12 -13
- 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/logger.js +1 -1
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +4 -4
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +9 -8
- package/packages/dd-trace/src/opentelemetry/metrics/instruments.js +3 -3
- package/packages/dd-trace/src/opentelemetry/metrics/meter.js +2 -2
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +4 -4
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +36 -11
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +2 -2
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +11 -10
- package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +1 -1
- package/packages/dd-trace/src/opentelemetry/span.js +2 -2
- package/packages/dd-trace/src/opentelemetry/tracer.js +51 -9
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +68 -28
- package/packages/dd-trace/src/opentracing/span.js +7 -7
- package/packages/dd-trace/src/opentracing/tracer.js +5 -5
- package/packages/dd-trace/src/payload-tagging/index.js +6 -2
- package/packages/dd-trace/src/plugin_manager.js +8 -6
- 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 +5 -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 +5 -8
- package/packages/dd-trace/src/plugins/util/git-cache.js +3 -3
- 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 +25 -25
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +41 -43
- package/packages/dd-trace/src/plugins/util/web.js +8 -5
- package/packages/dd-trace/src/priority_sampler.js +15 -16
- package/packages/dd-trace/src/process-tags/index.js +31 -29
- package/packages/dd-trace/src/profiler.js +4 -39
- package/packages/dd-trace/src/profiling/config.js +104 -50
- package/packages/dd-trace/src/profiling/exporter_cli.js +8 -8
- package/packages/dd-trace/src/profiling/exporters/agent.js +6 -6
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +9 -2
- 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 +61 -7
- package/packages/dd-trace/src/profiling/profilers/event_plugins/event.js +1 -1
- package/packages/dd-trace/src/profiling/profilers/events.js +2 -2
- package/packages/dd-trace/src/profiling/profilers/wall.js +4 -4
- package/packages/dd-trace/src/proxy.js +43 -20
- package/packages/dd-trace/src/remote_config/capabilities.js +3 -0
- 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 +58 -31
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +3 -3
- package/packages/dd-trace/src/serverless.js +17 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +8 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +8 -0
- package/packages/dd-trace/src/span_format.js +1 -1
- package/packages/dd-trace/src/span_processor.js +4 -4
- package/packages/dd-trace/src/span_stats.js +6 -4
- package/packages/dd-trace/src/standalone/index.js +1 -1
- package/packages/dd-trace/src/startup-log.js +7 -16
- package/packages/dd-trace/src/telemetry/dependencies.js +3 -3
- package/packages/dd-trace/src/telemetry/endpoints.js +75 -13
- package/packages/dd-trace/src/telemetry/logs/index.js +1 -1
- package/packages/dd-trace/src/telemetry/send-data.js +103 -4
- package/packages/dd-trace/src/telemetry/telemetry.js +238 -114
- package/packages/dd-trace/src/tracer.js +3 -3
- package/packages/dd-trace/src/tracer_metadata.js +19 -15
- package/packages/dd-trace/src/remote_config/manager.js +0 -368
- /package/packages/dd-trace/src/{git_properties.js → config/git_properties.js} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const os = require('os')
|
|
4
4
|
const fs = require('fs')
|
|
5
|
-
const { getEnvironmentVariable } = require('
|
|
5
|
+
const { getEnvironmentVariable } = require('./helper')
|
|
6
6
|
|
|
7
7
|
class StableConfig {
|
|
8
8
|
constructor () {
|
|
@@ -11,14 +11,10 @@ class StableConfig {
|
|
|
11
11
|
this.fleetEntries = {}
|
|
12
12
|
this.wasm_loaded = false
|
|
13
13
|
|
|
14
|
-
const { localConfigPath, fleetConfigPath } = this
|
|
15
|
-
if (!fs.existsSync(localConfigPath) && !fs.existsSync(fleetConfigPath)) {
|
|
16
|
-
// Bail out early if files don't exist to avoid unnecessary library loading
|
|
17
|
-
return
|
|
18
|
-
}
|
|
14
|
+
const { localConfigPath, fleetConfigPath } = this.#getStableConfigPaths()
|
|
19
15
|
|
|
20
|
-
const localConfig = this
|
|
21
|
-
const fleetConfig = this
|
|
16
|
+
const localConfig = this.#readConfigFromPath(localConfigPath)
|
|
17
|
+
const fleetConfig = this.#readConfigFromPath(fleetConfigPath)
|
|
22
18
|
if (!localConfig && !fleetConfig) {
|
|
23
19
|
// Bail out early if files are empty or we can't read them to avoid unnecessary library loading
|
|
24
20
|
return
|
|
@@ -47,7 +43,7 @@ class StableConfig {
|
|
|
47
43
|
// eslint-disable-next-line eslint-rules/eslint-process-env
|
|
48
44
|
configurator.set_envp(Object.entries(process.env).map(([key, value]) => `${key}=${value}`))
|
|
49
45
|
configurator.set_args(process.argv)
|
|
50
|
-
configurator.get_configuration(localConfig
|
|
46
|
+
configurator.get_configuration(localConfig, fleetConfig).forEach((entry) => {
|
|
51
47
|
if (entry.source === 'local_stable_config') {
|
|
52
48
|
this.localEntries[entry.name] = entry.value
|
|
53
49
|
} else if (entry.source === 'fleet_stable_config') {
|
|
@@ -59,43 +55,35 @@ class StableConfig {
|
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
57
|
|
|
62
|
-
|
|
58
|
+
#readConfigFromPath (path) {
|
|
63
59
|
try {
|
|
64
60
|
return fs.readFileSync(path, 'utf8')
|
|
65
61
|
} catch (err) {
|
|
66
62
|
if (err.code !== 'ENOENT') {
|
|
67
63
|
this.warnings.push(`Error reading config file at ${path}. ${err.code}: ${err.message}`)
|
|
68
64
|
}
|
|
69
|
-
return '' // Always return a string
|
|
65
|
+
return '' // Always return a string for configurator.get_configuration()
|
|
70
66
|
}
|
|
71
67
|
}
|
|
72
68
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
fleetConfigPath = '/etc/datadog-agent/managed/datadog-agent/stable/application_monitoring.yaml'
|
|
80
|
-
break
|
|
69
|
+
#getStableConfigPaths () {
|
|
70
|
+
// TODO(BridgeAR): Remove these environment variables once we have a proper way to test the stable config.
|
|
71
|
+
// Allow overriding the paths for testing
|
|
72
|
+
let localConfigPath = getEnvironmentVariable('DD_TEST_LOCAL_CONFIG_PATH')
|
|
73
|
+
let fleetConfigPath = getEnvironmentVariable('DD_TEST_FLEET_CONFIG_PATH')
|
|
74
|
+
switch (os.platform()) {
|
|
81
75
|
case 'darwin':
|
|
82
|
-
localConfigPath
|
|
83
|
-
fleetConfigPath
|
|
76
|
+
localConfigPath ??= '/opt/datadog-agent/etc/application_monitoring.yaml'
|
|
77
|
+
fleetConfigPath ??= '/opt/datadog-agent/etc/managed/datadog-agent/stable/application_monitoring.yaml'
|
|
84
78
|
break
|
|
85
79
|
case 'win32':
|
|
86
|
-
localConfigPath
|
|
87
|
-
fleetConfigPath
|
|
80
|
+
localConfigPath ??= String.raw`C:\ProgramData\Datadog\application_monitoring.yaml`
|
|
81
|
+
fleetConfigPath ??= String.raw`C:\ProgramData\Datadog\managed\datadog-agent\stable\application_monitoring.yaml`
|
|
88
82
|
break
|
|
89
83
|
default:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// Allow overriding the paths for testing
|
|
94
|
-
if (getEnvironmentVariable('DD_TEST_LOCAL_CONFIG_PATH') !== undefined) {
|
|
95
|
-
localConfigPath = getEnvironmentVariable('DD_TEST_LOCAL_CONFIG_PATH')
|
|
96
|
-
}
|
|
97
|
-
if (getEnvironmentVariable('DD_TEST_FLEET_CONFIG_PATH') !== undefined) {
|
|
98
|
-
fleetConfigPath = getEnvironmentVariable('DD_TEST_FLEET_CONFIG_PATH')
|
|
84
|
+
// Linux and other platforms as fallback
|
|
85
|
+
localConfigPath ??= '/etc/datadog-agent/application_monitoring.yaml'
|
|
86
|
+
fleetConfigPath ??= '/etc/datadog-agent/managed/datadog-agent/stable/application_monitoring.yaml'
|
|
99
87
|
}
|
|
100
88
|
|
|
101
89
|
return { localConfigPath, fleetConfigPath }
|
package/packages/dd-trace/src/{supported-configurations.json → config/supported-configurations.json}
RENAMED
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"DD_APPSEC_STACK_TRACE_ENABLED": ["A"],
|
|
38
38
|
"DD_APPSEC_TRACE_RATE_LIMIT": ["A"],
|
|
39
39
|
"DD_APPSEC_WAF_TIMEOUT": ["A"],
|
|
40
|
+
"DD_AZURE_RESOURCE_GROUP": ["A"],
|
|
40
41
|
"DD_CIVISIBILITY_AGENTLESS_ENABLED": ["A"],
|
|
41
42
|
"DD_CIVISIBILITY_AGENTLESS_URL": ["A"],
|
|
42
43
|
"DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER": ["A"],
|
|
@@ -92,6 +93,7 @@
|
|
|
92
93
|
"DD_GIT_TAG": ["A"],
|
|
93
94
|
"DD_GIT_PULL_REQUEST_BASE_BRANCH": ["A"],
|
|
94
95
|
"DD_GIT_PULL_REQUEST_BASE_BRANCH_SHA": ["A"],
|
|
96
|
+
"DD_GIT_COMMIT_HEAD_SHA": ["A"],
|
|
95
97
|
"DD_GRPC_CLIENT_ERROR_STATUSES": ["A"],
|
|
96
98
|
"DD_GRPC_SERVER_ERROR_STATUSES": ["A"],
|
|
97
99
|
"DD_HEAP_SNAPSHOT_COUNT": ["A"],
|
|
@@ -111,6 +113,7 @@
|
|
|
111
113
|
"DD_IAST_TELEMETRY_VERBOSITY": ["A"],
|
|
112
114
|
"DD_INJECT_FORCE": ["A"],
|
|
113
115
|
"DD_INJECTION_ENABLED": ["A"],
|
|
116
|
+
"DD_ENABLE_NX_SERVICE_NAME": ["A"],
|
|
114
117
|
"DD_INSTRUMENTATION_CONFIG_ID": ["A"],
|
|
115
118
|
"DD_INSTRUMENTATION_INSTALL_ID": ["A"],
|
|
116
119
|
"DD_INSTRUMENTATION_INSTALL_TIME": ["A"],
|
|
@@ -162,6 +165,7 @@
|
|
|
162
165
|
"DD_RUNTIME_METRICS_GC_ENABLED": ["A"],
|
|
163
166
|
"DD_RUNTIME_METRICS_FLUSH_INTERVAL": ["A"],
|
|
164
167
|
"DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED": ["A"],
|
|
168
|
+
"DD_TRACE_GCP_PUBSUB_PUSH_ENABLED": ["A"],
|
|
165
169
|
"DD_SERVICE_MAPPING": ["A"],
|
|
166
170
|
"DD_SERVICE": ["A"],
|
|
167
171
|
"DD_SITE": ["A"],
|
|
@@ -243,6 +247,7 @@
|
|
|
243
247
|
"DD_TRACE_BAGGAGE_TAG_KEYS": ["A"],
|
|
244
248
|
"DD_TRACE_BEAUTIFUL_LOGS": ["A"],
|
|
245
249
|
"DD_TRACE_BLUEBIRD_ENABLED": ["A"],
|
|
250
|
+
"DD_TRACE_BULLMQ_ENABLED": ["A"],
|
|
246
251
|
"DD_TRACE_BODY_PARSER_ENABLED": ["A"],
|
|
247
252
|
"DD_TRACE_BSON_ENABLED": ["A"],
|
|
248
253
|
"DD_TRACE_BUNYAN_ENABLED": ["A"],
|
|
@@ -50,8 +50,13 @@ module.exports = {
|
|
|
50
50
|
GRPC_SERVER_ERROR_STATUSES: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
|
|
51
51
|
DYNAMODB_PTR_KIND: 'aws.dynamodb.item',
|
|
52
52
|
S3_PTR_KIND: 'aws.s3.object',
|
|
53
|
+
WEBSOCKET_PTR_KIND: 'websocket',
|
|
53
54
|
SPAN_POINTER_DIRECTION: Object.freeze({
|
|
54
55
|
UPSTREAM: 'u',
|
|
55
56
|
DOWNSTREAM: 'd'
|
|
57
|
+
}),
|
|
58
|
+
SPAN_POINTER_DIRECTION_NAME: Object.freeze({
|
|
59
|
+
UPSTREAM: 'span-pointer-up',
|
|
60
|
+
DOWNSTREAM: 'span-pointer-down'
|
|
56
61
|
})
|
|
57
62
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { URL } = require('url')
|
|
4
|
+
|
|
3
5
|
// Load binding first to not import other modules if it throws
|
|
4
6
|
const libdatadog = require('@datadog/libdatadog')
|
|
5
7
|
const binding = libdatadog.load('crashtracker')
|
|
6
8
|
|
|
7
9
|
const log = require('../log')
|
|
8
|
-
const defaults = require('../
|
|
9
|
-
const { URL } = require('url')
|
|
10
|
+
const defaults = require('../config/defaults')
|
|
10
11
|
const pkg = require('../../../../package.json')
|
|
12
|
+
const processTags = require('../process-tags')
|
|
11
13
|
|
|
12
14
|
class Crashtracker {
|
|
13
15
|
#started = false
|
|
@@ -77,6 +79,13 @@ class Crashtracker {
|
|
|
77
79
|
#getMetadata (config) {
|
|
78
80
|
const tags = Object.keys(config.tags).map(key => `${key}:${config.tags[key]}`)
|
|
79
81
|
|
|
82
|
+
// Add process tags to the tags array
|
|
83
|
+
for (const [key, value] of processTags.tags) {
|
|
84
|
+
if (value !== undefined) {
|
|
85
|
+
tags.push(`${key}:${value}`)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
80
89
|
return {
|
|
81
90
|
library_name: pkg.name,
|
|
82
91
|
library_version: pkg.version,
|
|
@@ -13,7 +13,7 @@ class DataStreamsCheckpointer {
|
|
|
13
13
|
* @param {string} type - The type of the checkpoint, usually the streaming technology being used.
|
|
14
14
|
* Examples include kafka, kinesis, sns etc.
|
|
15
15
|
* @param {string} target - The target of data. This can be a topic, exchange or stream name.
|
|
16
|
-
* @param {
|
|
16
|
+
* @param {object} carrier - The carrier object to inject context into.
|
|
17
17
|
*/
|
|
18
18
|
setProduceCheckpoint (type, target, carrier) {
|
|
19
19
|
if (!this.config.dsmEnabled) return
|
|
@@ -33,7 +33,7 @@ class DataStreamsCheckpointer {
|
|
|
33
33
|
* @param {string} type - The type of the checkpoint, usually the streaming technology being used.
|
|
34
34
|
* Examples include kafka, kinesis, sns etc.
|
|
35
35
|
* @param {string} source - The source of data. This can be a topic, exchange or stream name.
|
|
36
|
-
* @param {
|
|
36
|
+
* @param {object} carrier - The carrier object to extract context from.
|
|
37
37
|
* @param {boolean} [manualCheckpoint=true] - Whether this checkpoint was manually set. Keep true if manually
|
|
38
38
|
* instrumenting. Manual instrumentation always overrides automatic
|
|
39
39
|
* instrumentation in the case a call is both manually and automatically
|
|
@@ -13,7 +13,7 @@ const {
|
|
|
13
13
|
//
|
|
14
14
|
// TODO: Remove this when DSM has been moved to dedicated plugins.
|
|
15
15
|
/**
|
|
16
|
-
* @template T extends new (...args:
|
|
16
|
+
* @template T extends new (...args: unknown[]) => unknown
|
|
17
17
|
* @param {() => T} classGetter
|
|
18
18
|
* @param {string[]} methods
|
|
19
19
|
* @param {string[]} staticMethods
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
// other languages use FNV1
|
|
5
5
|
// this inconsistency is ok because hashes do not need to be consistent across services
|
|
6
6
|
const crypto = require('crypto')
|
|
7
|
-
const { encodeVarint, decodeVarint } = require('./encoding')
|
|
8
7
|
const { LRUCache } = require('../../../../vendor/dist/lru-cache')
|
|
9
8
|
const log = require('../log')
|
|
10
9
|
const pick = require('../../../datadog-core/src/utils/src/pick')
|
|
10
|
+
const { encodeVarint, decodeVarint } = require('./encoding')
|
|
11
11
|
|
|
12
12
|
const cache = new LRUCache({ max: 500 })
|
|
13
13
|
|
|
@@ -44,7 +44,7 @@ function computeHash (service, env, edgeTags, parentHash) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* @param {
|
|
47
|
+
* @param {object} dataStreamsContext
|
|
48
48
|
* @param {Buffer} dataStreamsContext.hash
|
|
49
49
|
* @param {number} dataStreamsContext.pathwayStartNs
|
|
50
50
|
* @param {number} dataStreamsContext.edgeStartNs
|
|
@@ -59,7 +59,7 @@ function encodePathwayContext (dataStreamsContext) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* @param {
|
|
62
|
+
* @param {object} dataStreamsContext
|
|
63
63
|
* @param {Buffer} dataStreamsContext.hash
|
|
64
64
|
* @param {number} dataStreamsContext.pathwayStartNs
|
|
65
65
|
* @param {number} dataStreamsContext.edgeStartNs
|
|
@@ -72,7 +72,7 @@ function encodePathwayContextBase64 (dataStreamsContext) {
|
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* @param {Buffer} pathwayContext
|
|
75
|
-
* @returns {
|
|
75
|
+
* @returns {object}
|
|
76
76
|
*/
|
|
77
77
|
function decodePathwayContext (pathwayContext) {
|
|
78
78
|
if (pathwayContext == null || pathwayContext.length < 8) {
|
|
@@ -111,11 +111,11 @@ const DsmPathwayCodec = {
|
|
|
111
111
|
// we use a class for encoding / decoding in case we update our encoding/decoding. A class will make updates easier
|
|
112
112
|
// instead of using individual functions.
|
|
113
113
|
/**
|
|
114
|
-
* @param {
|
|
114
|
+
* @param {object} dataStreamsContext
|
|
115
115
|
* @param {Buffer} dataStreamsContext.hash
|
|
116
116
|
* @param {number} dataStreamsContext.pathwayStartNs
|
|
117
117
|
* @param {number} dataStreamsContext.edgeStartNs
|
|
118
|
-
* @param {
|
|
118
|
+
* @param {object} carrier
|
|
119
119
|
*/
|
|
120
120
|
encode (dataStreamsContext, carrier) {
|
|
121
121
|
if (!dataStreamsContext || !dataStreamsContext.hash) {
|
|
@@ -127,7 +127,7 @@ const DsmPathwayCodec = {
|
|
|
127
127
|
},
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
* @param {
|
|
130
|
+
* @param {object} carrier
|
|
131
131
|
* @returns {ReturnType<typeof decodePathwayContext>|undefined}
|
|
132
132
|
*/
|
|
133
133
|
decode (carrier) {
|
|
@@ -4,14 +4,14 @@ const os = require('os')
|
|
|
4
4
|
const pkg = require('../../../../package.json')
|
|
5
5
|
|
|
6
6
|
const { LogCollapsingLowestDenseDDSketch } = require('../../../../vendor/dist/@datadog/sketches-js')
|
|
7
|
+
const { PATHWAY_HASH } = require('../../../../ext/tags')
|
|
8
|
+
const log = require('../log')
|
|
7
9
|
const { DsmPathwayCodec } = require('./pathway')
|
|
8
10
|
const { DataStreamsWriter } = require('./writer')
|
|
9
11
|
const { computePathwayHash } = require('./pathway')
|
|
10
12
|
const { getAmqpMessageSize, getHeadersSize, getMessageSize, getSizeOrZero } = require('./size')
|
|
11
|
-
const { PATHWAY_HASH } = require('../../../../ext/tags')
|
|
12
13
|
const { SchemaBuilder } = require('./schemas/schema_builder')
|
|
13
14
|
const { SchemaSampler } = require('./schemas/schema_sampler')
|
|
14
|
-
const log = require('../log')
|
|
15
15
|
|
|
16
16
|
const ENTRY_PARENT_HASH = Buffer.from('0000000000000000', 'hex')
|
|
17
17
|
|
|
@@ -156,7 +156,7 @@ class DataStreamsProcessor {
|
|
|
156
156
|
this.timer = setInterval(this.onInterval.bind(this), flushInterval)
|
|
157
157
|
this.timer.unref()
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
globalThis[Symbol.for('dd-trace')].beforeExitHandlers.add(this.onInterval.bind(this))
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
onInterval () {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { URL, format } = require('url')
|
|
4
|
+
const zlib = require('zlib')
|
|
3
5
|
const pkg = require('../../../../package.json')
|
|
4
6
|
const log = require('../log')
|
|
5
7
|
const request = require('../exporters/common/request')
|
|
6
|
-
const { URL, format } = require('url')
|
|
7
8
|
const { MsgpackEncoder } = require('../msgpack')
|
|
8
|
-
const defaults = require('../
|
|
9
|
-
const zlib = require('zlib')
|
|
9
|
+
const defaults = require('../config/defaults')
|
|
10
10
|
|
|
11
11
|
const msgpack = new MsgpackEncoder()
|
|
12
12
|
|
|
@@ -8,6 +8,7 @@ module.exports = function getDebuggerConfig (config) {
|
|
|
8
8
|
hostname: config.hostname,
|
|
9
9
|
logLevel: config.logLevel,
|
|
10
10
|
port: config.port,
|
|
11
|
+
propagateProcessTags: config.propagateProcessTags,
|
|
11
12
|
repositoryUrl: config.repositoryUrl,
|
|
12
13
|
runtimeId: config.tags['runtime-id'],
|
|
13
14
|
service: config.service,
|
|
@@ -206,7 +206,7 @@ function isTypedArray (variable) {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
function isInstanceOfCoreType (type, variable, fallback = `${variable} instanceof ${type}`) {
|
|
209
|
-
return `(
|
|
209
|
+
return `(globalThis[Symbol.for('dd-trace')].utilTypes?.is${type}?.(${variable}) ?? ${fallback})`
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
function getSize (variable) {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const { workerData: { config: parentConfig, parentThreadId, configPort } } = require('node:worker_threads')
|
|
4
4
|
const { format } = require('node:url')
|
|
5
|
+
const defaults = require('../../config/defaults')
|
|
5
6
|
const log = require('./log')
|
|
6
|
-
const defaults = require('../../config_defaults')
|
|
7
7
|
|
|
8
8
|
const config = module.exports = {
|
|
9
9
|
...parentConfig,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { randomUUID } = require('crypto')
|
|
4
|
+
const { version } = require('../../../../../package.json')
|
|
5
|
+
const { NODE_MAJOR } = require('../../../../../version')
|
|
6
|
+
const processTags = require('../../process-tags')
|
|
4
7
|
const { breakpointToProbes } = require('./state')
|
|
5
8
|
const session = require('./session')
|
|
6
9
|
const { getLocalStateForCallFrame } = require('./snapshot')
|
|
@@ -10,8 +13,6 @@ const { ackEmitting } = require('./status')
|
|
|
10
13
|
const config = require('./config')
|
|
11
14
|
const { MAX_SNAPSHOTS_PER_SECOND_GLOBALLY } = require('./defaults')
|
|
12
15
|
const log = require('./log')
|
|
13
|
-
const { version } = require('../../../../../package.json')
|
|
14
|
-
const { NODE_MAJOR } = require('../../../../../version')
|
|
15
16
|
|
|
16
17
|
require('./remote_config')
|
|
17
18
|
|
|
@@ -215,6 +216,10 @@ session.on('Debugger.paused', async ({ params }) => {
|
|
|
215
216
|
language: 'javascript'
|
|
216
217
|
}
|
|
217
218
|
|
|
219
|
+
if (config.propagateProcessTags.enabled) {
|
|
220
|
+
snapshot[processTags.DYNAMIC_INSTRUMENTATION_FIELD_NAME] = processTags.tagsObject
|
|
221
|
+
}
|
|
222
|
+
|
|
218
223
|
if (probe.captureSnapshot) {
|
|
219
224
|
if (captureErrors?.length > 0) {
|
|
220
225
|
// There was an error collecting the snapshot for this probe, let's not try again
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
const { hostname: getHostname } = require('os')
|
|
4
4
|
const { stringify } = require('querystring')
|
|
5
5
|
|
|
6
|
-
const config = require('./config')
|
|
7
|
-
const JSONBuffer = require('./json-buffer')
|
|
8
6
|
const request = require('../../exporters/common/request')
|
|
9
7
|
const { GIT_COMMIT_SHA, GIT_REPOSITORY_URL } = require('../../plugins/util/tags')
|
|
10
|
-
const log = require('./log')
|
|
11
8
|
const { version } = require('../../../../../package.json')
|
|
12
|
-
const {
|
|
9
|
+
const { getValueFromEnvSources } = require('../../config/helper')
|
|
10
|
+
const log = require('./log')
|
|
11
|
+
const JSONBuffer = require('./json-buffer')
|
|
12
|
+
const config = require('./config')
|
|
13
13
|
const { pruneSnapshot } = require('./snapshot-pruner')
|
|
14
14
|
|
|
15
15
|
module.exports = send
|
|
@@ -23,8 +23,8 @@ const hostname = getHostname()
|
|
|
23
23
|
const service = config.service
|
|
24
24
|
|
|
25
25
|
const ddtags = [
|
|
26
|
-
['env',
|
|
27
|
-
['version',
|
|
26
|
+
['env', getValueFromEnvSources('DD_ENV')],
|
|
27
|
+
['version', getValueFromEnvSources('DD_VERSION')],
|
|
28
28
|
['debugger_version', version],
|
|
29
29
|
['host_name', hostname],
|
|
30
30
|
[GIT_COMMIT_SHA, config.commitSHA],
|
|
@@ -7,7 +7,7 @@ const inspector = require('./inspector_promises_polyfill')
|
|
|
7
7
|
* connect: () => void,
|
|
8
8
|
* connectToMainThread: () => void
|
|
9
9
|
* disconnect: () => void,
|
|
10
|
-
* post: (method: string, params?: object) => Promise<
|
|
10
|
+
* post: (method: string, params?: object) => Promise<unknown>,
|
|
11
11
|
* }} CDPSession
|
|
12
12
|
*/
|
|
13
13
|
const session = /** @type {CDPSession} */ (new inspector.Session())
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const session = require('../session')
|
|
3
4
|
const { collectionSizeSym, largeCollectionSkipThresholdSym, fieldCountSym, timeBudgetSym } = require('./symbols')
|
|
4
5
|
const { LARGE_OBJECT_SKIP_THRESHOLD } = require('./constants')
|
|
5
|
-
const session = require('../session')
|
|
6
6
|
|
|
7
7
|
const LEAF_SUBTYPES = new Set(['date', 'regexp'])
|
|
8
8
|
const ITERABLE_SUBTYPES = new Set(['map', 'set', 'weakmap', 'weakset'])
|
|
@@ -13,12 +13,12 @@ module.exports = {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* @typedef {
|
|
17
|
-
* @property {
|
|
16
|
+
* @typedef {object} GetObjectOptions
|
|
17
|
+
* @property {object} maxReferenceDepth - The maximum depth of the object to traverse
|
|
18
18
|
* @property {number} maxCollectionSize - The maximum size of a collection to include in the snapshot
|
|
19
19
|
* @property {number} maxFieldCount - The maximum number of properties on an object to include in the snapshot
|
|
20
20
|
* @property {bigint} deadlineNs - The deadline in nanoseconds compared to `process.hrtime.bigint()`
|
|
21
|
-
* @property {
|
|
21
|
+
* @property {object} ctx - A context object to track the state/progress of the snapshot collection.
|
|
22
22
|
* @property {boolean} ctx.deadlineReached - Will be set to `true` if the deadline has been reached.
|
|
23
23
|
* @property {Error[]} ctx.captureErrors - An array on which errors can be pushed if an issue is detected while
|
|
24
24
|
* collecting the snapshot.
|
|
@@ -34,7 +34,7 @@ module.exports = {
|
|
|
34
34
|
* and should not be set by the caller.
|
|
35
35
|
* @param {boolean} [collection=false] - Whether the object is a collection. Only used internally by this module to
|
|
36
36
|
* track the current object type and should not be set by the caller.
|
|
37
|
-
* @returns {Promise<
|
|
37
|
+
* @returns {Promise<object[]>} The properties of the object
|
|
38
38
|
*/
|
|
39
39
|
async function collectObjectProperties (objectId, opts, depth = 0, collection = false) {
|
|
40
40
|
const { result, privateProperties } = await session.post('Runtime.getProperties', {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { getEnvironmentVariable } = require('../../../config
|
|
3
|
+
const { getEnvironmentVariable } = require('../../../config/helper')
|
|
4
4
|
|
|
5
5
|
const largeObjectSkipThreshold = Number(
|
|
6
6
|
getEnvironmentVariable('_DD_DYNAMIC_INSTRUMENTATION_EXPERIMENTAL_LARGE_OBJECT_SKIP_THRESHOLD')
|
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* @typedef {
|
|
19
|
+
* @typedef {object} GetLocalStateForCallFrameOptions
|
|
20
20
|
* @property {number} [maxReferenceDepth] - The maximum depth of the object to traverse. Defaults to
|
|
21
21
|
* {@link DEFAULT_MAX_REFERENCE_DEPTH}.
|
|
22
22
|
* @property {number} [maxCollectionSize] - The maximum size of a collection to include in the snapshot. Defaults to
|
|
@@ -34,7 +34,7 @@ module.exports = {
|
|
|
34
34
|
*
|
|
35
35
|
* @param {import('inspector').Debugger.CallFrame} callFrame - The call frame to get the local state for
|
|
36
36
|
* @param {GetLocalStateForCallFrameOptions} [opts] - The options for the snapshot
|
|
37
|
-
* @returns {Promise<
|
|
37
|
+
* @returns {Promise<object>} The local state for the call frame
|
|
38
38
|
*/
|
|
39
39
|
async function getLocalStateForCallFrame (
|
|
40
40
|
callFrame,
|
|
@@ -24,7 +24,7 @@ module.exports = {
|
|
|
24
24
|
* Find the script to inspect based on a partial or absolute path. Handles both Windows and POSIX paths.
|
|
25
25
|
*
|
|
26
26
|
* @param {string} path - Partial or absolute path to match against loaded scripts
|
|
27
|
-
* @returns {
|
|
27
|
+
* @returns {object | null} - Object containing `url`, `scriptId`, `sourceMapURL`, and `source` - or null if no match
|
|
28
28
|
*/
|
|
29
29
|
findScriptFromPartialPath (path) {
|
|
30
30
|
if (!path) return null // This shouldn't happen, but better safe than sorry
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const TTLSet = require('../../../../../vendor/dist/ttl-set')
|
|
4
|
-
const config = require('./config')
|
|
5
|
-
const JSONBuffer = require('./json-buffer')
|
|
6
4
|
const request = require('../../exporters/common/request')
|
|
7
5
|
const FormData = require('../../exporters/common/form-data')
|
|
6
|
+
const config = require('./config')
|
|
7
|
+
const JSONBuffer = require('./json-buffer')
|
|
8
8
|
const log = require('./log')
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
@@ -4,32 +4,55 @@ const { readFile } = require('fs')
|
|
|
4
4
|
const { types } = require('util')
|
|
5
5
|
const { join } = require('path')
|
|
6
6
|
const { Worker, MessageChannel, threadId: parentThreadId } = require('worker_threads')
|
|
7
|
-
const getDebuggerConfig = require('./config')
|
|
8
7
|
const log = require('../log')
|
|
8
|
+
const getDebuggerConfig = require('./config')
|
|
9
9
|
|
|
10
10
|
let worker = null
|
|
11
11
|
let configChannel = null
|
|
12
12
|
let ackId = 0
|
|
13
|
+
let rcAckCallbacks = null
|
|
14
|
+
let rc = null
|
|
13
15
|
|
|
14
16
|
// eslint-disable-next-line eslint-rules/eslint-process-env
|
|
15
17
|
const { NODE_OPTIONS, ...env } = process.env
|
|
16
18
|
|
|
17
19
|
module.exports = {
|
|
20
|
+
isStarted,
|
|
18
21
|
start,
|
|
19
|
-
configure
|
|
22
|
+
configure,
|
|
23
|
+
stop
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Check if the Debugger worker is currently running
|
|
28
|
+
*
|
|
29
|
+
* @returns {boolean} True if the worker is started, false otherwise
|
|
30
|
+
*/
|
|
31
|
+
function isStarted () {
|
|
32
|
+
return worker !== null
|
|
20
33
|
}
|
|
21
34
|
|
|
22
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Start the Debugger worker thread.
|
|
37
|
+
* Creates a worker thread, sets up message channels, and registers
|
|
38
|
+
* the LIVE_DEBUGGING product handler with remote config.
|
|
39
|
+
* Does nothing if the worker is already started.
|
|
40
|
+
*
|
|
41
|
+
* @param {object} config - The tracer configuration object
|
|
42
|
+
* @param {object} rcInstance - The RemoteConfig instance
|
|
43
|
+
*/
|
|
44
|
+
function start (config, rcInstance) {
|
|
23
45
|
if (worker !== null) return
|
|
24
46
|
|
|
25
47
|
log.debug('[debugger] Starting Dynamic Instrumentation client...')
|
|
26
48
|
|
|
27
|
-
|
|
49
|
+
rc = rcInstance
|
|
50
|
+
rcAckCallbacks = new Map()
|
|
28
51
|
const probeChannel = new MessageChannel()
|
|
29
52
|
const logChannel = new MessageChannel()
|
|
30
53
|
configChannel = new MessageChannel()
|
|
31
54
|
|
|
32
|
-
|
|
55
|
+
globalThis[Symbol.for('dd-trace')].utilTypes = types
|
|
33
56
|
|
|
34
57
|
readProbeFile(config.dynamicInstrumentation.probeFile, (probes) => {
|
|
35
58
|
const action = 'apply'
|
|
@@ -84,19 +107,10 @@ function start (config, rc) {
|
|
|
84
107
|
worker.on('error', (err) => log.error('[debugger] worker thread error', err))
|
|
85
108
|
worker.on('messageerror', (err) => log.error('[debugger] received "messageerror" from worker', err))
|
|
86
109
|
|
|
87
|
-
worker.
|
|
110
|
+
worker.once('exit', (code) => {
|
|
88
111
|
const error = new Error(`Dynamic Instrumentation worker thread exited unexpectedly with code ${code}`)
|
|
89
|
-
|
|
90
112
|
log.error('[debugger] worker thread exited unexpectedly', error)
|
|
91
|
-
|
|
92
|
-
// Be nice, clean up now that the worker thread encountered an issue and we can't continue
|
|
93
|
-
rc.removeProductHandler('LIVE_DEBUGGING')
|
|
94
|
-
worker.removeAllListeners()
|
|
95
|
-
configChannel = null
|
|
96
|
-
for (const ackId of rcAckCallbacks.keys()) {
|
|
97
|
-
rcAckCallbacks.get(ackId)(error)
|
|
98
|
-
rcAckCallbacks.delete(ackId)
|
|
99
|
-
}
|
|
113
|
+
cleanup(error) // Be nice, clean up now that the worker thread encountered an issue and we can't continue
|
|
100
114
|
})
|
|
101
115
|
|
|
102
116
|
worker.unref()
|
|
@@ -108,11 +122,65 @@ function start (config, rc) {
|
|
|
108
122
|
configChannel.port2.unref()
|
|
109
123
|
}
|
|
110
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Reconfigure the Debugger worker with updated settings.
|
|
127
|
+
* Sends the new configuration to the worker thread via the config channel.
|
|
128
|
+
* Does nothing if the worker is not started.
|
|
129
|
+
*
|
|
130
|
+
* @param {object} config - The updated tracer configuration object
|
|
131
|
+
*/
|
|
111
132
|
function configure (config) {
|
|
112
133
|
if (configChannel === null) return
|
|
113
134
|
configChannel.port2.postMessage(getDebuggerConfig(config))
|
|
114
135
|
}
|
|
115
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Stop the Debugger worker thread.
|
|
139
|
+
* Terminates the worker and cleans up resources.
|
|
140
|
+
* Safe to call even if the worker is not started.
|
|
141
|
+
*/
|
|
142
|
+
function stop () {
|
|
143
|
+
if (worker === null) return
|
|
144
|
+
|
|
145
|
+
log.debug('[debugger] Stopping Dynamic Instrumentation client...')
|
|
146
|
+
|
|
147
|
+
try {
|
|
148
|
+
worker.terminate()
|
|
149
|
+
cleanup() // Graceful shutdown - termination succeeded
|
|
150
|
+
} catch (err) {
|
|
151
|
+
log.error('[debugger] Error terminating worker', err)
|
|
152
|
+
cleanup(err) // Cleanup with error - termination failed
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Internal cleanup function to reset all debugger resources.
|
|
158
|
+
* Called when stopping the debugger or when the worker exits unexpectedly.
|
|
159
|
+
*
|
|
160
|
+
* @param {Error} [error] - Optional error to pass to pending ack callbacks (for unexpected exits)
|
|
161
|
+
*/
|
|
162
|
+
function cleanup (error) {
|
|
163
|
+
if (rc) {
|
|
164
|
+
rc.removeProductHandler('LIVE_DEBUGGING')
|
|
165
|
+
rc = null
|
|
166
|
+
}
|
|
167
|
+
if (worker) {
|
|
168
|
+
worker.removeAllListeners()
|
|
169
|
+
worker = null
|
|
170
|
+
}
|
|
171
|
+
configChannel = null
|
|
172
|
+
|
|
173
|
+
// Call any pending ack callbacks
|
|
174
|
+
// Pass error for unexpected exits, or undefined for graceful shutdown
|
|
175
|
+
if (rcAckCallbacks) {
|
|
176
|
+
for (const ackId of rcAckCallbacks.keys()) {
|
|
177
|
+
rcAckCallbacks.get(ackId)(error)
|
|
178
|
+
rcAckCallbacks.delete(ackId)
|
|
179
|
+
}
|
|
180
|
+
rcAckCallbacks = null
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
116
184
|
function readProbeFile (path, cb) {
|
|
117
185
|
if (!path) return
|
|
118
186
|
|