dd-trace 5.53.0 → 5.55.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 +2 -1
- package/ci/cypress/plugin.js +8 -0
- package/ci/cypress/polyfills.js +23 -0
- package/ci/init.js +8 -7
- package/index.d.ts +33 -16
- package/initialize.mjs +5 -6
- package/package.json +40 -38
- package/packages/datadog-code-origin/index.js +22 -4
- package/packages/datadog-core/src/utils/src/get.js +1 -1
- package/packages/datadog-core/src/utils/src/has.js +1 -1
- package/packages/datadog-core/src/utils/src/kebabcase.js +4 -6
- package/packages/datadog-core/src/utils/src/parse-tags.js +1 -1
- package/packages/datadog-core/src/utils/src/pick.js +2 -2
- package/packages/datadog-core/src/utils/src/set.js +1 -1
- package/packages/datadog-core/src/utils/src/uniq.js +1 -1
- package/packages/datadog-instrumentations/src/amqp10.js +19 -17
- package/packages/datadog-instrumentations/src/amqplib.js +52 -35
- package/packages/datadog-instrumentations/src/apollo.js +2 -2
- package/packages/datadog-instrumentations/src/aws-sdk.js +1 -1
- package/packages/datadog-instrumentations/src/cassandra-driver.js +10 -10
- package/packages/datadog-instrumentations/src/child_process.js +1 -2
- package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +89 -75
- package/packages/datadog-instrumentations/src/cookie-parser.js +1 -1
- package/packages/datadog-instrumentations/src/couchbase.js +6 -9
- package/packages/datadog-instrumentations/src/cucumber.js +108 -68
- package/packages/datadog-instrumentations/src/cypress.js +2 -1
- package/packages/datadog-instrumentations/src/dns.js +5 -5
- package/packages/datadog-instrumentations/src/elasticsearch.js +9 -10
- package/packages/datadog-instrumentations/src/fastify.js +7 -9
- package/packages/datadog-instrumentations/src/fs.js +1 -1
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +35 -43
- package/packages/datadog-instrumentations/src/graphql.js +7 -10
- package/packages/datadog-instrumentations/src/grpc/client.js +11 -23
- package/packages/datadog-instrumentations/src/grpc/server.js +7 -20
- package/packages/datadog-instrumentations/src/hapi.js +10 -11
- package/packages/datadog-instrumentations/src/helpers/extract-package-and-module-path.js +16 -10
- package/packages/datadog-instrumentations/src/helpers/fetch.js +4 -5
- package/packages/datadog-instrumentations/src/helpers/hook.js +2 -3
- package/packages/datadog-instrumentations/src/helpers/hooks.js +0 -1
- package/packages/datadog-instrumentations/src/helpers/instrument.js +1 -41
- package/packages/datadog-instrumentations/src/helpers/register.js +11 -12
- package/packages/datadog-instrumentations/src/http/client.js +14 -20
- package/packages/datadog-instrumentations/src/jest.js +201 -143
- package/packages/datadog-instrumentations/src/kafkajs.js +52 -44
- package/packages/datadog-instrumentations/src/knex.js +4 -4
- package/packages/datadog-instrumentations/src/koa.js +2 -3
- package/packages/datadog-instrumentations/src/ldapjs.js +3 -4
- package/packages/datadog-instrumentations/src/mariadb.js +49 -65
- package/packages/datadog-instrumentations/src/mocha/main.js +116 -73
- package/packages/datadog-instrumentations/src/mocha/utils.js +36 -12
- package/packages/datadog-instrumentations/src/mocha/worker.js +6 -0
- package/packages/datadog-instrumentations/src/mocha.js +3 -1
- package/packages/datadog-instrumentations/src/mongodb-core.js +1 -1
- package/packages/datadog-instrumentations/src/mysql.js +30 -37
- package/packages/datadog-instrumentations/src/mysql2.js +53 -47
- package/packages/datadog-instrumentations/src/net.js +1 -1
- package/packages/datadog-instrumentations/src/next.js +1 -0
- package/packages/datadog-instrumentations/src/nyc.js +3 -2
- package/packages/datadog-instrumentations/src/openai.js +22 -24
- package/packages/datadog-instrumentations/src/oracledb.js +1 -1
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +4 -3
- package/packages/datadog-instrumentations/src/pg.js +3 -5
- package/packages/datadog-instrumentations/src/playwright.js +123 -83
- package/packages/datadog-instrumentations/src/protobufjs.js +3 -4
- package/packages/datadog-instrumentations/src/redis.js +4 -4
- package/packages/datadog-instrumentations/src/restify.js +9 -13
- package/packages/datadog-instrumentations/src/rhea.js +42 -54
- package/packages/datadog-instrumentations/src/router.js +30 -32
- package/packages/datadog-instrumentations/src/tedious.js +2 -3
- package/packages/datadog-instrumentations/src/vitest.js +87 -52
- package/packages/datadog-plugin-amqp10/src/consumer.js +7 -3
- package/packages/datadog-plugin-amqp10/src/producer.js +7 -3
- package/packages/datadog-plugin-amqplib/src/client.js +6 -2
- package/packages/datadog-plugin-amqplib/src/consumer.js +7 -3
- package/packages/datadog-plugin-amqplib/src/producer.js +7 -3
- package/packages/datadog-plugin-amqplib/src/util.js +1 -1
- package/packages/datadog-plugin-apollo/src/gateway/request.js +5 -6
- package/packages/datadog-plugin-apollo/src/gateway/validate.js +2 -3
- package/packages/datadog-plugin-avsc/src/schema_iterator.js +12 -12
- package/packages/datadog-plugin-aws-sdk/src/base.js +15 -10
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/tracing.js +2 -2
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +13 -13
- package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +3 -5
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +28 -43
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +2 -2
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +10 -11
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +4 -6
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +3 -5
- package/packages/datadog-plugin-aws-sdk/src/services/s3.js +3 -5
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +2 -3
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +11 -15
- package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/util.js +5 -6
- package/packages/datadog-plugin-cassandra-driver/src/index.js +1 -1
- package/packages/datadog-plugin-child_process/src/index.js +4 -4
- package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +23 -23
- package/packages/datadog-plugin-cucumber/src/index.js +60 -4
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +99 -28
- package/packages/datadog-plugin-cypress/src/plugin.js +11 -1
- package/packages/datadog-plugin-cypress/src/support.js +24 -5
- package/packages/datadog-plugin-dd-trace-api/src/index.js +2 -1
- package/packages/datadog-plugin-elasticsearch/src/index.js +1 -1
- package/packages/datadog-plugin-express/src/code_origin.js +30 -0
- package/packages/datadog-plugin-express/src/index.js +10 -12
- package/packages/datadog-plugin-express/src/tracing.js +19 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +7 -3
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +12 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +6 -2
- package/packages/datadog-plugin-google-cloud-vertexai/src/tracing.js +27 -10
- package/packages/datadog-plugin-graphql/src/execute.js +2 -2
- package/packages/datadog-plugin-graphql/src/index.js +10 -8
- package/packages/datadog-plugin-graphql/src/resolve.js +19 -12
- package/packages/datadog-plugin-graphql/src/tools/index.js +1 -0
- package/packages/datadog-plugin-graphql/src/tools/signature.js +1 -0
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +1 -0
- package/packages/datadog-plugin-grpc/src/client.js +2 -2
- package/packages/datadog-plugin-grpc/src/util.js +2 -2
- package/packages/datadog-plugin-http/src/client.js +23 -13
- package/packages/datadog-plugin-http2/src/client.js +24 -25
- package/packages/datadog-plugin-jest/src/index.js +26 -23
- package/packages/datadog-plugin-jest/src/util.js +8 -8
- package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +3 -1
- package/packages/datadog-plugin-kafkajs/src/consumer.js +9 -5
- package/packages/datadog-plugin-kafkajs/src/producer.js +8 -3
- package/packages/datadog-plugin-kafkajs/src/utils.js +1 -1
- package/packages/datadog-plugin-langchain/src/handlers/chain.js +7 -7
- package/packages/datadog-plugin-langchain/src/handlers/embedding.js +2 -2
- package/packages/datadog-plugin-langchain/src/handlers/language_models/chat_model.js +6 -4
- package/packages/datadog-plugin-langchain/src/handlers/language_models/llm.js +5 -4
- package/packages/datadog-plugin-langchain/src/tracing.js +11 -10
- package/packages/datadog-plugin-mariadb/src/index.js +3 -9
- package/packages/datadog-plugin-mocha/src/index.js +39 -14
- package/packages/datadog-plugin-mongodb-core/src/index.js +3 -2
- package/packages/datadog-plugin-mysql/src/index.js +22 -9
- package/packages/datadog-plugin-mysql2/src/index.js +16 -0
- package/packages/datadog-plugin-net/src/tcp.js +1 -1
- package/packages/datadog-plugin-next/src/index.js +7 -6
- package/packages/datadog-plugin-openai/src/services.js +6 -10
- package/packages/datadog-plugin-openai/src/tracing.js +12 -18
- package/packages/datadog-plugin-oracledb/src/index.js +1 -1
- package/packages/datadog-plugin-playwright/src/index.js +25 -4
- package/packages/datadog-plugin-protobufjs/src/schema_iterator.js +8 -9
- package/packages/datadog-plugin-redis/src/index.js +2 -4
- package/packages/datadog-plugin-rhea/src/consumer.js +8 -6
- package/packages/datadog-plugin-rhea/src/producer.js +5 -2
- package/packages/datadog-plugin-router/src/index.js +1 -1
- package/packages/datadog-plugin-selenium/src/index.js +1 -6
- package/packages/datadog-plugin-vitest/src/index.js +52 -35
- package/packages/datadog-shimmer/src/shimmer.js +4 -8
- package/packages/dd-trace/src/appsec/api_security_sampler.js +2 -2
- package/packages/dd-trace/src/appsec/blocked_templates.js +1 -1
- package/packages/dd-trace/src/appsec/blocking.js +6 -20
- package/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +0 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-password-rules.js +0 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secret-rules.js +0 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secrets-rules.js +0 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hsts-header-missing-analyzer.js +7 -12
- package/packages/dd-trace/src/appsec/iast/analyzers/missing-header-analyzer.js +5 -8
- package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +4 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/path-traversal-analyzer.js +9 -12
- package/packages/dd-trace/src/appsec/iast/analyzers/vulnerability-analyzer.js +5 -4
- package/packages/dd-trace/src/appsec/iast/context/context-plugin.js +2 -3
- package/packages/dd-trace/src/appsec/iast/iast-plugin.js +3 -3
- package/packages/dd-trace/src/appsec/iast/index.js +1 -0
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +102 -7
- package/packages/dd-trace/src/appsec/iast/path-line.js +7 -8
- package/packages/dd-trace/src/appsec/iast/security-controls/index.js +16 -24
- package/packages/dd-trace/src/appsec/iast/security-controls/parser.js +6 -6
- package/packages/dd-trace/src/appsec/iast/taint-tracking/filter.js +2 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/operations-taint-object.js +3 -3
- package/packages/dd-trace/src/appsec/iast/taint-tracking/operations.js +4 -28
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +2 -8
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugins/kafka.js +3 -4
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-esm.mjs +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +7 -8
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +2 -2
- package/packages/dd-trace/src/appsec/iast/telemetry/span-tags.js +7 -7
- package/packages/dd-trace/src/appsec/iast/telemetry/verbosity.js +2 -3
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/range-utils.js +10 -11
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/command-sensitive-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/ldap-sensitive-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +7 -7
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +23 -28
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-regex.js +3 -3
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js +4 -4
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +6 -11
- package/packages/dd-trace/src/appsec/iast/vulnerabilities.js +0 -1
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +9 -11
- package/packages/dd-trace/src/appsec/index.js +5 -5
- package/packages/dd-trace/src/appsec/rasp/index.js +15 -15
- package/packages/dd-trace/src/appsec/rasp/lfi.js +2 -1
- package/packages/dd-trace/src/appsec/reporter.js +232 -41
- package/packages/dd-trace/src/appsec/rule_manager.js +2 -2
- package/packages/dd-trace/src/appsec/sdk/set_user.js +2 -2
- package/packages/dd-trace/src/appsec/sdk/track_event.js +3 -3
- package/packages/dd-trace/src/appsec/stack_trace.js +2 -4
- package/packages/dd-trace/src/appsec/telemetry/index.js +31 -1
- package/packages/dd-trace/src/appsec/telemetry/rasp.js +3 -5
- package/packages/dd-trace/src/appsec/telemetry/waf.js +3 -5
- package/packages/dd-trace/src/appsec/user_tracking.js +3 -5
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +8 -4
- package/packages/dd-trace/src/azure_metadata.js +9 -9
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +9 -8
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +2 -2
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +3 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +3 -3
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +3 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +3 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +3 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +6 -4
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +6 -5
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +7 -6
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/writer.js +0 -2
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +3 -2
- package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +5 -4
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +12 -8
- package/packages/dd-trace/src/ci-visibility/telemetry.js +4 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +3 -2
- package/packages/dd-trace/src/config-helper.js +89 -0
- package/packages/dd-trace/src/config.js +159 -129
- package/packages/dd-trace/src/config_stable.js +10 -7
- package/packages/dd-trace/src/datastreams/encoding.js +9 -9
- package/packages/dd-trace/src/datastreams/fnv.js +2 -2
- package/packages/dd-trace/src/datastreams/pathway.js +4 -4
- package/packages/dd-trace/src/datastreams/processor.js +5 -7
- package/packages/dd-trace/src/datastreams/schemas/schema_builder.js +7 -7
- package/packages/dd-trace/src/datastreams/schemas/schema_sampler.js +4 -6
- package/packages/dd-trace/src/datastreams/size.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +75 -69
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +7 -10
- package/packages/dd-trace/src/debugger/devtools_client/defaults.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/index.js +9 -2
- package/packages/dd-trace/src/debugger/devtools_client/remote_config.js +18 -38
- package/packages/dd-trace/src/debugger/devtools_client/send.js +3 -2
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +1 -2
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +11 -14
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/redaction.js +4 -4
- package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +2 -10
- package/packages/dd-trace/src/debugger/devtools_client/state.js +10 -3
- package/packages/dd-trace/src/debugger/index.js +1 -0
- package/packages/dd-trace/src/dogstatsd.js +7 -6
- package/packages/dd-trace/src/encode/0.4.js +14 -11
- package/packages/dd-trace/src/encode/0.5.js +4 -6
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +8 -8
- package/packages/dd-trace/src/encode/coverage-ci-visibility.js +1 -1
- package/packages/dd-trace/src/encode/tags-processors.js +1 -1
- package/packages/dd-trace/src/exporter.js +7 -6
- package/packages/dd-trace/src/exporters/agent/writer.js +1 -5
- package/packages/dd-trace/src/exporters/common/docker.js +4 -3
- package/packages/dd-trace/src/exporters/common/form-data.js +6 -4
- package/packages/dd-trace/src/exporters/common/request.js +5 -2
- package/packages/dd-trace/src/exporters/common/util.js +4 -2
- package/packages/dd-trace/src/external-logger/src/index.js +5 -5
- package/packages/dd-trace/src/flare/file.js +1 -5
- package/packages/dd-trace/src/format.js +1 -1
- package/packages/dd-trace/src/git_properties.js +1 -1
- package/packages/dd-trace/src/id.js +15 -9
- package/packages/dd-trace/src/iitm.js +10 -22
- package/packages/dd-trace/src/index.js +4 -3
- package/packages/dd-trace/src/lambda/handler.js +7 -6
- package/packages/dd-trace/src/lambda/index.js +2 -1
- package/packages/dd-trace/src/lambda/runtime/patch.js +7 -6
- package/packages/dd-trace/src/lambda/runtime/ritm.js +4 -3
- package/packages/dd-trace/src/llmobs/constants/tags.js +1 -0
- package/packages/dd-trace/src/llmobs/index.js +21 -5
- package/packages/dd-trace/src/llmobs/noop.js +18 -20
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +6 -6
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chain.js +2 -6
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +3 -3
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/index.js +11 -13
- package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +6 -6
- package/packages/dd-trace/src/llmobs/plugins/openai.js +2 -3
- package/packages/dd-trace/src/llmobs/sdk.js +4 -3
- package/packages/dd-trace/src/llmobs/span_processor.js +1 -1
- package/packages/dd-trace/src/llmobs/tagger.js +129 -102
- package/packages/dd-trace/src/llmobs/util.js +9 -9
- package/packages/dd-trace/src/llmobs/writers/base.js +1 -1
- package/packages/dd-trace/src/llmobs/writers/util.js +1 -1
- package/packages/dd-trace/src/log/index.js +9 -8
- package/packages/dd-trace/src/log/log.js +1 -1
- package/packages/dd-trace/src/log/writer.js +3 -4
- package/packages/dd-trace/src/msgpack/chunk.js +3 -3
- package/packages/dd-trace/src/msgpack/encoder.js +31 -31
- package/packages/dd-trace/src/noop/dogstatsd.js +6 -6
- package/packages/dd-trace/src/noop/span.js +4 -6
- package/packages/dd-trace/src/noop/tracer.js +1 -2
- package/packages/dd-trace/src/opentelemetry/span_processor.js +2 -2
- package/packages/dd-trace/src/opentelemetry/tracer.js +7 -6
- package/packages/dd-trace/src/opentracing/propagation/log.js +10 -13
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +40 -37
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +8 -4
- package/packages/dd-trace/src/opentracing/span.js +16 -20
- package/packages/dd-trace/src/opentracing/tracer.js +9 -6
- package/packages/dd-trace/src/payload-tagging/config/index.js +17 -21
- package/packages/dd-trace/src/payload-tagging/index.js +1 -1
- package/packages/dd-trace/src/payload-tagging/tagging.js +6 -6
- package/packages/dd-trace/src/pkg.js +1 -1
- package/packages/dd-trace/src/plugin_manager.js +4 -3
- package/packages/dd-trace/src/plugins/ci_plugin.js +87 -11
- package/packages/dd-trace/src/plugins/consumer.js +2 -2
- package/packages/dd-trace/src/plugins/inbound.js +5 -1
- package/packages/dd-trace/src/plugins/index.js +0 -1
- package/packages/dd-trace/src/plugins/outbound.js +4 -5
- package/packages/dd-trace/src/plugins/plugin.js +1 -1
- package/packages/dd-trace/src/plugins/producer.js +2 -2
- package/packages/dd-trace/src/plugins/storage.js +2 -2
- package/packages/dd-trace/src/plugins/util/ci.js +28 -20
- package/packages/dd-trace/src/plugins/util/git.js +166 -12
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +1 -1
- package/packages/dd-trace/src/plugins/util/ip_extractor.js +1 -1
- package/packages/dd-trace/src/plugins/util/llm.js +27 -10
- package/packages/dd-trace/src/plugins/util/stacktrace.js +9 -2
- package/packages/dd-trace/src/plugins/util/test.js +315 -51
- package/packages/dd-trace/src/plugins/util/url.js +1 -1
- package/packages/dd-trace/src/plugins/util/urlfilter.js +13 -17
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +14 -4
- package/packages/dd-trace/src/plugins/util/web.js +8 -8
- package/packages/dd-trace/src/priority_sampler.js +64 -53
- package/packages/dd-trace/src/profiling/config.js +51 -35
- package/packages/dd-trace/src/profiling/exporter_cli.js +20 -20
- package/packages/dd-trace/src/profiling/exporters/agent.js +1 -1
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +7 -6
- package/packages/dd-trace/src/profiling/exporters/file.js +2 -1
- package/packages/dd-trace/src/profiling/index.js +2 -1
- package/packages/dd-trace/src/profiling/profiler.js +44 -6
- package/packages/dd-trace/src/profiling/profilers/events.js +14 -17
- package/packages/dd-trace/src/profiling/profilers/shared.js +6 -1
- package/packages/dd-trace/src/profiling/profilers/space.js +3 -3
- package/packages/dd-trace/src/profiling/profilers/wall.js +6 -7
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +3 -5
- package/packages/dd-trace/src/profiling/ssi-telemetry-mock-profiler.js +3 -1
- package/packages/dd-trace/src/profiling/tagger.js +21 -13
- package/packages/dd-trace/src/profiling/webspan-utils.js +1 -1
- package/packages/dd-trace/src/proxy.js +9 -10
- package/packages/dd-trace/src/random_sampler.js +40 -0
- package/packages/dd-trace/src/rate_limiter.js +4 -4
- package/packages/dd-trace/src/remote_config/index.js +3 -7
- package/packages/dd-trace/src/remote_config/manager.js +25 -13
- package/packages/dd-trace/src/require-package-json.js +1 -1
- package/packages/dd-trace/src/ritm.js +8 -8
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +5 -4
- package/packages/dd-trace/src/sampler.js +41 -4
- package/packages/dd-trace/src/sampling_rule.js +12 -3
- package/packages/dd-trace/src/scope.js +1 -1
- package/packages/dd-trace/src/serverless.js +11 -4
- package/packages/dd-trace/src/service-naming/schemas/util.js +1 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +2 -3
- package/packages/dd-trace/src/span_processor.js +5 -4
- package/packages/dd-trace/src/span_sampler.js +4 -1
- package/packages/dd-trace/src/standalone/tracesource.js +2 -3
- package/packages/dd-trace/src/standalone/tracesource_priority_sampler.js +1 -2
- package/packages/dd-trace/src/startup-log.js +6 -18
- package/packages/dd-trace/src/supported-configurations.json +439 -0
- package/packages/dd-trace/src/telemetry/dependencies.js +64 -59
- package/packages/dd-trace/src/telemetry/logs/log-collector.js +9 -10
- package/packages/dd-trace/src/telemetry/metrics.js +10 -5
- package/packages/dd-trace/src/telemetry/send-data.js +8 -7
- package/packages/dd-trace/src/telemetry/telemetry.js +31 -45
- package/packages/dd-trace/src/tracer.js +3 -7
- package/packages/dd-trace/src/util.js +1 -6
- package/version.js +1 -0
- package/packages/datadog-instrumentations/src/paperplane.js +0 -77
- package/packages/datadog-plugin-paperplane/src/index.js +0 -25
- package/packages/datadog-plugin-paperplane/src/logger.js +0 -11
- package/packages/datadog-plugin-paperplane/src/server.js +0 -24
- package/packages/dd-trace/src/appsec/iast/analyzers/header-injection-analyzer.js +0 -122
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/header-sensitive-analyzer.js +0 -20
|
@@ -64,7 +64,9 @@ class KafkajsConsumerPlugin extends ConsumerPlugin {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
bindStart (ctx) {
|
|
68
|
+
const { topic, partition, message, groupId, clusterId } = ctx.extractedArgs || ctx
|
|
69
|
+
|
|
68
70
|
let childOf
|
|
69
71
|
const headers = convertToTextMap(message?.headers)
|
|
70
72
|
if (headers) {
|
|
@@ -83,7 +85,7 @@ class KafkajsConsumerPlugin extends ConsumerPlugin {
|
|
|
83
85
|
metrics: {
|
|
84
86
|
'kafka.partition': partition
|
|
85
87
|
}
|
|
86
|
-
})
|
|
88
|
+
}, ctx)
|
|
87
89
|
if (message?.offset) span.setTag('kafka.message.offset', message?.offset)
|
|
88
90
|
|
|
89
91
|
if (this.config.dsmEnabled && headers) {
|
|
@@ -97,16 +99,18 @@ class KafkajsConsumerPlugin extends ConsumerPlugin {
|
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
if (afterStartCh.hasSubscribers) {
|
|
100
|
-
afterStartCh.publish({ topic, partition, message, groupId })
|
|
102
|
+
afterStartCh.publish({ topic, partition, message, groupId, currentStore: ctx.currentStore })
|
|
101
103
|
}
|
|
104
|
+
|
|
105
|
+
return ctx.currentStore
|
|
102
106
|
}
|
|
103
107
|
|
|
104
|
-
finish () {
|
|
108
|
+
finish (ctx) {
|
|
105
109
|
if (beforeFinishCh.hasSubscribers) {
|
|
106
110
|
beforeFinishCh.publish()
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
super.finish()
|
|
113
|
+
super.finish(ctx)
|
|
110
114
|
}
|
|
111
115
|
}
|
|
112
116
|
|
|
@@ -52,7 +52,9 @@ class KafkajsProducerPlugin extends ProducerPlugin {
|
|
|
52
52
|
* @param {ProducerResponseItem[]} commitList
|
|
53
53
|
* @returns {void}
|
|
54
54
|
*/
|
|
55
|
-
commit (
|
|
55
|
+
commit (ctx) {
|
|
56
|
+
const commitList = ctx.result
|
|
57
|
+
|
|
56
58
|
if (!this.config.dsmEnabled) return
|
|
57
59
|
if (!commitList || !Array.isArray(commitList)) return
|
|
58
60
|
const keys = [
|
|
@@ -67,7 +69,8 @@ class KafkajsProducerPlugin extends ProducerPlugin {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
bindStart (ctx) {
|
|
73
|
+
const { topic, messages, bootstrapServers, clusterId, disableHeaderInjection } = ctx
|
|
71
74
|
const span = this.startSpan({
|
|
72
75
|
resource: topic,
|
|
73
76
|
meta: {
|
|
@@ -79,7 +82,7 @@ class KafkajsProducerPlugin extends ProducerPlugin {
|
|
|
79
82
|
metrics: {
|
|
80
83
|
'kafka.batch_size': messages.length
|
|
81
84
|
}
|
|
82
|
-
})
|
|
85
|
+
}, ctx)
|
|
83
86
|
if (bootstrapServers) {
|
|
84
87
|
span.setTag(BOOTSTRAP_SERVERS_KEY, bootstrapServers)
|
|
85
88
|
}
|
|
@@ -105,6 +108,8 @@ class KafkajsProducerPlugin extends ProducerPlugin {
|
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
}
|
|
111
|
+
|
|
112
|
+
return ctx.currentStore
|
|
108
113
|
}
|
|
109
114
|
}
|
|
110
115
|
|
|
@@ -4,7 +4,7 @@ function convertToTextMap (bufferMap) {
|
|
|
4
4
|
if (!bufferMap) return null
|
|
5
5
|
|
|
6
6
|
// rdKafka returns an array of header maps
|
|
7
|
-
if (bufferMap
|
|
7
|
+
if (Array.isArray(bufferMap)) {
|
|
8
8
|
const headers = {}
|
|
9
9
|
for (const headerMap of bufferMap) {
|
|
10
10
|
for (const key of Object.keys(headerMap)) {
|
|
@@ -3,35 +3,35 @@
|
|
|
3
3
|
const LangChainHandler = require('./default')
|
|
4
4
|
|
|
5
5
|
class LangChainChainHandler extends LangChainHandler {
|
|
6
|
-
getSpanStartTags (ctx) {
|
|
6
|
+
getSpanStartTags (ctx, provider, span) {
|
|
7
7
|
const tags = {}
|
|
8
8
|
|
|
9
|
-
if (!this.isPromptCompletionSampled()) return tags
|
|
9
|
+
if (!this.isPromptCompletionSampled(span)) return tags
|
|
10
10
|
|
|
11
11
|
let inputs = ctx.args?.[0]
|
|
12
12
|
inputs = Array.isArray(inputs) ? inputs : [inputs]
|
|
13
13
|
|
|
14
14
|
for (const idx in inputs) {
|
|
15
15
|
const input = inputs[idx]
|
|
16
|
-
if (typeof input
|
|
17
|
-
tags[`langchain.request.inputs.${idx}`] = this.normalize(input)
|
|
18
|
-
} else {
|
|
16
|
+
if (typeof input === 'object') {
|
|
19
17
|
for (const [key, value] of Object.entries(input)) {
|
|
20
18
|
// these are mappings to the python client names, ie lc_kwargs
|
|
21
19
|
// only present on BaseMessage types
|
|
22
20
|
if (key.includes('lc_')) continue
|
|
23
21
|
tags[`langchain.request.inputs.${idx}.${key}`] = this.normalize(value)
|
|
24
22
|
}
|
|
23
|
+
} else {
|
|
24
|
+
tags[`langchain.request.inputs.${idx}`] = this.normalize(input)
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
return tags
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
getSpanEndTags (ctx) {
|
|
31
|
+
getSpanEndTags (ctx, span) {
|
|
32
32
|
const tags = {}
|
|
33
33
|
|
|
34
|
-
if (!this.isPromptCompletionSampled()) return tags
|
|
34
|
+
if (!this.isPromptCompletionSampled(span)) return tags
|
|
35
35
|
|
|
36
36
|
let outputs = ctx.result
|
|
37
37
|
outputs = Array.isArray(outputs) ? outputs : [outputs]
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
const LangChainHandler = require('./default')
|
|
4
4
|
|
|
5
5
|
class LangChainEmbeddingHandler extends LangChainHandler {
|
|
6
|
-
getSpanStartTags (ctx) {
|
|
6
|
+
getSpanStartTags (ctx, provider, span) {
|
|
7
7
|
const tags = {}
|
|
8
8
|
|
|
9
9
|
const inputTexts = ctx.args?.[0]
|
|
10
10
|
|
|
11
|
-
const sampled = this.isPromptCompletionSampled()
|
|
11
|
+
const sampled = this.isPromptCompletionSampled(span)
|
|
12
12
|
if (typeof inputTexts === 'string') {
|
|
13
13
|
// embed query
|
|
14
14
|
if (sampled) {
|
|
@@ -5,7 +5,7 @@ const LangChainLanguageModelHandler = require('.')
|
|
|
5
5
|
const COMPLETIONS = 'langchain.response.completions'
|
|
6
6
|
|
|
7
7
|
class LangChainChatModelHandler extends LangChainLanguageModelHandler {
|
|
8
|
-
getSpanStartTags (ctx, provider) {
|
|
8
|
+
getSpanStartTags (ctx, provider, span) {
|
|
9
9
|
const tags = {}
|
|
10
10
|
|
|
11
11
|
const inputs = ctx.args?.[0]
|
|
@@ -15,7 +15,7 @@ class LangChainChatModelHandler extends LangChainLanguageModelHandler {
|
|
|
15
15
|
|
|
16
16
|
for (const messageIndex in messageSet) {
|
|
17
17
|
const message = messageSet[messageIndex]
|
|
18
|
-
if (this.isPromptCompletionSampled()) {
|
|
18
|
+
if (this.isPromptCompletionSampled(span)) {
|
|
19
19
|
tags[`langchain.request.messages.${messageSetIndex}.${messageIndex}.content`] =
|
|
20
20
|
this.normalize(message.content) || ''
|
|
21
21
|
}
|
|
@@ -39,11 +39,13 @@ class LangChainChatModelHandler extends LangChainLanguageModelHandler {
|
|
|
39
39
|
return tags
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
getSpanEndTags (ctx) {
|
|
42
|
+
getSpanEndTags (ctx, span) {
|
|
43
43
|
const { result } = ctx
|
|
44
44
|
|
|
45
45
|
const tags = {}
|
|
46
46
|
|
|
47
|
+
const sampled = this.isPromptCompletionSampled(span)
|
|
48
|
+
|
|
47
49
|
this.extractTokenMetrics(ctx.currentStore?.span, result)
|
|
48
50
|
|
|
49
51
|
for (const messageSetIdx in result?.generations) {
|
|
@@ -56,7 +58,7 @@ class LangChainChatModelHandler extends LangChainLanguageModelHandler {
|
|
|
56
58
|
const message = chatCompletion.message
|
|
57
59
|
let toolCalls = message.tool_calls
|
|
58
60
|
|
|
59
|
-
if (text &&
|
|
61
|
+
if (text && sampled) {
|
|
60
62
|
tags[
|
|
61
63
|
`${COMPLETIONS}.${messageSetIdx}.${chatCompletionIdx}.content`
|
|
62
64
|
] = this.normalize(text)
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
const LangChainLanguageModelHandler = require('.')
|
|
4
4
|
|
|
5
5
|
class LangChainLLMHandler extends LangChainLanguageModelHandler {
|
|
6
|
-
getSpanStartTags (ctx, provider) {
|
|
6
|
+
getSpanStartTags (ctx, provider, span) {
|
|
7
7
|
const tags = {}
|
|
8
8
|
|
|
9
9
|
const prompts = ctx.args?.[0]
|
|
10
10
|
for (const promptIdx in prompts) {
|
|
11
|
-
if (!this.isPromptCompletionSampled()) continue
|
|
11
|
+
if (!this.isPromptCompletionSampled(span)) continue
|
|
12
12
|
|
|
13
13
|
const prompt = prompts[promptIdx]
|
|
14
14
|
tags[`langchain.request.prompts.${promptIdx}.content`] = this.normalize(prompt) || ''
|
|
@@ -30,16 +30,17 @@ class LangChainLLMHandler extends LangChainLanguageModelHandler {
|
|
|
30
30
|
return tags
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
getSpanEndTags (ctx) {
|
|
33
|
+
getSpanEndTags (ctx, span) {
|
|
34
34
|
const { result } = ctx
|
|
35
35
|
|
|
36
36
|
const tags = {}
|
|
37
|
+
const sampled = this.isPromptCompletionSampled(span)
|
|
37
38
|
|
|
38
39
|
this.extractTokenMetrics(ctx.currentStore?.span, result)
|
|
39
40
|
|
|
40
41
|
for (const completionIdx in result?.generations) {
|
|
41
42
|
const completion = result.generations[completionIdx]
|
|
42
|
-
if (
|
|
43
|
+
if (sampled) {
|
|
43
44
|
tags[`langchain.response.completions.${completionIdx}.text`] = this.normalize(completion[0].text) || ''
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -49,23 +49,24 @@ class BaseLangChainTracingPlugin extends TracingPlugin {
|
|
|
49
49
|
const provider = handler.extractProvider(instance)
|
|
50
50
|
const model = handler.extractModel(instance)
|
|
51
51
|
|
|
52
|
-
const tags = handler.getSpanStartTags(ctx, provider) || []
|
|
53
|
-
|
|
54
|
-
if (apiKey) tags[API_KEY] = apiKey
|
|
55
|
-
if (provider) tags[PROVIDER] = provider
|
|
56
|
-
if (model) tags[MODEL] = model
|
|
57
|
-
if (type) tags[TYPE] = type
|
|
58
|
-
|
|
59
52
|
const span = this.startSpan('langchain.request', {
|
|
60
53
|
service: this.config.service,
|
|
61
54
|
resource,
|
|
62
55
|
kind: 'client',
|
|
63
56
|
meta: {
|
|
64
|
-
[MEASURED]: 1
|
|
65
|
-
...tags
|
|
57
|
+
[MEASURED]: 1
|
|
66
58
|
}
|
|
67
59
|
}, false)
|
|
68
60
|
|
|
61
|
+
const tags = handler.getSpanStartTags(ctx, provider, span) || []
|
|
62
|
+
|
|
63
|
+
if (apiKey) tags[API_KEY] = apiKey
|
|
64
|
+
if (provider) tags[PROVIDER] = provider
|
|
65
|
+
if (model) tags[MODEL] = model
|
|
66
|
+
if (type) tags[TYPE] = type
|
|
67
|
+
|
|
68
|
+
span.addTags(tags)
|
|
69
|
+
|
|
69
70
|
const store = storage('legacy').getStore() || {}
|
|
70
71
|
ctx.currentStore = { ...store, span }
|
|
71
72
|
|
|
@@ -78,7 +79,7 @@ class BaseLangChainTracingPlugin extends TracingPlugin {
|
|
|
78
79
|
const { type } = ctx
|
|
79
80
|
|
|
80
81
|
const handler = this.handlers[type]
|
|
81
|
-
const tags = handler.getSpanEndTags(ctx) || {}
|
|
82
|
+
const tags = handler.getSpanEndTags(ctx, span) || {}
|
|
82
83
|
|
|
83
84
|
span.addTags(tags)
|
|
84
85
|
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
const { storage } = require('../../datadog-core')
|
|
4
4
|
const MySQLPlugin = require('../../datadog-plugin-mysql/src')
|
|
5
5
|
|
|
6
|
-
let skippedStore
|
|
7
|
-
|
|
8
6
|
class MariadbPlugin extends MySQLPlugin {
|
|
9
7
|
static get id () { return 'mariadb' }
|
|
10
8
|
static get system () { return 'mariadb' }
|
|
@@ -12,14 +10,10 @@ class MariadbPlugin extends MySQLPlugin {
|
|
|
12
10
|
constructor (...args) {
|
|
13
11
|
super(...args)
|
|
14
12
|
|
|
15
|
-
this.
|
|
16
|
-
skippedStore = storage('legacy').getStore()
|
|
17
|
-
storage('legacy').enterWith({ noop: true })
|
|
18
|
-
})
|
|
13
|
+
this.addBind(`apm:${this.component}:pool:skip`, () => ({ noop: true }))
|
|
19
14
|
|
|
20
|
-
this.addSub(`apm:${this.component}:
|
|
21
|
-
storage('legacy').
|
|
22
|
-
skippedStore = undefined
|
|
15
|
+
this.addSub(`apm:${this.component}:command:add`, ctx => {
|
|
16
|
+
ctx.parentStore = storage('legacy').getStore()
|
|
23
17
|
})
|
|
24
18
|
}
|
|
25
19
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const CiPlugin = require('../../dd-trace/src/plugins/ci_plugin')
|
|
4
4
|
const { storage } = require('../../datadog-core')
|
|
5
|
+
const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
|
|
5
6
|
|
|
6
7
|
const {
|
|
7
8
|
TEST_STATUS,
|
|
@@ -37,7 +38,9 @@ const {
|
|
|
37
38
|
TEST_MANAGEMENT_IS_ATTEMPT_TO_FIX,
|
|
38
39
|
TEST_HAS_FAILED_ALL_RETRIES,
|
|
39
40
|
TEST_MANAGEMENT_ATTEMPT_TO_FIX_PASSED,
|
|
40
|
-
TEST_RETRY_REASON_TYPES
|
|
41
|
+
TEST_RETRY_REASON_TYPES,
|
|
42
|
+
TEST_IS_MODIFIED,
|
|
43
|
+
isModifiedTest
|
|
41
44
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
42
45
|
const { COMPONENT } = require('../../dd-trace/src/constants')
|
|
43
46
|
const {
|
|
@@ -131,11 +134,9 @@ class MochaPlugin extends CiPlugin {
|
|
|
131
134
|
testSuiteMetadata[TEST_ITR_FORCED_RUN] = 'true'
|
|
132
135
|
this.telemetry.count(TELEMETRY_ITR_FORCED_TO_RUN, { testLevel: 'suite' })
|
|
133
136
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
testSuiteMetadata[TEST_SOURCE_FILE] = testSuite
|
|
138
|
-
}
|
|
137
|
+
testSuiteMetadata[TEST_SOURCE_FILE] = this.repositoryRoot !== this.sourceRoot && !!this.repositoryRoot
|
|
138
|
+
? getTestSuitePath(testSuiteAbsolutePath, this.repositoryRoot)
|
|
139
|
+
: testSuite
|
|
139
140
|
if (testSuiteMetadata[TEST_SOURCE_FILE]) {
|
|
140
141
|
testSuiteMetadata[TEST_SOURCE_START] = 1
|
|
141
142
|
}
|
|
@@ -192,6 +193,19 @@ class MochaPlugin extends CiPlugin {
|
|
|
192
193
|
return ctx.currentStore
|
|
193
194
|
})
|
|
194
195
|
|
|
196
|
+
this.addSub('ci:mocha:test:is-modified', ({ modifiedTests, file, onDone }) => {
|
|
197
|
+
const testPath = getTestSuitePath(file, this.repositoryRoot)
|
|
198
|
+
const isModified = isModifiedTest(
|
|
199
|
+
testPath,
|
|
200
|
+
null,
|
|
201
|
+
null,
|
|
202
|
+
modifiedTests,
|
|
203
|
+
this.constructor.id
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
onDone(isModified)
|
|
207
|
+
})
|
|
208
|
+
|
|
195
209
|
this.addBind('ci:mocha:test:fn', (ctx) => {
|
|
196
210
|
return ctx.currentStore
|
|
197
211
|
})
|
|
@@ -416,7 +430,7 @@ class MochaPlugin extends CiPlugin {
|
|
|
416
430
|
finishAllTraceSpans(this.testSessionSpan)
|
|
417
431
|
this.telemetry.count(TELEMETRY_TEST_SESSION, {
|
|
418
432
|
provider: this.ciProviderName,
|
|
419
|
-
autoInjected: !!
|
|
433
|
+
autoInjected: !!getEnvironmentVariable('DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER')
|
|
420
434
|
})
|
|
421
435
|
}
|
|
422
436
|
this.libraryConfig = null
|
|
@@ -453,6 +467,10 @@ class MochaPlugin extends CiPlugin {
|
|
|
453
467
|
this.tracer._exporter.export(trace)
|
|
454
468
|
})
|
|
455
469
|
})
|
|
470
|
+
|
|
471
|
+
this.addBind('ci:mocha:global:run', (ctx) => {
|
|
472
|
+
return ctx.currentStore
|
|
473
|
+
})
|
|
456
474
|
}
|
|
457
475
|
|
|
458
476
|
startTestSpan (testInfo) {
|
|
@@ -466,7 +484,8 @@ class MochaPlugin extends CiPlugin {
|
|
|
466
484
|
isParallel,
|
|
467
485
|
isAttemptToFix,
|
|
468
486
|
isDisabled,
|
|
469
|
-
isQuarantined
|
|
487
|
+
isQuarantined,
|
|
488
|
+
isModified
|
|
470
489
|
} = testInfo
|
|
471
490
|
|
|
472
491
|
const extraTags = {}
|
|
@@ -495,20 +514,26 @@ class MochaPlugin extends CiPlugin {
|
|
|
495
514
|
extraTags[TEST_MANAGEMENT_IS_QUARANTINED] = 'true'
|
|
496
515
|
}
|
|
497
516
|
|
|
517
|
+
if (isModified) {
|
|
518
|
+
extraTags[TEST_IS_MODIFIED] = 'true'
|
|
519
|
+
if (isEfdRetry) {
|
|
520
|
+
extraTags[TEST_IS_RETRY] = 'true'
|
|
521
|
+
extraTags[TEST_RETRY_REASON] = TEST_RETRY_REASON_TYPES.efd
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
498
525
|
const testSuite = getTestSuitePath(testSuiteAbsolutePath, this.sourceRoot)
|
|
499
526
|
const testSuiteSpan = this._testSuites.get(testSuite)
|
|
500
527
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
extraTags[TEST_SOURCE_FILE] = testSuite
|
|
505
|
-
}
|
|
528
|
+
extraTags[TEST_SOURCE_FILE] = this.repositoryRoot !== this.sourceRoot && !!this.repositoryRoot
|
|
529
|
+
? getTestSuitePath(testSuiteAbsolutePath, this.repositoryRoot)
|
|
530
|
+
: testSuite
|
|
506
531
|
|
|
507
532
|
if (isNew) {
|
|
508
533
|
extraTags[TEST_IS_NEW] = 'true'
|
|
509
534
|
if (isEfdRetry) {
|
|
510
535
|
extraTags[TEST_IS_RETRY] = 'true'
|
|
511
|
-
extraTags[TEST_RETRY_REASON] =
|
|
536
|
+
extraTags[TEST_RETRY_REASON] = TEST_RETRY_REASON_TYPES.efd
|
|
512
537
|
}
|
|
513
538
|
}
|
|
514
539
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const { isTrue } = require('../../dd-trace/src/util')
|
|
4
4
|
const DatabasePlugin = require('../../dd-trace/src/plugins/database')
|
|
5
5
|
const coalesce = require('koalas')
|
|
6
|
+
const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
|
|
6
7
|
|
|
7
8
|
class MongodbCorePlugin extends DatabasePlugin {
|
|
8
9
|
static get id () { return 'mongodb-core' }
|
|
@@ -14,7 +15,7 @@ class MongodbCorePlugin extends DatabasePlugin {
|
|
|
14
15
|
configure (config) {
|
|
15
16
|
super.configure(config)
|
|
16
17
|
|
|
17
|
-
const heartbeatFromEnv =
|
|
18
|
+
const heartbeatFromEnv = getEnvironmentVariable('DD_TRACE_MONGODB_HEARTBEAT_ENABLED')
|
|
18
19
|
|
|
19
20
|
this.config.heartbeatEnabled = coalesce(
|
|
20
21
|
config.heartbeatEnabled,
|
|
@@ -103,7 +104,7 @@ function getResource (plugin, ns, query, operationName) {
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
function truncate (input) {
|
|
106
|
-
return input.slice(0, Math.min(input.length,
|
|
107
|
+
return input.slice(0, Math.min(input.length, 10_000))
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
function shouldSimplify (input) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { storage } = require('../../datadog-core')
|
|
3
4
|
const CLIENT_PORT_KEY = require('../../dd-trace/src/constants')
|
|
4
5
|
const DatabasePlugin = require('../../dd-trace/src/plugins/database')
|
|
5
6
|
|
|
@@ -7,22 +8,34 @@ class MySQLPlugin extends DatabasePlugin {
|
|
|
7
8
|
static get id () { return 'mysql' }
|
|
8
9
|
static get system () { return 'mysql' }
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
constructor () {
|
|
12
|
+
super(...arguments)
|
|
13
|
+
|
|
14
|
+
this.addSub(`apm:${this.component}:connection:start`, ctx => {
|
|
15
|
+
ctx.parentStore = storage('legacy').getStore()
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
this.addBind(`apm:${this.component}:connection:finish`, ctx => ctx.parentStore)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
bindStart (ctx) {
|
|
22
|
+
const service = this.serviceName({ pluginConfig: this.config, dbConfig: ctx.conf, system: this.system })
|
|
12
23
|
const span = this.startSpan(this.operationName(), {
|
|
13
24
|
service,
|
|
14
|
-
resource:
|
|
25
|
+
resource: ctx.sql,
|
|
15
26
|
type: 'sql',
|
|
16
27
|
kind: 'client',
|
|
17
28
|
meta: {
|
|
18
29
|
'db.type': this.system,
|
|
19
|
-
'db.user':
|
|
20
|
-
'db.name':
|
|
21
|
-
'out.host':
|
|
22
|
-
[CLIENT_PORT_KEY]:
|
|
30
|
+
'db.user': ctx.conf.user,
|
|
31
|
+
'db.name': ctx.conf.database,
|
|
32
|
+
'out.host': ctx.conf.host,
|
|
33
|
+
[CLIENT_PORT_KEY]: ctx.conf.port
|
|
23
34
|
}
|
|
24
|
-
})
|
|
25
|
-
|
|
35
|
+
}, ctx)
|
|
36
|
+
ctx.sql = this.injectDbmQuery(span, ctx.sql, service)
|
|
37
|
+
|
|
38
|
+
return ctx.currentStore
|
|
26
39
|
}
|
|
27
40
|
}
|
|
28
41
|
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { storage } = require('../../datadog-core')
|
|
3
4
|
const MySQLPlugin = require('../../datadog-plugin-mysql/src')
|
|
4
5
|
|
|
5
6
|
class MySQL2Plugin extends MySQLPlugin {
|
|
6
7
|
static get id () { return 'mysql2' }
|
|
8
|
+
|
|
9
|
+
constructor () {
|
|
10
|
+
super(...arguments)
|
|
11
|
+
|
|
12
|
+
this.addSub(`apm:${this.component}:command:add`, ctx => {
|
|
13
|
+
ctx.parentStore = storage('legacy').getStore()
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
this.addBind(`apm:${this.component}:command:start`, ctx => ctx.parentStore)
|
|
17
|
+
this.addBind(`apm:${this.component}:command:finish`, ctx => ctx.parentStore)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
bindStart (ctx) {
|
|
21
|
+
return storage('legacy').run(ctx.parentStore, () => super.bindStart(ctx))
|
|
22
|
+
}
|
|
7
23
|
}
|
|
8
24
|
|
|
9
25
|
module.exports = MySQL2Plugin
|
|
@@ -31,7 +31,7 @@ class NetTCPPlugin extends ClientPlugin {
|
|
|
31
31
|
|
|
32
32
|
this.startSpan('tcp.connect', {
|
|
33
33
|
service: this.config.service,
|
|
34
|
-
resource: [host, port].filter(
|
|
34
|
+
resource: [host, port].filter(Boolean).join(':'),
|
|
35
35
|
kind: 'client',
|
|
36
36
|
meta: {
|
|
37
37
|
'tcp.remote.host': host,
|
|
@@ -6,7 +6,7 @@ const analyticsSampler = require('../../dd-trace/src/analytics_sampler')
|
|
|
6
6
|
const { COMPONENT } = require('../../dd-trace/src/constants')
|
|
7
7
|
const web = require('../../dd-trace/src/plugins/util/web')
|
|
8
8
|
|
|
9
|
-
const errorPages = ['/404', '/500', '/_error', '/_not-found', '/_not-found/page']
|
|
9
|
+
const errorPages = new Set(['/404', '/500', '/_error', '/_not-found', '/_not-found/page'])
|
|
10
10
|
|
|
11
11
|
class NextPlugin extends ServerPlugin {
|
|
12
12
|
static get id () {
|
|
@@ -97,7 +97,7 @@ class NextPlugin extends ServerPlugin {
|
|
|
97
97
|
|
|
98
98
|
// Only use error page names if there's not already a name
|
|
99
99
|
const current = span.context()._tags['next.page']
|
|
100
|
-
const isErrorPage = errorPages.
|
|
100
|
+
const isErrorPage = errorPages.has(page)
|
|
101
101
|
|
|
102
102
|
if (current && isErrorPage) {
|
|
103
103
|
return
|
|
@@ -106,7 +106,7 @@ class NextPlugin extends ServerPlugin {
|
|
|
106
106
|
// remove ending /route or /page for appDir projects
|
|
107
107
|
// need to check if not an error page too, as those are marked as app directory
|
|
108
108
|
// in newer versions
|
|
109
|
-
if (isAppPath && !isErrorPage) page = page.
|
|
109
|
+
if (isAppPath && !isErrorPage) page = page.slice(0, Math.max(0, page.lastIndexOf('/')))
|
|
110
110
|
|
|
111
111
|
// handle static resource
|
|
112
112
|
if (isStatic) {
|
|
@@ -134,12 +134,13 @@ function normalizeConfig (config) {
|
|
|
134
134
|
? config.validateStatus
|
|
135
135
|
: code => code < 500
|
|
136
136
|
|
|
137
|
-
return
|
|
137
|
+
return { ...config, hooks, validateStatus }
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
const noop = () => {}
|
|
141
|
+
|
|
140
142
|
function getHooks (config) {
|
|
141
|
-
const
|
|
142
|
-
const request = (config.hooks && config.hooks.request) || noop
|
|
143
|
+
const request = config.hooks?.request ?? noop
|
|
143
144
|
|
|
144
145
|
return { request }
|
|
145
146
|
}
|
|
@@ -11,8 +11,8 @@ let logger = null
|
|
|
11
11
|
let interval = null
|
|
12
12
|
|
|
13
13
|
module.exports.init = function (tracerConfig) {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
metrics = tracerConfig && tracerConfig.dogstatsd
|
|
15
|
+
? new DogStatsDClient({
|
|
16
16
|
host: tracerConfig.dogstatsd.hostname,
|
|
17
17
|
port: tracerConfig.dogstatsd.port,
|
|
18
18
|
tags: [
|
|
@@ -21,21 +21,17 @@ module.exports.init = function (tracerConfig) {
|
|
|
21
21
|
`version:${tracerConfig.tags.version}`
|
|
22
22
|
]
|
|
23
23
|
})
|
|
24
|
-
|
|
25
|
-
metrics = new NoopDogStatsDClient()
|
|
26
|
-
}
|
|
24
|
+
: new NoopDogStatsDClient()
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
logger = tracerConfig && tracerConfig.apiKey
|
|
27
|
+
? new ExternalLogger({
|
|
30
28
|
ddsource: 'openai',
|
|
31
29
|
hostname: tracerConfig.hostname,
|
|
32
30
|
service: tracerConfig.service,
|
|
33
31
|
apiKey: tracerConfig.apiKey,
|
|
34
32
|
interval: FLUSH_INTERVAL
|
|
35
33
|
})
|
|
36
|
-
|
|
37
|
-
logger = new NoopExternalLogger()
|
|
38
|
-
}
|
|
34
|
+
: new NoopExternalLogger()
|
|
39
35
|
|
|
40
36
|
interval = setInterval(() => {
|
|
41
37
|
metrics.flush()
|