@depup/dd-trace 5.97.0-depup.0 → 6.4.0-depup.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 +89 -104
- package/README.md +9 -3
- package/changes.json +8 -3
- package/ci/init.js +25 -5
- package/ci/vitest-no-worker-init-setup.mjs +430 -0
- package/ext/exporters.js +1 -0
- package/ext/tags.js +3 -0
- package/index.d.ts +315 -244
- package/index.electron.js +3 -0
- package/initialize.mjs +9 -8
- package/loader-hook.mjs +154 -47
- package/package.json +118 -78
- package/packages/datadog-core/src/storage.js +47 -48
- package/packages/datadog-esbuild/index.js +32 -1
- package/packages/datadog-esbuild/src/utils.js +46 -3
- package/packages/datadog-instrumentations/src/aerospike.js +3 -3
- package/packages/datadog-instrumentations/src/ai.js +131 -76
- package/packages/datadog-instrumentations/src/amqplib.js +6 -7
- package/packages/datadog-instrumentations/src/anthropic.js +10 -10
- package/packages/datadog-instrumentations/src/apollo-server-core.js +3 -3
- package/packages/datadog-instrumentations/src/apollo-server.js +10 -18
- package/packages/datadog-instrumentations/src/avsc.js +6 -6
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js-context-methods.js +18 -0
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +111 -0
- package/packages/datadog-instrumentations/src/aws-sdk.js +172 -72
- package/packages/datadog-instrumentations/src/azure-cosmos.js +7 -0
- package/packages/datadog-instrumentations/src/azure-durable-functions.js +8 -8
- package/packages/datadog-instrumentations/src/azure-functions.js +3 -0
- package/packages/datadog-instrumentations/src/bluebird.js +2 -2
- package/packages/datadog-instrumentations/src/body-parser.js +5 -2
- package/packages/datadog-instrumentations/src/cassandra-driver.js +12 -9
- package/packages/datadog-instrumentations/src/child_process.js +15 -15
- package/packages/datadog-instrumentations/src/claude-agent-sdk.js +587 -0
- package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +41 -24
- package/packages/datadog-instrumentations/src/connect.js +14 -12
- package/packages/datadog-instrumentations/src/cookie-parser.js +5 -4
- package/packages/datadog-instrumentations/src/cookie.js +9 -3
- package/packages/datadog-instrumentations/src/couchbase.js +73 -238
- package/packages/datadog-instrumentations/src/crypto.js +49 -4
- package/packages/datadog-instrumentations/src/cucumber-worker-threads.js +19 -0
- package/packages/datadog-instrumentations/src/cucumber.js +747 -187
- package/packages/datadog-instrumentations/src/cypress-config.js +164 -56
- package/packages/datadog-instrumentations/src/cypress.js +5 -3
- package/packages/datadog-instrumentations/src/dns.js +60 -59
- package/packages/datadog-instrumentations/src/elasticsearch.js +9 -12
- package/packages/datadog-instrumentations/src/electron/preload.js +42 -0
- package/packages/datadog-instrumentations/src/electron.js +240 -0
- package/packages/datadog-instrumentations/src/express-mongo-sanitize.js +11 -9
- package/packages/datadog-instrumentations/src/express-session.js +14 -13
- package/packages/datadog-instrumentations/src/express.js +52 -30
- package/packages/datadog-instrumentations/src/fastify.js +169 -86
- package/packages/datadog-instrumentations/src/fetch.js +5 -5
- package/packages/datadog-instrumentations/src/fs.js +22 -20
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +5 -7
- package/packages/datadog-instrumentations/src/google-genai.js +4 -4
- package/packages/datadog-instrumentations/src/graphql.js +26 -362
- package/packages/datadog-instrumentations/src/grpc/client.js +48 -32
- package/packages/datadog-instrumentations/src/grpc/server.js +20 -2
- package/packages/datadog-instrumentations/src/hapi.js +2 -2
- package/packages/datadog-instrumentations/src/helpers/callback-instrumentor.js +74 -0
- package/packages/datadog-instrumentations/src/helpers/check-require-cache.js +85 -9
- package/packages/datadog-instrumentations/src/helpers/hook.js +4 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +12 -0
- package/packages/datadog-instrumentations/src/helpers/instrument.js +36 -3
- package/packages/datadog-instrumentations/src/helpers/kafka.js +58 -0
- package/packages/datadog-instrumentations/src/helpers/optional-peer-bundler.js +65 -0
- package/packages/datadog-instrumentations/src/helpers/promise-instrumentor.js +42 -0
- package/packages/datadog-instrumentations/src/helpers/promise.js +2 -2
- package/packages/datadog-instrumentations/src/helpers/register.js +7 -5
- package/packages/datadog-instrumentations/src/helpers/require-optional-peer.js +17 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +13 -5
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +24 -7
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/ai.js +6 -6
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/aws-durable-execution-sdk-js.js +31 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/azure-cosmos.js +50 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/claude-agent-sdk.js +17 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +201 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +7 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/langgraph.js +4 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/mercurius.js +31 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-sdk.js +35 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +85 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/loader.mjs +18 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +49 -224
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +8 -8
- package/packages/datadog-instrumentations/src/hono.js +71 -9
- package/packages/datadog-instrumentations/src/http/client.js +48 -24
- package/packages/datadog-instrumentations/src/http/server.js +75 -29
- package/packages/datadog-instrumentations/src/http2/client.js +15 -12
- package/packages/datadog-instrumentations/src/http2/server.js +156 -23
- package/packages/datadog-instrumentations/src/ioredis.js +17 -14
- package/packages/datadog-instrumentations/src/iovalkey.js +1 -2
- package/packages/datadog-instrumentations/src/jest/bail-reporter.js +42 -0
- package/packages/datadog-instrumentations/src/jest/coverage-backfill.js +163 -0
- package/packages/datadog-instrumentations/src/jest.js +1783 -401
- package/packages/datadog-instrumentations/src/kafkajs.js +284 -170
- package/packages/datadog-instrumentations/src/knex.js +17 -17
- package/packages/datadog-instrumentations/src/koa.js +15 -14
- package/packages/datadog-instrumentations/src/ldapjs.js +5 -5
- package/packages/datadog-instrumentations/src/light-my-request.js +2 -2
- package/packages/datadog-instrumentations/src/limitd-client.js +4 -4
- package/packages/datadog-instrumentations/src/lodash.js +4 -4
- package/packages/datadog-instrumentations/src/mariadb.js +18 -16
- package/packages/datadog-instrumentations/src/memcached.js +4 -3
- package/packages/datadog-instrumentations/src/mercurius.js +11 -0
- package/packages/datadog-instrumentations/src/microgateway-core.js +2 -2
- package/packages/datadog-instrumentations/src/mocha/common.js +7 -4
- package/packages/datadog-instrumentations/src/mocha/main.js +557 -118
- package/packages/datadog-instrumentations/src/mocha/utils.js +531 -131
- package/packages/datadog-instrumentations/src/mocha/worker.js +27 -9
- package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +254 -0
- package/packages/datadog-instrumentations/src/mongodb-core.js +43 -31
- package/packages/datadog-instrumentations/src/mongodb.js +79 -5
- package/packages/datadog-instrumentations/src/mongoose.js +43 -34
- package/packages/datadog-instrumentations/src/mquery.js +5 -5
- package/packages/datadog-instrumentations/src/multer.js +5 -4
- package/packages/datadog-instrumentations/src/mysql.js +17 -17
- package/packages/datadog-instrumentations/src/mysql2.js +39 -5
- package/packages/datadog-instrumentations/src/nats.js +182 -0
- package/packages/datadog-instrumentations/src/net.js +19 -11
- package/packages/datadog-instrumentations/src/next.js +44 -10
- package/packages/datadog-instrumentations/src/nyc.js +43 -6
- package/packages/datadog-instrumentations/src/openai.js +124 -38
- package/packages/datadog-instrumentations/src/oracledb.js +12 -7
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +27 -6
- package/packages/datadog-instrumentations/src/passport-utils.js +5 -5
- package/packages/datadog-instrumentations/src/path-to-regexp.js +44 -0
- package/packages/datadog-instrumentations/src/pg.js +58 -25
- package/packages/datadog-instrumentations/src/pino.js +25 -41
- package/packages/datadog-instrumentations/src/playwright-browser-scripts.js +27 -0
- package/packages/datadog-instrumentations/src/playwright.js +1086 -350
- package/packages/datadog-instrumentations/src/protobufjs.js +16 -16
- package/packages/datadog-instrumentations/src/redis.js +28 -15
- package/packages/datadog-instrumentations/src/restify.js +6 -5
- package/packages/datadog-instrumentations/src/router.js +243 -87
- package/packages/datadog-instrumentations/src/selenium.js +1 -2
- package/packages/datadog-instrumentations/src/stripe.js +47 -33
- package/packages/datadog-instrumentations/src/tedious.js +28 -0
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +1297 -0
- package/packages/datadog-instrumentations/src/vitest-main.js +1592 -0
- package/packages/datadog-instrumentations/src/vitest-util.js +251 -0
- package/packages/datadog-instrumentations/src/vitest-worker.js +822 -0
- package/packages/datadog-instrumentations/src/vitest.js +11 -1262
- package/packages/datadog-instrumentations/src/winston.js +4 -4
- package/packages/datadog-instrumentations/src/ws.js +7 -7
- package/packages/datadog-instrumentations/src/zlib.js +29 -0
- package/packages/datadog-plugin-ai/src/index.js +1 -1
- package/packages/datadog-plugin-ai/src/tracing.js +66 -3
- package/packages/datadog-plugin-ai/src/utils.js +17 -4
- package/packages/datadog-plugin-apollo/src/gateway/request.js +1 -21
- package/packages/datadog-plugin-avsc/src/schema_iterator.js +3 -3
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/checkpoint.js +31 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/client.js +55 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/context.js +123 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/handler.js +129 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/index.js +19 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/trace-checkpoint.js +224 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/util.js +79 -0
- package/packages/datadog-plugin-aws-sdk/src/base.js +86 -50
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/tracing.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +218 -4
- package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +2 -1
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +59 -14
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +174 -75
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +34 -23
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +2 -1
- package/packages/datadog-plugin-aws-sdk/src/services/s3.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +26 -26
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +187 -101
- package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +20 -18
- package/packages/datadog-plugin-azure-cosmos/src/index.js +144 -0
- package/packages/datadog-plugin-azure-event-hubs/src/producer.js +8 -15
- package/packages/datadog-plugin-azure-functions/src/index.js +7 -3
- package/packages/datadog-plugin-azure-service-bus/src/producer.js +5 -10
- package/packages/datadog-plugin-bullmq/src/consumer.js +5 -4
- package/packages/datadog-plugin-bullmq/src/filter.js +35 -0
- package/packages/datadog-plugin-bullmq/src/producer.js +121 -33
- package/packages/datadog-plugin-bunyan/src/index.js +28 -0
- package/packages/datadog-plugin-child_process/src/index.js +13 -2
- package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +6 -6
- package/packages/datadog-plugin-claude-agent-sdk/src/index.js +31 -0
- package/packages/datadog-plugin-claude-agent-sdk/src/tracing.js +107 -0
- package/packages/datadog-plugin-claude-agent-sdk/src/util.js +15 -0
- package/packages/datadog-plugin-couchbase/src/index.js +58 -52
- package/packages/datadog-plugin-cucumber/src/index.js +46 -28
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +961 -92
- package/packages/datadog-plugin-cypress/src/index.js +104 -2
- package/packages/datadog-plugin-cypress/src/plugin.js +6 -14
- package/packages/datadog-plugin-cypress/src/source-map-utils.js +48 -1
- package/packages/datadog-plugin-cypress/src/support.js +180 -25
- package/packages/datadog-plugin-dd-trace-api/src/index.js +1 -1
- package/packages/datadog-plugin-dns/src/lookup.js +8 -6
- package/packages/datadog-plugin-elasticsearch/src/index.js +28 -8
- package/packages/datadog-plugin-electron/src/index.js +17 -0
- package/packages/datadog-plugin-electron/src/ipc.js +143 -0
- package/packages/datadog-plugin-electron/src/net.js +82 -0
- package/packages/datadog-plugin-express/src/code_origin.js +1 -1
- package/packages/datadog-plugin-fastify/src/code_origin.js +1 -1
- package/packages/datadog-plugin-fs/src/index.js +2 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +2 -5
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +27 -18
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +5 -8
- package/packages/datadog-plugin-graphql/src/execute.js +706 -34
- package/packages/datadog-plugin-graphql/src/index.js +43 -9
- package/packages/datadog-plugin-graphql/src/parse.js +45 -4
- package/packages/datadog-plugin-graphql/src/request.js +135 -0
- package/packages/datadog-plugin-graphql/src/tools/signature.js +32 -7
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +118 -100
- package/packages/datadog-plugin-graphql/src/utils.js +261 -3
- package/packages/datadog-plugin-graphql/src/validate.js +53 -7
- package/packages/datadog-plugin-grpc/src/client.js +7 -8
- package/packages/datadog-plugin-grpc/src/server.js +1 -1
- package/packages/datadog-plugin-grpc/src/util.js +57 -22
- package/packages/datadog-plugin-http/src/client.js +12 -14
- package/packages/datadog-plugin-http/src/index.js +6 -8
- package/packages/datadog-plugin-http/src/server.js +63 -20
- package/packages/datadog-plugin-http2/src/client.js +6 -3
- package/packages/datadog-plugin-http2/src/server.js +48 -8
- package/packages/datadog-plugin-jest/src/index.js +133 -67
- package/packages/datadog-plugin-jest/src/util.js +37 -16
- package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +1 -1
- package/packages/datadog-plugin-kafkajs/src/consumer.js +2 -9
- package/packages/datadog-plugin-kafkajs/src/producer.js +37 -8
- package/packages/datadog-plugin-langgraph/src/stream.js +1 -1
- package/packages/datadog-plugin-memcached/src/index.js +1 -1
- package/packages/datadog-plugin-mocha/src/index.js +66 -20
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/index.js +24 -0
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/tracing.js +173 -0
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/utils.js +30 -0
- package/packages/datadog-plugin-mongodb-core/src/bulk-write.js +43 -0
- package/packages/datadog-plugin-mongodb-core/src/index.js +8 -206
- package/packages/datadog-plugin-mongodb-core/src/query.js +452 -0
- package/packages/datadog-plugin-mysql/src/index.js +9 -4
- package/packages/datadog-plugin-nats/src/consumer.js +43 -0
- package/packages/datadog-plugin-nats/src/index.js +20 -0
- package/packages/datadog-plugin-nats/src/producer.js +62 -0
- package/packages/datadog-plugin-nats/src/util.js +33 -0
- package/packages/datadog-plugin-next/src/index.js +12 -4
- package/packages/datadog-plugin-openai/src/services.js +4 -3
- package/packages/datadog-plugin-openai/src/tracing.js +27 -25
- package/packages/datadog-plugin-oracledb/src/index.js +13 -2
- package/packages/datadog-plugin-pg/src/index.js +13 -3
- package/packages/datadog-plugin-pino/src/index.js +42 -0
- package/packages/datadog-plugin-playwright/src/index.js +21 -11
- package/packages/datadog-plugin-protobufjs/src/schema_iterator.js +3 -3
- package/packages/datadog-plugin-redis/src/index.js +54 -25
- package/packages/datadog-plugin-rhea/src/producer.js +1 -1
- package/packages/datadog-plugin-router/src/index.js +46 -44
- package/packages/datadog-plugin-selenium/src/index.js +1 -1
- package/packages/datadog-plugin-tedious/src/index.js +1 -1
- package/packages/datadog-plugin-undici/src/index.js +24 -2
- package/packages/datadog-plugin-vitest/src/index.js +160 -90
- package/packages/datadog-plugin-winston/src/index.js +30 -0
- package/packages/datadog-plugin-ws/src/close.js +3 -1
- package/packages/datadog-plugin-ws/src/producer.js +2 -0
- package/packages/datadog-plugin-ws/src/receiver.js +2 -1
- package/packages/datadog-shimmer/src/shimmer.js +101 -39
- package/packages/datadog-webpack/index.js +17 -1
- package/packages/datadog-webpack/src/optional-peer-loader.js +17 -0
- package/packages/dd-trace/index.electron.js +3 -0
- package/packages/dd-trace/index.js +2 -36
- package/packages/dd-trace/src/aiguard/channels.js +7 -0
- package/packages/dd-trace/src/aiguard/index.js +16 -34
- package/packages/dd-trace/src/aiguard/integrations/evaluate.js +46 -0
- package/packages/dd-trace/src/aiguard/integrations/index.js +34 -0
- package/packages/dd-trace/src/aiguard/integrations/openai.js +80 -0
- package/packages/dd-trace/src/aiguard/integrations/vercel-ai.js +92 -0
- package/packages/dd-trace/src/aiguard/messages/openai.js +382 -0
- package/packages/{datadog-instrumentations/src/helpers/ai-messages.js → dd-trace/src/aiguard/messages/vercel-ai.js} +30 -27
- package/packages/dd-trace/src/aiguard/sdk.js +147 -54
- package/packages/dd-trace/src/aiguard/tags.js +26 -10
- package/packages/dd-trace/src/appsec/api_security/index.js +55 -0
- package/packages/dd-trace/src/appsec/api_security/sampler.js +147 -0
- package/packages/dd-trace/src/appsec/blocked_templates.js +4 -3
- package/packages/dd-trace/src/appsec/blocking.js +82 -42
- package/packages/dd-trace/src/appsec/channels.js +5 -1
- package/packages/dd-trace/src/appsec/downstream_requests.js +116 -62
- package/packages/dd-trace/src/appsec/graphql.js +20 -17
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-password-rules.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secret-rules.js +81 -81
- package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +23 -23
- package/packages/dd-trace/src/appsec/iast/index.js +3 -2
- package/packages/dd-trace/src/appsec/iast/security-controls/index.js +4 -4
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugins/kafka.js +2 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +4 -4
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +2 -2
- package/packages/dd-trace/src/appsec/iast/telemetry/index.js +2 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/ldap-sensitive-analyzer.js +54 -12
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/url-sensitive-analyzer.js +5 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +31 -4
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js +1 -3
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +83 -48
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +1 -1
- package/packages/dd-trace/src/appsec/index.js +65 -47
- package/packages/dd-trace/src/appsec/lambda.js +135 -0
- package/packages/dd-trace/src/appsec/rasp/command_injection.js +4 -5
- package/packages/dd-trace/src/appsec/rasp/lfi.js +8 -4
- package/packages/dd-trace/src/appsec/rasp/sql_injection.js +5 -10
- package/packages/dd-trace/src/appsec/rasp/ssrf.js +26 -18
- package/packages/dd-trace/src/appsec/recommended.json +2438 -13
- package/packages/dd-trace/src/appsec/reporter.js +87 -28
- package/packages/dd-trace/src/appsec/rule_manager.js +4 -2
- package/packages/dd-trace/src/appsec/sdk/set_user.js +1 -1
- package/packages/dd-trace/src/appsec/sdk/track_event.js +5 -5
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +7 -11
- package/packages/dd-trace/src/appsec/sdk/utils.js +5 -3
- package/packages/dd-trace/src/appsec/store.js +50 -0
- package/packages/dd-trace/src/appsec/telemetry/api_security.js +34 -0
- package/packages/dd-trace/src/appsec/telemetry/index.js +27 -1
- package/packages/dd-trace/src/appsec/user_tracking.js +5 -4
- package/packages/dd-trace/src/appsec/waf/index.js +19 -9
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +35 -20
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +1 -1
- package/packages/dd-trace/src/azure_metadata.js +17 -6
- package/packages/dd-trace/src/baggage.js +32 -13
- package/packages/dd-trace/src/bootstrap.js +39 -0
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +30 -5
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +122 -24
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +22 -7
- package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +5 -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 +6 -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 +148 -25
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +3 -4
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +28 -10
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/writer.js +22 -0
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +105 -22
- package/packages/dd-trace/src/ci-visibility/lage.js +2 -1
- package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +4 -5
- package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +4 -5
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +73 -55
- package/packages/dd-trace/src/ci-visibility/requests/request.js +14 -50
- package/packages/dd-trace/src/ci-visibility/requests/upload-coverage-report.js +4 -4
- package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +156 -0
- package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +5 -3
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +24 -6
- package/packages/dd-trace/src/ci-visibility/test-optimization-cache.js +70 -6
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +128 -0
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache.js +291 -0
- package/packages/dd-trace/src/config/config-types.d.ts +8 -6
- package/packages/dd-trace/src/config/defaults.js +71 -44
- package/packages/dd-trace/src/config/generated-config-types.d.ts +676 -131
- package/packages/dd-trace/src/config/git_properties.js +2 -2
- package/packages/dd-trace/src/config/helper.js +139 -33
- package/packages/dd-trace/src/config/index.js +117 -131
- package/packages/dd-trace/src/config/major-overrides.js +100 -0
- package/packages/dd-trace/src/config/normalize-service.js +31 -0
- package/packages/dd-trace/src/config/parsers.js +138 -10
- package/packages/dd-trace/src/config/remote_config.js +1 -1
- package/packages/dd-trace/src/config/supported-configurations.json +394 -203
- package/packages/dd-trace/src/constants.js +15 -0
- package/packages/dd-trace/src/crashtracking/crashtracker.js +18 -6
- package/packages/dd-trace/src/datastreams/checkpointer.js +6 -12
- package/packages/dd-trace/src/datastreams/context.js +4 -2
- package/packages/dd-trace/src/datastreams/encoding.js +39 -28
- package/packages/dd-trace/src/datastreams/index.js +2 -1
- package/packages/dd-trace/src/datastreams/manager.js +1 -1
- package/packages/dd-trace/src/datastreams/pathway.js +35 -30
- package/packages/dd-trace/src/datastreams/processor.js +31 -22
- package/packages/dd-trace/src/datastreams/size.js +6 -2
- package/packages/dd-trace/src/datastreams/writer.js +15 -6
- package/packages/dd-trace/src/debugger/config.js +9 -4
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +49 -35
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +5 -8
- package/packages/dd-trace/src/debugger/devtools_client/config.js +3 -2
- package/packages/dd-trace/src/debugger/devtools_client/index.js +33 -71
- package/packages/dd-trace/src/debugger/devtools_client/probe_sampler.js +83 -0
- package/packages/dd-trace/src/debugger/devtools_client/send.js +27 -6
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +2 -2
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +5 -2
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +1 -0
- package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/state.js +3 -1
- package/packages/dd-trace/src/debugger/index.js +13 -9
- package/packages/dd-trace/src/debugger/probe_sampler.js +112 -0
- package/packages/dd-trace/src/debugger/probe_sampler_constants.js +19 -0
- package/packages/dd-trace/src/dogstatsd.js +34 -28
- package/packages/dd-trace/src/encode/0.4.js +829 -268
- package/packages/dd-trace/src/encode/0.5.js +158 -22
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +141 -65
- package/packages/dd-trace/src/encode/agentless-json.js +12 -6
- package/packages/dd-trace/src/encode/coverage-ci-visibility.js +52 -15
- package/packages/dd-trace/src/encode/span-stats.js +19 -16
- package/packages/dd-trace/src/encode/tags-processors.js +30 -25
- package/packages/dd-trace/src/exporter.js +3 -1
- package/packages/dd-trace/src/exporters/agent/index.js +4 -5
- package/packages/dd-trace/src/exporters/agent/writer.js +1 -2
- package/packages/dd-trace/src/exporters/agentless/index.js +12 -13
- package/packages/dd-trace/src/exporters/agentless/intake.js +43 -0
- package/packages/dd-trace/src/exporters/agentless/writer.js +12 -11
- package/packages/dd-trace/src/exporters/common/agents.js +3 -1
- package/packages/dd-trace/src/exporters/common/buffering-exporter.js +3 -3
- package/packages/dd-trace/src/exporters/common/request.js +48 -28
- package/packages/dd-trace/src/exporters/common/retry.js +104 -0
- package/packages/dd-trace/src/exporters/common/url.js +34 -0
- package/packages/dd-trace/src/exporters/common/util.js +2 -2
- package/packages/dd-trace/src/exporters/common/writer.js +17 -1
- package/packages/dd-trace/src/exporters/electron/index.js +49 -0
- package/packages/dd-trace/src/exporters/span-stats/index.js +1 -2
- package/packages/dd-trace/src/exporters/span-stats/writer.js +1 -3
- package/packages/dd-trace/src/external-logger/src/index.js +2 -1
- package/packages/dd-trace/src/feature-registry.js +22 -0
- package/packages/dd-trace/src/git_metadata.js +68 -0
- package/packages/dd-trace/src/git_metadata_tagger.js +13 -5
- package/packages/dd-trace/src/guardrails/index.js +11 -6
- package/packages/dd-trace/src/guardrails/telemetry.js +40 -3
- package/packages/dd-trace/src/heap_snapshots.js +4 -4
- package/packages/dd-trace/src/id.js +46 -27
- package/packages/dd-trace/src/index.js +7 -8
- package/packages/dd-trace/src/lambda/handler-paths.js +52 -0
- package/packages/dd-trace/src/lambda/handler.js +2 -6
- package/packages/dd-trace/src/lambda/index.js +62 -14
- package/packages/dd-trace/src/lambda/runtime/patch.js +21 -46
- package/packages/dd-trace/src/llmobs/constants/tags.js +13 -0
- package/packages/dd-trace/src/llmobs/index.js +37 -7
- package/packages/dd-trace/src/llmobs/plugins/ai/ddTelemetry.js +403 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/index.js +8 -395
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +119 -7
- package/packages/dd-trace/src/llmobs/plugins/ai/vercelTelemetry.js +363 -0
- package/packages/dd-trace/src/llmobs/plugins/{anthropic.js → anthropic/index.js} +32 -79
- package/packages/dd-trace/src/llmobs/plugins/anthropic/util.js +109 -0
- package/packages/dd-trace/src/llmobs/plugins/base.js +4 -4
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +89 -37
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/index.js +270 -0
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/utils.js +10 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/index.js +5 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +81 -16
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chain.js +3 -2
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +3 -2
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/embedding.js +2 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/index.js +1 -50
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/vectorstore.js +2 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +14 -8
- package/packages/dd-trace/src/llmobs/plugins/langchain/messages.js +76 -0
- package/packages/dd-trace/src/llmobs/plugins/langgraph/index.js +3 -28
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/index.js +68 -0
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +57 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +21 -51
- package/packages/dd-trace/src/llmobs/sdk.js +56 -35
- package/packages/dd-trace/src/llmobs/span_processor.js +90 -11
- package/packages/dd-trace/src/llmobs/tagger.js +129 -4
- package/packages/dd-trace/src/llmobs/telemetry.js +31 -1
- package/packages/dd-trace/src/llmobs/util.js +202 -9
- package/packages/dd-trace/src/llmobs/writers/base.js +11 -5
- package/packages/dd-trace/src/llmobs/writers/spans.js +1 -1
- package/packages/dd-trace/src/llmobs/writers/util.js +1 -2
- package/packages/dd-trace/src/log/index.js +19 -31
- package/packages/dd-trace/src/log/writer.js +3 -1
- package/packages/dd-trace/src/msgpack/chunk.js +430 -11
- package/packages/dd-trace/src/msgpack/index.js +101 -2
- package/packages/dd-trace/src/noop/proxy.js +5 -4
- package/packages/dd-trace/src/noop/span.js +3 -1
- package/packages/dd-trace/src/openfeature/encoding.js +70 -0
- package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +103 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +26 -1
- package/packages/dd-trace/src/openfeature/noop.js +40 -36
- package/packages/dd-trace/src/openfeature/register.js +46 -0
- package/packages/dd-trace/src/openfeature/remote_config.js +6 -1
- package/packages/dd-trace/src/openfeature/span-enrichment-hook.js +143 -0
- package/packages/dd-trace/src/openfeature/span-enrichment.js +149 -0
- package/packages/dd-trace/src/openfeature/writers/base.js +3 -11
- package/packages/dd-trace/src/openfeature/writers/exposures.js +82 -70
- package/packages/dd-trace/src/openfeature/writers/util.js +1 -2
- package/packages/dd-trace/src/opentelemetry/active-span-proxy.js +42 -0
- package/packages/dd-trace/src/opentelemetry/bridge-span-base.js +107 -0
- package/packages/dd-trace/src/opentelemetry/context_manager.js +27 -13
- package/packages/dd-trace/src/opentelemetry/logs/index.js +6 -6
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +3 -2
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +61 -12
- package/packages/dd-trace/src/opentelemetry/metrics/instruments.js +28 -14
- package/packages/dd-trace/src/opentelemetry/metrics/meter.js +7 -10
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +3 -2
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +40 -0
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js +169 -0
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +99 -5
- package/packages/dd-trace/src/opentelemetry/metrics/time.js +19 -0
- package/packages/dd-trace/src/opentelemetry/otlp/common.proto +2 -2
- package/packages/dd-trace/src/opentelemetry/otlp/logs.proto +1 -1
- package/packages/dd-trace/src/opentelemetry/otlp/logs_service.proto +1 -1
- package/packages/dd-trace/src/opentelemetry/otlp/metrics.proto +1 -1
- package/packages/dd-trace/src/opentelemetry/otlp/metrics_service.proto +1 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +56 -82
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +1 -2
- package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +14 -2
- package/packages/dd-trace/src/opentelemetry/otlp/trace.proto +358 -0
- package/packages/dd-trace/src/opentelemetry/otlp/trace_service.proto +78 -0
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +325 -0
- package/packages/dd-trace/src/opentelemetry/span.js +59 -109
- package/packages/dd-trace/src/opentelemetry/span_context.js +1 -0
- package/packages/dd-trace/src/opentelemetry/span_processor.js +7 -5
- package/packages/dd-trace/src/opentelemetry/trace/index.js +75 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +75 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +375 -0
- package/packages/dd-trace/src/opentelemetry/tracer.js +20 -69
- package/packages/dd-trace/src/opentelemetry/tracer_provider.js +33 -17
- package/packages/dd-trace/src/opentracing/propagation/log.js +28 -8
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +278 -148
- package/packages/dd-trace/src/opentracing/propagation/text_map_dsm.js +11 -11
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +98 -32
- package/packages/dd-trace/src/opentracing/span.js +127 -73
- package/packages/dd-trace/src/opentracing/span_context.js +68 -3
- package/packages/dd-trace/src/opentracing/tracer.js +46 -19
- package/packages/dd-trace/src/payload-tagging/config/index.js +2 -2
- package/packages/dd-trace/src/plugin_manager.js +36 -14
- package/packages/dd-trace/src/plugins/apollo.js +3 -1
- package/packages/dd-trace/src/plugins/ci_plugin.js +387 -85
- package/packages/dd-trace/src/plugins/database.js +61 -18
- package/packages/dd-trace/src/plugins/index.js +14 -0
- package/packages/dd-trace/src/plugins/log_injection.js +56 -0
- package/packages/dd-trace/src/plugins/log_plugin.js +4 -44
- package/packages/dd-trace/src/plugins/outbound.js +1 -1
- package/packages/dd-trace/src/plugins/plugin.js +19 -28
- package/packages/dd-trace/src/plugins/storage.js +2 -2
- package/packages/dd-trace/src/plugins/tracing.js +70 -13
- package/packages/dd-trace/src/plugins/util/ci.js +127 -40
- package/packages/dd-trace/src/plugins/util/git-cache.js +23 -23
- package/packages/dd-trace/src/plugins/util/git.js +3 -1
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +276 -0
- package/packages/dd-trace/src/plugins/util/llm.js +6 -1
- package/packages/dd-trace/src/plugins/util/stacktrace.js +2 -2
- package/packages/dd-trace/src/plugins/util/test.js +894 -65
- package/packages/dd-trace/src/plugins/util/url.js +71 -5
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +18 -16
- package/packages/dd-trace/src/plugins/util/web.js +116 -180
- package/packages/dd-trace/src/priority_sampler.js +12 -21
- package/packages/dd-trace/src/profiling/config.js +132 -212
- package/packages/dd-trace/src/profiling/constants.js +4 -7
- package/packages/dd-trace/src/profiling/exporter_cli.js +10 -10
- package/packages/dd-trace/src/profiling/exporters/agent.js +61 -28
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +45 -14
- package/packages/dd-trace/src/profiling/exporters/file.js +16 -5
- package/packages/dd-trace/src/profiling/oom.js +71 -0
- package/packages/dd-trace/src/profiling/profiler.js +84 -105
- package/packages/dd-trace/src/profiling/profilers/event_plugins/crypto.js +32 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/zlib.js +19 -0
- package/packages/dd-trace/src/profiling/profilers/events.js +57 -13
- package/packages/dd-trace/src/profiling/profilers/space.js +27 -16
- package/packages/dd-trace/src/profiling/profilers/wall.js +49 -35
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +3 -3
- package/packages/dd-trace/src/propagation-hash/index.js +1 -1
- package/packages/dd-trace/src/proxy.js +50 -36
- package/packages/dd-trace/src/rate_limiter.js +1 -1
- package/packages/dd-trace/src/remote_config/index.js +6 -5
- package/packages/dd-trace/src/remote_config/scheduler.js +1 -1
- package/packages/dd-trace/src/ritm.js +6 -3
- package/packages/dd-trace/src/runtime_metrics/client.js +30 -0
- package/packages/dd-trace/src/runtime_metrics/index.js +14 -4
- package/packages/dd-trace/src/runtime_metrics/otlp_runtime_metrics.js +284 -0
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +42 -41
- package/packages/dd-trace/src/sampling_rule.js +7 -7
- package/packages/dd-trace/src/scope.js +10 -15
- package/packages/dd-trace/src/serverless.js +6 -7
- package/packages/dd-trace/src/service-naming/extra-services.js +14 -0
- package/packages/dd-trace/src/service-naming/index.js +1 -1
- package/packages/dd-trace/src/service-naming/schemas/definition.js +4 -1
- package/packages/dd-trace/src/service-naming/schemas/util.js +48 -3
- package/packages/dd-trace/src/service-naming/schemas/v0/graphql.js +6 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +61 -2
- package/packages/dd-trace/src/service-naming/schemas/v0/serverless.js +12 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +60 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +25 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/websocket.js +5 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/graphql.js +8 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +32 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/serverless.js +12 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +17 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/web.js +23 -3
- package/packages/dd-trace/src/service-naming/schemas/v1/websocket.js +6 -0
- package/packages/dd-trace/src/service-naming/source-resolver.js +50 -0
- package/packages/dd-trace/src/span_format.js +269 -81
- package/packages/dd-trace/src/span_processor.js +13 -13
- package/packages/dd-trace/src/span_stats.js +101 -79
- package/packages/dd-trace/src/spanleak.js +1 -2
- package/packages/dd-trace/src/standalone/index.js +3 -25
- package/packages/dd-trace/src/startup-log.js +3 -3
- package/packages/dd-trace/src/tagger.js +2 -4
- package/packages/dd-trace/src/telemetry/dependencies.js +2 -2
- package/packages/dd-trace/src/telemetry/endpoints.js +7 -5
- package/packages/dd-trace/src/telemetry/index.js +2 -2
- package/packages/dd-trace/src/telemetry/logs/index.js +1 -1
- package/packages/dd-trace/src/telemetry/send-data.js +20 -20
- package/packages/dd-trace/src/telemetry/session-propagation.js +1 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +16 -14
- package/packages/dd-trace/src/tracer.js +23 -9
- package/packages/dd-trace/src/tracer_metadata.js +1 -1
- package/packages/dd-trace/src/util.js +31 -0
- package/register.js +58 -1
- package/vendor/dist/@apm-js-collab/code-transformer/index.js +94 -42
- package/vendor/dist/@datadog/sketches-js/LICENSE +10 -36
- package/vendor/dist/@datadog/sketches-js/index.js +1 -1
- package/vendor/dist/pprof-format/index.js +1 -1
- package/vendor/dist/protobufjs/index.js +1 -1
- package/vendor/dist/protobufjs/minimal/index.js +1 -1
- package/vendor/dist/shell-quote/index.js +1 -1
- package/packages/datadog-plugin-graphql/src/resolve.js +0 -178
- package/packages/dd-trace/src/agent/url.js +0 -28
- package/packages/dd-trace/src/appsec/api_security_sampler.js +0 -117
- package/packages/dd-trace/src/lambda/runtime/ritm.js +0 -133
- package/packages/dd-trace/src/log/utils.js +0 -16
- package/packages/dd-trace/src/msgpack/encoder.js +0 -308
- package/packages/dd-trace/src/plugins/structured_log_plugin.js +0 -9
- package/scripts/preinstall.js +0 -34
- package/vendor/dist/ignore/LICENSE +0 -21
- package/vendor/dist/ignore/index.js +0 -1
- package/vendor/dist/opentracing/LICENSE +0 -201
- package/vendor/dist/opentracing/binary_carrier.d.ts +0 -11
- package/vendor/dist/opentracing/constants.d.ts +0 -61
- package/vendor/dist/opentracing/examples/demo/demo.d.ts +0 -2
- package/vendor/dist/opentracing/ext/tags.d.ts +0 -90
- package/vendor/dist/opentracing/functions.d.ts +0 -20
- package/vendor/dist/opentracing/global_tracer.d.ts +0 -14
- package/vendor/dist/opentracing/index.d.ts +0 -12
- package/vendor/dist/opentracing/index.js +0 -1
- package/vendor/dist/opentracing/mock_tracer/index.d.ts +0 -5
- package/vendor/dist/opentracing/mock_tracer/mock_context.d.ts +0 -13
- package/vendor/dist/opentracing/mock_tracer/mock_report.d.ts +0 -16
- package/vendor/dist/opentracing/mock_tracer/mock_span.d.ts +0 -50
- package/vendor/dist/opentracing/mock_tracer/mock_tracer.d.ts +0 -26
- package/vendor/dist/opentracing/noop.d.ts +0 -8
- package/vendor/dist/opentracing/reference.d.ts +0 -33
- package/vendor/dist/opentracing/span.d.ts +0 -147
- package/vendor/dist/opentracing/span_context.d.ts +0 -26
- package/vendor/dist/opentracing/test/api_compatibility.d.ts +0 -16
- package/vendor/dist/opentracing/test/mocktracer_implemenation.d.ts +0 -3
- package/vendor/dist/opentracing/test/noop_implementation.d.ts +0 -4
- package/vendor/dist/opentracing/test/opentracing_api.d.ts +0 -3
- package/vendor/dist/opentracing/test/unittest.d.ts +0 -2
- package/vendor/dist/opentracing/tracer.d.ts +0 -127
- package/vendor/dist/path-to-regexp/LICENSE +0 -21
- package/vendor/dist/path-to-regexp/index.js +0 -1
|
@@ -6,35 +6,36 @@
|
|
|
6
6
|
const { Readable } = require('stream')
|
|
7
7
|
const http = require('http')
|
|
8
8
|
const https = require('https')
|
|
9
|
+
const net = require('net')
|
|
9
10
|
const zlib = require('zlib')
|
|
10
11
|
|
|
11
12
|
const { storage } = require('../../../../datadog-core')
|
|
12
13
|
const log = require('../../log')
|
|
13
|
-
const {
|
|
14
|
+
const { parseUrl } = require('./url')
|
|
14
15
|
const docker = require('./docker')
|
|
15
16
|
const { httpAgent, httpsAgent } = require('./agents')
|
|
17
|
+
const {
|
|
18
|
+
getMaxAttempts,
|
|
19
|
+
getRetryDelay,
|
|
20
|
+
isRetriableNetworkError,
|
|
21
|
+
markEndpointReached,
|
|
22
|
+
} = require('./retry')
|
|
23
|
+
|
|
24
|
+
const legacyStorage = storage('legacy')
|
|
16
25
|
|
|
17
26
|
const maxActiveBufferSize = 1024 * 1024 * 64
|
|
18
27
|
|
|
19
28
|
let activeBufferSize = 0
|
|
20
29
|
|
|
21
30
|
/**
|
|
22
|
-
* @param {string
|
|
23
|
-
* @returns {object}
|
|
31
|
+
* @param {string} hostname Host as resolved by {@link parseUrl}; IPv6 is unbracketed (`::1`).
|
|
24
32
|
*/
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (url.protocol === 'unix:' && url.hostname === '.') {
|
|
32
|
-
const udsPath = urlObjOrString.slice(5)
|
|
33
|
-
url.path = udsPath
|
|
34
|
-
url.pathname = udsPath
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return url
|
|
33
|
+
function isLoopbackHost (hostname) {
|
|
34
|
+
// The 127.0.0.0/8 block is loopback, but only when the host is an actual IPv4 literal: a
|
|
35
|
+
// hostname like `127.evil.com` shares the prefix yet resolves anywhere, so net.isIPv4 gates it.
|
|
36
|
+
return hostname === 'localhost' ||
|
|
37
|
+
hostname === '::1' ||
|
|
38
|
+
(hostname.startsWith('127.') && net.isIPv4(hostname))
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
/**
|
|
@@ -59,6 +60,20 @@ function request (data, options, callback) {
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
// Never put the Datadog API key on a cleartext connection to a non-loopback host; that would
|
|
64
|
+
// expose it on the wire. Loopback (local agent, dev proxy, tests) is exempt. Strip the key
|
|
65
|
+
// rather than drop the request: the agent proxies telemetry with its own key, while an https
|
|
66
|
+
// intake URL is required to authenticate agentless traffic.
|
|
67
|
+
const hasApiKey = options.headers['dd-api-key'] !== undefined || options.headers['DD-API-KEY'] !== undefined
|
|
68
|
+
if (hasApiKey && options.protocol === 'http:' && !isLoopbackHost(options.hostname)) {
|
|
69
|
+
log.error(
|
|
70
|
+
'Not sending the Datadog API key over a non-TLS connection to %s. Configure an https intake URL.',
|
|
71
|
+
options.hostname
|
|
72
|
+
)
|
|
73
|
+
delete options.headers['dd-api-key']
|
|
74
|
+
delete options.headers['DD-API-KEY']
|
|
75
|
+
}
|
|
76
|
+
|
|
62
77
|
if (data instanceof Readable) {
|
|
63
78
|
const chunks = []
|
|
64
79
|
|
|
@@ -92,6 +107,8 @@ function request (data, options, callback) {
|
|
|
92
107
|
options.agent = isSecure ? httpsAgent : httpAgent
|
|
93
108
|
|
|
94
109
|
const onResponse = (res, finalize) => {
|
|
110
|
+
markEndpointReached(options)
|
|
111
|
+
|
|
95
112
|
const chunks = []
|
|
96
113
|
|
|
97
114
|
res.setTimeout(timeout)
|
|
@@ -142,7 +159,10 @@ function request (data, options, callback) {
|
|
|
142
159
|
})
|
|
143
160
|
}
|
|
144
161
|
|
|
145
|
-
|
|
162
|
+
// Retries always run via setTimeout so the AsyncLocalStorage store survives
|
|
163
|
+
// the gap before socket.connect(); ALS.run() does not call ALS.enterWith()
|
|
164
|
+
// outside AsyncContextFrame, so a synchronous re-entry would lose the store.
|
|
165
|
+
const attempt = attemptIndex => {
|
|
146
166
|
if (!request.writable) {
|
|
147
167
|
log.debug('Maximum number of active requests reached: payload is discarded.')
|
|
148
168
|
return callback(null)
|
|
@@ -150,7 +170,7 @@ function request (data, options, callback) {
|
|
|
150
170
|
|
|
151
171
|
activeBufferSize += options.headers['Content-Length'] ?? 0
|
|
152
172
|
|
|
153
|
-
|
|
173
|
+
legacyStorage.run({ noop: true }, () => {
|
|
154
174
|
let finished = false
|
|
155
175
|
const finalize = () => {
|
|
156
176
|
if (finished) return
|
|
@@ -163,9 +183,16 @@ function request (data, options, callback) {
|
|
|
163
183
|
req.once('close', finalize)
|
|
164
184
|
req.once('timeout', finalize)
|
|
165
185
|
|
|
166
|
-
req.once('error',
|
|
186
|
+
req.once('error', error => {
|
|
167
187
|
finalize()
|
|
168
|
-
|
|
188
|
+
if (attemptIndex < getMaxAttempts(options) && isRetriableNetworkError(error)) {
|
|
189
|
+
// Unref so a pending retry never keeps the host process alive past
|
|
190
|
+
// its natural exit point; long-running apps still retry because the
|
|
191
|
+
// event loop is held open by their own work.
|
|
192
|
+
setTimeout(attempt, getRetryDelay(options, attemptIndex), attemptIndex + 1).unref?.()
|
|
193
|
+
} else {
|
|
194
|
+
callback(error)
|
|
195
|
+
}
|
|
169
196
|
})
|
|
170
197
|
|
|
171
198
|
req.setTimeout(timeout, () => {
|
|
@@ -185,14 +212,7 @@ function request (data, options, callback) {
|
|
|
185
212
|
})
|
|
186
213
|
}
|
|
187
214
|
|
|
188
|
-
|
|
189
|
-
// request before socket.connect() is called. This is a workaround for the
|
|
190
|
-
// issue that the AsyncLocalStorage.run() method does not call the
|
|
191
|
-
// AsyncLocalStorage.enterWith() method when not using AsyncContextFrame.
|
|
192
|
-
//
|
|
193
|
-
// TODO: Test that this doesn't trace itself on retry when the diagnostics
|
|
194
|
-
// channel events are available in the agent exporter.
|
|
195
|
-
makeRequest(() => setTimeout(() => makeRequest(callback)))
|
|
215
|
+
attempt(1)
|
|
196
216
|
}
|
|
197
217
|
|
|
198
218
|
function byteLength (data) {
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const RATE_LIMIT_MAX_WAIT_MS = 30_000
|
|
4
|
+
|
|
5
|
+
const SINGLE_RETRY_BASE_MS = 5000
|
|
6
|
+
const SINGLE_RETRY_JITTER_MS = 2500
|
|
7
|
+
|
|
8
|
+
const STARTUP_GRACE_MS = 30_000
|
|
9
|
+
const STARTUP_BACKOFF_BASE_MS = 1000
|
|
10
|
+
const STARTUP_BACKOFF_MAX_MS = 8000
|
|
11
|
+
const STARTUP_BACKOFF_JITTER_MS = 500
|
|
12
|
+
const STARTUP_MAX_ATTEMPTS = 5
|
|
13
|
+
const POST_STARTUP_MAX_ATTEMPTS = 2
|
|
14
|
+
|
|
15
|
+
// `ECONNREFUSED` and `ENOENT` cover the agent-not-yet-listening cases (TCP and
|
|
16
|
+
// UDS). `EAI_AGAIN` covers transient DNS in agentless intake. `ENOTFOUND` is
|
|
17
|
+
// excluded because it usually means a misconfigured host, not a transient state.
|
|
18
|
+
const RETRIABLE_NETWORK_CODES = new Set([
|
|
19
|
+
'EAI_AGAIN',
|
|
20
|
+
'ECONNREFUSED',
|
|
21
|
+
'ECONNRESET',
|
|
22
|
+
'ENOENT',
|
|
23
|
+
'EPIPE',
|
|
24
|
+
'ETIMEDOUT',
|
|
25
|
+
])
|
|
26
|
+
|
|
27
|
+
const startedAtMs = Date.now()
|
|
28
|
+
const reachedEndpoints = new Set()
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @typedef {object} EndpointOptions
|
|
32
|
+
* @property {string} [socketPath]
|
|
33
|
+
* @property {string} [hostname]
|
|
34
|
+
* @property {string} [host]
|
|
35
|
+
* @property {string|number} [port]
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {Error & { code?: string }} error
|
|
40
|
+
*/
|
|
41
|
+
function isRetriableNetworkError (error) {
|
|
42
|
+
return error?.code !== undefined && RETRIABLE_NETWORK_CODES.has(error.code)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function singleJitteredDelay () {
|
|
46
|
+
return SINGLE_RETRY_BASE_MS + Math.random() * SINGLE_RETRY_JITTER_MS
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Stable key identifying the destination so the startup-phase gate is scoped
|
|
51
|
+
* per endpoint. UDS path beats host:port because both can coexist on the same
|
|
52
|
+
* options object after `parseUrl` runs.
|
|
53
|
+
*
|
|
54
|
+
* @param {EndpointOptions} options
|
|
55
|
+
*/
|
|
56
|
+
function getEndpointKey (options) {
|
|
57
|
+
if (options.socketPath) return options.socketPath
|
|
58
|
+
return `${options.hostname || options.host || ''}:${options.port || ''}`
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @param {EndpointOptions} options
|
|
63
|
+
*/
|
|
64
|
+
function inStartupPhase (options) {
|
|
65
|
+
if ((Date.now() - startedAtMs) >= STARTUP_GRACE_MS) return false
|
|
66
|
+
return !reachedEndpoints.has(getEndpointKey(options))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Wait time before the next attempt when the previous one just failed. Bounded
|
|
71
|
+
* exponential backoff with small jitter inside the startup grace window;
|
|
72
|
+
* single 5–7.5 s jittered retry afterwards.
|
|
73
|
+
*
|
|
74
|
+
* @param {EndpointOptions} options
|
|
75
|
+
* @param {number} previousAttempt 1-based index of the attempt that just failed.
|
|
76
|
+
*/
|
|
77
|
+
function getRetryDelay (options, previousAttempt) {
|
|
78
|
+
if (!inStartupPhase(options)) return singleJitteredDelay()
|
|
79
|
+
const exp = Math.min(STARTUP_BACKOFF_MAX_MS, STARTUP_BACKOFF_BASE_MS << (previousAttempt - 1))
|
|
80
|
+
return exp + Math.random() * STARTUP_BACKOFF_JITTER_MS
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {EndpointOptions} options
|
|
85
|
+
*/
|
|
86
|
+
function getMaxAttempts (options) {
|
|
87
|
+
return inStartupPhase(options) ? STARTUP_MAX_ATTEMPTS : POST_STARTUP_MAX_ATTEMPTS
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @param {EndpointOptions} options
|
|
92
|
+
*/
|
|
93
|
+
function markEndpointReached (options) {
|
|
94
|
+
reachedEndpoints.add(getEndpointKey(options))
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
module.exports = {
|
|
98
|
+
RATE_LIMIT_MAX_WAIT_MS,
|
|
99
|
+
getMaxAttempts,
|
|
100
|
+
getRetryDelay,
|
|
101
|
+
isRetriableNetworkError,
|
|
102
|
+
markEndpointReached,
|
|
103
|
+
singleJitteredDelay,
|
|
104
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { urlToHttpOptions } = require('./url-to-http-options-polyfill')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Convert an agent/intake URL into Node http(s) request options.
|
|
7
|
+
*
|
|
8
|
+
* A Windows named pipe (`unix://./pipe/<name>`) parses the `.` as the URL
|
|
9
|
+
* authority, dropping it from the path. Fold it back so the socket path stays
|
|
10
|
+
* `//./pipe/<name>`; otherwise it collapses to `/pipe/<name>` and misses the
|
|
11
|
+
* pipe. Exporters receive `config.url` as a URL object, so this must run for
|
|
12
|
+
* both string and object input.
|
|
13
|
+
*
|
|
14
|
+
* @param {string|URL|object} urlObjOrString
|
|
15
|
+
* @returns {object}
|
|
16
|
+
*/
|
|
17
|
+
function parseUrl (urlObjOrString) {
|
|
18
|
+
// `urlToHttpOptions` returns `pathname` at runtime, but @types/node narrows it
|
|
19
|
+
// to `ClientRequestArgs`, which omits it; cast so the named-pipe fold below can
|
|
20
|
+
// read and rewrite it.
|
|
21
|
+
const url = /** @type {import('node:http').ClientRequestArgs & { pathname: string }} */ (
|
|
22
|
+
urlObjOrString !== null && typeof urlObjOrString === 'object'
|
|
23
|
+
? urlToHttpOptions(urlObjOrString)
|
|
24
|
+
: urlToHttpOptions(new URL(urlObjOrString))
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
if (url.protocol === 'unix:' && url.hostname === '.') {
|
|
28
|
+
url.path = url.pathname = `//.${url.pathname}`
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return url
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = { parseUrl }
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const getConfig = require('../../config')
|
|
4
4
|
|
|
5
5
|
function safeJSONStringify (value) {
|
|
6
6
|
return JSON.stringify(
|
|
7
7
|
value,
|
|
8
8
|
(key, value) => key === 'dd-api-key' ? undefined : value,
|
|
9
|
-
|
|
9
|
+
getConfig().DD_TRACE_BEAUTIFUL_LOGS ? 2 : undefined
|
|
10
10
|
)
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const { channel } = require('dc-polyfill')
|
|
4
4
|
|
|
5
5
|
const log = require('../../log')
|
|
6
|
+
const { MAX_SIZE: MAX_CHUNK_SIZE } = require('../../msgpack')
|
|
6
7
|
const request = require('./request')
|
|
7
8
|
const { safeJSONStringify } = require('./util')
|
|
8
9
|
|
|
@@ -27,7 +28,22 @@ class Writer {
|
|
|
27
28
|
this.#isFirstFlush = false
|
|
28
29
|
this._beforeFirstFlush()
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
let payload
|
|
32
|
+
try {
|
|
33
|
+
payload = this._encoder.makePayload()
|
|
34
|
+
} catch (error) {
|
|
35
|
+
if (error.code !== 'ERR_MSGPACK_CHUNK_OVERFLOW') throw error
|
|
36
|
+
// Multi-chunk encoders (v0.5, CI Visibility) only learn the assembled
|
|
37
|
+
// payload exceeds the cap when `makePayload` stitches the chunks
|
|
38
|
+
// together, after `encode` already returned — so the encode-time catch
|
|
39
|
+
// never sees it. Drop the queued payload here instead of letting the
|
|
40
|
+
// RangeError escape into the host application; the agent would reject
|
|
41
|
+
// the oversized payload at the network boundary anyway.
|
|
42
|
+
this._encoder.reset()
|
|
43
|
+
log.error('Writer dropped %d trace(s) that exceeded the %d byte chunk cap', count, MAX_CHUNK_SIZE)
|
|
44
|
+
done()
|
|
45
|
+
return
|
|
46
|
+
}
|
|
31
47
|
this._sendPayload(payload, count, done)
|
|
32
48
|
} else {
|
|
33
49
|
done()
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { channel } = require('dc-polyfill')
|
|
4
|
+
const { truncateSpan, normalizeSpan } = require('../../encode/tags-processors')
|
|
5
|
+
|
|
6
|
+
const traceChannel = channel('datadog:apm:electron:export')
|
|
7
|
+
|
|
8
|
+
class ElectronExporter {
|
|
9
|
+
#timer
|
|
10
|
+
#traces = []
|
|
11
|
+
|
|
12
|
+
constructor (config) {
|
|
13
|
+
this._config = config
|
|
14
|
+
|
|
15
|
+
globalThis[Symbol.for('dd-trace')].beforeExitHandlers.add(this.flush.bind(this))
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export (spans) {
|
|
19
|
+
this.#traces.push(spans)
|
|
20
|
+
|
|
21
|
+
const { flushInterval } = this._config
|
|
22
|
+
|
|
23
|
+
if (flushInterval === 0) {
|
|
24
|
+
this.flush()
|
|
25
|
+
} else if (this.#timer === undefined) {
|
|
26
|
+
this.#timer = setTimeout(() => {
|
|
27
|
+
this.flush()
|
|
28
|
+
this.#timer = undefined
|
|
29
|
+
}, flushInterval)
|
|
30
|
+
this.#timer.unref?.()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
flush (done = () => {}) {
|
|
35
|
+
clearTimeout(this.#timer)
|
|
36
|
+
this.#timer = undefined
|
|
37
|
+
|
|
38
|
+
const traces = this.#traces.splice(0)
|
|
39
|
+
|
|
40
|
+
if (traces.length > 0 && traceChannel.hasSubscribers) {
|
|
41
|
+
const formattedTraces = traces.map(spans => spans.map(span => normalizeSpan(truncateSpan(span))))
|
|
42
|
+
traceChannel.publish(formattedTraces)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
done()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
module.exports = ElectronExporter
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { getAgentUrl } = require('../../agent/url')
|
|
4
3
|
const { Writer } = require('./writer')
|
|
5
4
|
|
|
6
5
|
class SpanStatsExporter {
|
|
7
6
|
constructor (config) {
|
|
8
|
-
this._url =
|
|
7
|
+
this._url = config.url
|
|
9
8
|
this._writer = new Writer({ url: this._url })
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -37,9 +37,7 @@ function makeRequest (data, url, cb) {
|
|
|
37
37
|
'Datadog-Meta-Tracer-Version': pkg.version,
|
|
38
38
|
'Content-Type': 'application/msgpack',
|
|
39
39
|
},
|
|
40
|
-
|
|
41
|
-
hostname: url.hostname,
|
|
42
|
-
port: url.port,
|
|
40
|
+
url,
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
log.debug('Request to the intake: %j', options)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {object} Feature
|
|
5
|
+
* @property {string} name
|
|
6
|
+
* @property {object} noop
|
|
7
|
+
* @property {() => object} factory
|
|
8
|
+
* @property {Function} [remoteConfig]
|
|
9
|
+
* @property {Function} [enable]
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** @type {{ [name: string]: Feature }} */
|
|
13
|
+
const features = {}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {Feature} feature
|
|
17
|
+
*/
|
|
18
|
+
function registerFeature (feature) {
|
|
19
|
+
features[feature.name] = feature
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = { features, registerFeature }
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs')
|
|
4
|
+
const path = require('node:path')
|
|
5
|
+
|
|
6
|
+
const log = require('./log')
|
|
7
|
+
const { GIT_COMMIT_SHA, GIT_REPOSITORY_URL } = require('./plugins/util/tags')
|
|
8
|
+
const {
|
|
9
|
+
getGitMetadataFromGitProperties,
|
|
10
|
+
getRemoteOriginURL,
|
|
11
|
+
removeUserSensitiveInfo,
|
|
12
|
+
resolveGitHeadSHA,
|
|
13
|
+
} = require('./config/git_properties')
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {{ commitSHA: string | undefined, repositoryUrl: string | undefined }} GitMetadata
|
|
17
|
+
* @type {{ enabled?: GitMetadata, disabled?: GitMetadata }}
|
|
18
|
+
*/
|
|
19
|
+
const cache = {}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {import('./config/config-types').ConfigProperties} config
|
|
23
|
+
*/
|
|
24
|
+
function getGitMetadata (config) {
|
|
25
|
+
if (!config.DD_TRACE_GIT_METADATA_ENABLED) {
|
|
26
|
+
cache.disabled ??= { commitSHA: undefined, repositoryUrl: undefined }
|
|
27
|
+
return cache.disabled
|
|
28
|
+
}
|
|
29
|
+
if (cache.enabled) return cache.enabled
|
|
30
|
+
|
|
31
|
+
let repositoryUrl = removeUserSensitiveInfo(config.DD_GIT_REPOSITORY_URL ?? config.tags[GIT_REPOSITORY_URL])
|
|
32
|
+
let commitSHA = config.DD_GIT_COMMIT_SHA ?? config.tags[GIT_COMMIT_SHA]
|
|
33
|
+
|
|
34
|
+
if (!repositoryUrl || !commitSHA) {
|
|
35
|
+
const propertiesFile = config.DD_GIT_PROPERTIES_FILE
|
|
36
|
+
const gitPropertiesFile = propertiesFile ?? `${process.cwd()}/git.properties`
|
|
37
|
+
try {
|
|
38
|
+
const fromProperties = getGitMetadataFromGitProperties(fs.readFileSync(gitPropertiesFile, 'utf8'))
|
|
39
|
+
commitSHA ??= fromProperties.commitSHA
|
|
40
|
+
repositoryUrl ??= fromProperties.repositoryUrl
|
|
41
|
+
} catch (error) {
|
|
42
|
+
if (propertiesFile) {
|
|
43
|
+
log.error('Error reading DD_GIT_PROPERTIES_FILE: %s', gitPropertiesFile, error)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const folderPath = config.DD_GIT_FOLDER_PATH
|
|
49
|
+
const gitFolderPath = folderPath ?? path.join(process.cwd(), '.git')
|
|
50
|
+
|
|
51
|
+
if (!repositoryUrl) {
|
|
52
|
+
const gitConfigPath = path.join(gitFolderPath, 'config')
|
|
53
|
+
try {
|
|
54
|
+
repositoryUrl = getRemoteOriginURL(fs.readFileSync(gitConfigPath, 'utf8'))
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (folderPath) {
|
|
57
|
+
log.error('Error reading git config: %s', gitConfigPath, error)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
commitSHA ??= resolveGitHeadSHA(gitFolderPath)
|
|
63
|
+
|
|
64
|
+
cache.enabled = { commitSHA, repositoryUrl }
|
|
65
|
+
return cache.enabled
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = getGitMetadata
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { SCI_COMMIT_SHA, SCI_REPOSITORY_URL } = require('./constants')
|
|
4
|
+
const getGitMetadata = require('./git_metadata')
|
|
4
5
|
|
|
5
6
|
class GitMetadataTagger {
|
|
7
|
+
#commitSHA
|
|
8
|
+
#repositoryUrl
|
|
9
|
+
#enabled
|
|
10
|
+
|
|
6
11
|
constructor (config) {
|
|
7
|
-
this
|
|
12
|
+
this.#enabled = config.DD_TRACE_GIT_METADATA_ENABLED
|
|
13
|
+
const { commitSHA, repositoryUrl } = getGitMetadata(config)
|
|
14
|
+
this.#commitSHA = commitSHA
|
|
15
|
+
this.#repositoryUrl = repositoryUrl
|
|
8
16
|
}
|
|
9
17
|
|
|
10
18
|
tagGitMetadata (spanContext) {
|
|
11
|
-
if (this
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
if (this.#enabled) {
|
|
20
|
+
const tags = spanContext._trace.tags
|
|
21
|
+
tags[SCI_COMMIT_SHA] = this.#commitSHA
|
|
22
|
+
tags[SCI_REPOSITORY_URL] = this.#repositoryUrl
|
|
15
23
|
}
|
|
16
24
|
}
|
|
17
25
|
}
|
|
@@ -14,11 +14,13 @@ function guard (fn) {
|
|
|
14
14
|
var initBailout = false
|
|
15
15
|
var clobberBailout = false
|
|
16
16
|
var forced = isTrue(process.env.DD_INJECT_FORCE)
|
|
17
|
-
var
|
|
18
|
-
var
|
|
17
|
+
var pkg = require('../../../../package.json')
|
|
18
|
+
var engines = pkg.engines
|
|
19
|
+
var versions = engines.node.match(/^>=(\d+)$/)
|
|
19
20
|
var minMajor = versions[1]
|
|
20
|
-
var nextMajor =
|
|
21
|
+
var nextMajor = pkg.nodeMaxMajor
|
|
21
22
|
var version = process.versions.node
|
|
23
|
+
var supportedRange = engines.node + ' <' + nextMajor
|
|
22
24
|
|
|
23
25
|
if (process.env.DD_INJECTION_ENABLED) {
|
|
24
26
|
// If we're running via single-step install, and we're in the app's
|
|
@@ -45,16 +47,19 @@ function guard (fn) {
|
|
|
45
47
|
// should not initialize the tracer.
|
|
46
48
|
if (!clobberBailout && (NODE_MAJOR < minMajor || NODE_MAJOR >= nextMajor)) {
|
|
47
49
|
initBailout = true
|
|
50
|
+
var runtimeInfo = 'Incompatible runtime Node.js ' + version + ', supported runtimes: Node.js ' + supportedRange
|
|
51
|
+
// When not forced, the process bails out here and may call process.exit() right away;
|
|
52
|
+
// forward synchronously so the telemetry child can't outlive us and wedge the exit.
|
|
48
53
|
telemetry([
|
|
49
54
|
{ name: 'abort', tags: ['reason:incompatible_runtime'] },
|
|
50
55
|
{ name: 'abort.runtime', tags: [] }
|
|
51
56
|
], undefined, {
|
|
52
57
|
result: 'abort',
|
|
53
58
|
result_class: 'incompatible_runtime',
|
|
54
|
-
result_reason:
|
|
55
|
-
})
|
|
59
|
+
result_reason: runtimeInfo
|
|
60
|
+
}, !forced)
|
|
56
61
|
log.info('Aborting application instrumentation due to incompatible_runtime.')
|
|
57
|
-
log.info('Found incompatible runtime Node.js %s, Supported runtimes: Node.js %s.', version,
|
|
62
|
+
log.info('Found incompatible runtime Node.js %s, Supported runtimes: Node.js %s.', version, supportedRange)
|
|
58
63
|
if (forced) {
|
|
59
64
|
log.info('DD_INJECT_FORCE enabled, allowing unsupported runtimes and continuing.')
|
|
60
65
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
var fs = require('fs')
|
|
4
|
-
|
|
4
|
+
// Capture the child_process functions at load time, before the tracer wraps the module.
|
|
5
|
+
// Reaching through require('child_process') at send time would route the forwarder through
|
|
6
|
+
// the tracer's own child_process instrumentation once the tracer is initialized.
|
|
7
|
+
var childProcess = require('child_process')
|
|
8
|
+
var spawn = childProcess.spawn
|
|
9
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
10
|
+
var spawnSync = childProcess.spawnSync
|
|
5
11
|
var tracerVersion = require('../../../../package.json').version
|
|
6
12
|
var log = require('./log')
|
|
7
13
|
|
|
@@ -47,7 +53,7 @@ function shouldSend (point) {
|
|
|
47
53
|
return true
|
|
48
54
|
}
|
|
49
55
|
|
|
50
|
-
function sendTelemetry (name, tags, resultMetadata) {
|
|
56
|
+
function sendTelemetry (name, tags, resultMetadata, synchronous) {
|
|
51
57
|
var points = name
|
|
52
58
|
if (typeof name === 'string') {
|
|
53
59
|
points = [{ name: name, tags: tags || [] }]
|
|
@@ -74,6 +80,37 @@ function sendTelemetry (name, tags, resultMetadata) {
|
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
82
|
|
|
83
|
+
var payload = JSON.stringify({ metadata: currentMetadata, points: points })
|
|
84
|
+
|
|
85
|
+
// A forwarder spawned asynchronously can still be tearing down its stdio pipes when the
|
|
86
|
+
// injected app calls process.exit(); on Node 24.0.0/24.1.x that deadlocks the exit
|
|
87
|
+
// (fixed upstream in 24.2), hanging short-lived single-step-install processes. On the
|
|
88
|
+
// bailout path the caller passes synchronous=true, so the child is fully reaped before we
|
|
89
|
+
// return and nothing survives to race the exit. spawnSync is only reached on that path,
|
|
90
|
+
// before any instrumentation is active, so it never traces the forwarder. It exists since
|
|
91
|
+
// Node 0.11.12; the guardrails still target >=0.8, which predates the exit bug anyway.
|
|
92
|
+
if (synchronous && spawnSync) {
|
|
93
|
+
// Bound the blocking send: this telemetry is best-effort and the whole point of the
|
|
94
|
+
// synchronous path is to avoid a hung exit, so a forwarder that wedges must not become a
|
|
95
|
+
// new hard hang. On timeout spawnSync kills the child and returns error.code ETIMEDOUT.
|
|
96
|
+
var result = spawnSync(telemetryForwarderPath, ['library_entrypoint'], {
|
|
97
|
+
input: payload,
|
|
98
|
+
stdio: ['pipe', 'ignore', 'ignore'],
|
|
99
|
+
timeout: 1000,
|
|
100
|
+
killSignal: 'SIGKILL'
|
|
101
|
+
})
|
|
102
|
+
if (result.error) {
|
|
103
|
+
if (result.error.code === 'ETIMEDOUT') {
|
|
104
|
+
log.error('Telemetry forwarder timed out')
|
|
105
|
+
} else {
|
|
106
|
+
log.error('Failed to spawn telemetry forwarder')
|
|
107
|
+
}
|
|
108
|
+
} else if (result.status) {
|
|
109
|
+
log.error('Telemetry forwarder exited with code', result.status)
|
|
110
|
+
}
|
|
111
|
+
return
|
|
112
|
+
}
|
|
113
|
+
|
|
77
114
|
var proc = spawn(telemetryForwarderPath, ['library_entrypoint'], {
|
|
78
115
|
stdio: 'pipe'
|
|
79
116
|
})
|
|
@@ -88,5 +125,5 @@ function sendTelemetry (name, tags, resultMetadata) {
|
|
|
88
125
|
proc.stdin.on('error', function () {
|
|
89
126
|
log.error('Failed to write telemetry data to telemetry forwarder')
|
|
90
127
|
})
|
|
91
|
-
proc.stdin.end(
|
|
128
|
+
proc.stdin.end(payload)
|
|
92
129
|
}
|
|
@@ -8,11 +8,11 @@ const { threadId } = require('worker_threads')
|
|
|
8
8
|
const log = require('./log')
|
|
9
9
|
|
|
10
10
|
async function scheduleSnapshot (config, total) {
|
|
11
|
-
if (total > config.
|
|
11
|
+
if (total > config.DD_HEAP_SNAPSHOT_COUNT) return
|
|
12
12
|
|
|
13
|
-
await setTimeout(config.
|
|
13
|
+
await setTimeout(config.DD_HEAP_SNAPSHOT_INTERVAL * 1000, null, { ref: false })
|
|
14
14
|
await clearMemory()
|
|
15
|
-
writeHeapSnapshot(getName(config.
|
|
15
|
+
writeHeapSnapshot(getName(config.DD_HEAP_SNAPSHOT_DESTINATION))
|
|
16
16
|
await scheduleSnapshot(config, total + 1)
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -49,7 +49,7 @@ module.exports = {
|
|
|
49
49
|
* @param {import('./config/config-base')} config - Tracer configuration
|
|
50
50
|
*/
|
|
51
51
|
async start (config) {
|
|
52
|
-
const destination = config.
|
|
52
|
+
const destination = config.DD_HEAP_SNAPSHOT_DESTINATION
|
|
53
53
|
|
|
54
54
|
try {
|
|
55
55
|
await scheduleSnapshot(config, 1)
|