dd-trace 5.80.0 → 5.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-3rdparty.csv +79 -88
- package/ext/tags.d.ts +1 -0
- package/ext/tags.js +1 -0
- package/index.d.ts +42 -35
- package/loader-hook.mjs +16 -4
- package/package.json +33 -56
- package/packages/datadog-core/src/utils/src/parse-tags.js +1 -1
- package/packages/datadog-esbuild/index.js +44 -26
- package/packages/datadog-esbuild/src/utils.js +14 -2
- package/packages/datadog-instrumentations/index.js +1 -0
- package/packages/datadog-instrumentations/src/aerospike.js +3 -2
- package/packages/datadog-instrumentations/src/ai.js +2 -2
- package/packages/datadog-instrumentations/src/amqp10.js +1 -1
- package/packages/datadog-instrumentations/src/amqplib.js +4 -4
- package/packages/datadog-instrumentations/src/anthropic.js +14 -2
- package/packages/datadog-instrumentations/src/apollo-server-core.js +2 -2
- package/packages/datadog-instrumentations/src/apollo-server.js +1 -1
- package/packages/datadog-instrumentations/src/apollo.js +3 -2
- package/packages/datadog-instrumentations/src/avsc.js +1 -1
- package/packages/datadog-instrumentations/src/aws-sdk.js +6 -2
- package/packages/datadog-instrumentations/src/azure-event-hubs.js +4 -3
- package/packages/datadog-instrumentations/src/azure-functions.js +2 -2
- package/packages/datadog-instrumentations/src/azure-service-bus.js +3 -4
- package/packages/datadog-instrumentations/src/bluebird.js +1 -1
- package/packages/datadog-instrumentations/src/bullmq.js +11 -0
- package/packages/datadog-instrumentations/src/bunyan.js +1 -1
- package/packages/datadog-instrumentations/src/cassandra-driver.js +1 -1
- package/packages/datadog-instrumentations/src/child_process.js +2 -2
- package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +3 -3
- package/packages/datadog-instrumentations/src/couchbase.js +1 -1
- package/packages/datadog-instrumentations/src/crypto.js +1 -1
- package/packages/datadog-instrumentations/src/cucumber.js +12 -13
- package/packages/datadog-instrumentations/src/cypress.js +1 -1
- package/packages/datadog-instrumentations/src/dns.js +1 -1
- package/packages/datadog-instrumentations/src/elasticsearch.js +1 -1
- package/packages/datadog-instrumentations/src/express-mongo-sanitize.js +1 -1
- package/packages/datadog-instrumentations/src/express.js +1 -1
- package/packages/datadog-instrumentations/src/find-my-way.js +6 -5
- package/packages/datadog-instrumentations/src/fs.js +1 -1
- package/packages/datadog-instrumentations/src/generic-pool.js +1 -1
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +137 -15
- package/packages/datadog-instrumentations/src/google-cloud-vertexai.js +2 -3
- package/packages/datadog-instrumentations/src/google-genai.js +120 -0
- package/packages/datadog-instrumentations/src/graphql.js +21 -1
- package/packages/datadog-instrumentations/src/grpc/client.js +1 -1
- package/packages/datadog-instrumentations/src/grpc/server.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/hook.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +5 -1
- package/packages/datadog-instrumentations/src/helpers/instrument.js +11 -1
- package/packages/datadog-instrumentations/src/helpers/register.js +12 -5
- package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +27 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +152 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/bullmq.json +106 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +6 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/langchain.js +237 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/loader.js +9 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/loader.mjs +11 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +139 -0
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/shared-utils.js +9 -0
- package/packages/datadog-instrumentations/src/hono.js +55 -10
- package/packages/datadog-instrumentations/src/ioredis.js +1 -1
- package/packages/datadog-instrumentations/src/iovalkey.js +1 -1
- package/packages/datadog-instrumentations/src/jest.js +2 -2
- package/packages/datadog-instrumentations/src/kafkajs.js +3 -3
- package/packages/datadog-instrumentations/src/knex.js +1 -1
- package/packages/datadog-instrumentations/src/langchain.js +3 -109
- package/packages/datadog-instrumentations/src/ldapjs.js +1 -1
- package/packages/datadog-instrumentations/src/light-my-request.js +93 -0
- package/packages/datadog-instrumentations/src/limitd-client.js +1 -1
- package/packages/datadog-instrumentations/src/lodash.js +1 -2
- package/packages/datadog-instrumentations/src/mariadb.js +1 -2
- package/packages/datadog-instrumentations/src/memcached.js +1 -1
- package/packages/datadog-instrumentations/src/mocha/main.js +1 -1
- package/packages/datadog-instrumentations/src/mongodb-core.js +1 -1
- package/packages/datadog-instrumentations/src/mongodb.js +1 -1
- package/packages/datadog-instrumentations/src/mongoose.js +1 -1
- package/packages/datadog-instrumentations/src/mquery.js +1 -1
- package/packages/datadog-instrumentations/src/mysql.js +1 -1
- package/packages/datadog-instrumentations/src/mysql2.js +2 -2
- package/packages/datadog-instrumentations/src/net.js +1 -1
- package/packages/datadog-instrumentations/src/next.js +1 -1
- package/packages/datadog-instrumentations/src/nyc.js +1 -1
- package/packages/datadog-instrumentations/src/openai.js +2 -2
- package/packages/datadog-instrumentations/src/opensearch.js +1 -1
- package/packages/datadog-instrumentations/src/oracledb.js +1 -1
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +1 -1
- package/packages/datadog-instrumentations/src/pg.js +3 -3
- package/packages/datadog-instrumentations/src/pino.js +1 -1
- package/packages/datadog-instrumentations/src/playwright.js +46 -17
- package/packages/datadog-instrumentations/src/prisma.js +52 -37
- package/packages/datadog-instrumentations/src/process.js +1 -1
- package/packages/datadog-instrumentations/src/promise-js.js +1 -1
- package/packages/datadog-instrumentations/src/promise.js +1 -1
- package/packages/datadog-instrumentations/src/protobufjs.js +1 -1
- package/packages/datadog-instrumentations/src/q.js +1 -1
- package/packages/datadog-instrumentations/src/redis.js +1 -1
- package/packages/datadog-instrumentations/src/rhea.js +1 -1
- package/packages/datadog-instrumentations/src/router.js +1 -1
- package/packages/datadog-instrumentations/src/selenium.js +4 -2
- package/packages/datadog-instrumentations/src/sequelize.js +1 -2
- package/packages/datadog-instrumentations/src/sharedb.js +1 -1
- package/packages/datadog-instrumentations/src/tedious.js +1 -1
- package/packages/datadog-instrumentations/src/undici.js +4 -4
- package/packages/datadog-instrumentations/src/url.js +1 -1
- package/packages/datadog-instrumentations/src/vitest.js +1 -1
- package/packages/datadog-instrumentations/src/vm.js +1 -1
- package/packages/datadog-instrumentations/src/when.js +1 -1
- package/packages/datadog-instrumentations/src/winston.js +1 -1
- package/packages/datadog-instrumentations/src/ws.js +38 -19
- package/packages/datadog-plugin-amqp10/src/index.js +1 -1
- package/packages/datadog-plugin-amqplib/src/index.js +1 -1
- package/packages/datadog-plugin-anthropic/src/index.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/index.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +4 -4
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +2 -2
- package/packages/datadog-plugin-aws-sdk/src/util.js +3 -3
- package/packages/datadog-plugin-azure-event-hubs/src/index.js +1 -1
- package/packages/datadog-plugin-azure-event-hubs/src/producer.js +19 -5
- package/packages/datadog-plugin-azure-service-bus/src/index.js +1 -1
- package/packages/datadog-plugin-azure-service-bus/src/producer.js +4 -0
- package/packages/datadog-plugin-bullmq/src/consumer.js +60 -0
- package/packages/datadog-plugin-bullmq/src/index.js +18 -0
- package/packages/datadog-plugin-bullmq/src/producer.js +178 -0
- package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +1 -1
- package/packages/datadog-plugin-confluentinc-kafka-javascript/src/index.js +1 -1
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +23 -2
- package/packages/datadog-plugin-cypress/src/plugin.js +2 -2
- package/packages/datadog-plugin-cypress/src/support.js +73 -31
- package/packages/datadog-plugin-express/src/index.js +1 -1
- package/packages/datadog-plugin-fastify/src/index.js +1 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +13 -3
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +171 -12
- package/packages/datadog-plugin-google-cloud-pubsub/src/index.js +1 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +160 -13
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +217 -0
- package/packages/datadog-plugin-google-cloud-vertexai/src/index.js +1 -1
- package/packages/datadog-plugin-google-genai/src/index.js +17 -0
- package/packages/datadog-plugin-google-genai/src/tracing.js +41 -0
- package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +5 -4
- package/packages/datadog-plugin-grpc/src/index.js +1 -1
- package/packages/datadog-plugin-http/src/client.js +2 -1
- package/packages/datadog-plugin-http/src/index.js +25 -5
- package/packages/datadog-plugin-http2/src/client.js +2 -2
- package/packages/datadog-plugin-http2/src/index.js +1 -1
- package/packages/datadog-plugin-jest/src/util.js +1 -1
- package/packages/datadog-plugin-kafkajs/src/index.js +1 -1
- package/packages/datadog-plugin-langchain/src/index.js +1 -1
- package/packages/datadog-plugin-langchain/src/tracing.js +7 -3
- package/packages/datadog-plugin-moleculer/src/index.js +1 -1
- package/packages/datadog-plugin-mongodb-core/src/index.js +6 -2
- package/packages/datadog-plugin-next/src/index.js +11 -3
- package/packages/datadog-plugin-openai/src/index.js +1 -1
- package/packages/datadog-plugin-openai/src/stream-helpers.js +30 -10
- package/packages/datadog-plugin-openai/src/tracing.js +2 -2
- package/packages/datadog-plugin-rhea/src/index.js +1 -1
- package/packages/datadog-plugin-ws/src/close.js +56 -3
- package/packages/datadog-plugin-ws/src/index.js +4 -0
- package/packages/datadog-plugin-ws/src/producer.js +39 -4
- package/packages/datadog-plugin-ws/src/receiver.js +39 -3
- package/packages/datadog-plugin-ws/src/server.js +13 -1
- package/packages/datadog-plugin-ws/src/util.js +107 -0
- package/packages/datadog-shimmer/src/shimmer.js +2 -2
- package/packages/dd-trace/src/aiguard/sdk.js +21 -13
- package/packages/dd-trace/src/appsec/api_security_sampler.js +1 -1
- package/packages/dd-trace/src/appsec/graphql.js +2 -2
- package/packages/dd-trace/src/appsec/iast/analyzers/code-injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/command-injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-base-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/ldap-injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +3 -3
- package/packages/dd-trace/src/appsec/iast/analyzers/path-traversal-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/ssrf-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/untrusted-deserialization-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/unvalidated-redirect-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-cipher-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-hash-analyzer.js +3 -2
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-randomness-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/iast-plugin.js +3 -3
- package/packages/dd-trace/src/appsec/iast/index.js +5 -5
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +1 -1
- package/packages/dd-trace/src/appsec/iast/security-controls/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +1 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/operations-taint-object.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-esm.mjs +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +11 -16
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +1 -1
- package/packages/dd-trace/src/appsec/iast/telemetry/namespaces.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +4 -4
- package/packages/dd-trace/src/appsec/index.js +8 -8
- package/packages/dd-trace/src/appsec/rasp/command_injection.js +1 -1
- package/packages/dd-trace/src/appsec/rasp/index.js +1 -1
- package/packages/dd-trace/src/appsec/rasp/lfi.js +1 -1
- package/packages/dd-trace/src/appsec/rc-products.js +10 -0
- package/packages/dd-trace/src/appsec/recommended.json +230 -3
- package/packages/dd-trace/src/appsec/remote_config.js +177 -0
- package/packages/dd-trace/src/appsec/reporter.js +3 -7
- package/packages/dd-trace/src/appsec/rule_manager.js +37 -20
- package/packages/dd-trace/src/appsec/sdk/index.js +1 -1
- package/packages/dd-trace/src/appsec/sdk/set_user.js +1 -1
- package/packages/dd-trace/src/appsec/sdk/track_event.js +2 -2
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +2 -2
- package/packages/dd-trace/src/appsec/user_tracking.js +2 -2
- package/packages/dd-trace/src/appsec/waf/index.js +17 -3
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +11 -0
- package/packages/dd-trace/src/azure_metadata.js +8 -2
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +8 -6
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/index.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +1 -1
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +1 -1
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +4 -2
- package/packages/dd-trace/src/config/remote_config.js +34 -0
- package/packages/dd-trace/src/config.js +109 -34
- package/packages/dd-trace/src/config_defaults.js +16 -3
- package/packages/dd-trace/src/constants.js +5 -0
- package/packages/dd-trace/src/crashtracking/crashtracker.js +10 -1
- package/packages/dd-trace/src/datastreams/checkpointer.js +2 -2
- package/packages/dd-trace/src/datastreams/encoding.js +23 -6
- package/packages/dd-trace/src/datastreams/index.js +1 -1
- package/packages/dd-trace/src/datastreams/pathway.js +41 -2
- package/packages/dd-trace/src/datastreams/processor.js +3 -3
- package/packages/dd-trace/src/datastreams/schemas/schema_builder.js +1 -1
- package/packages/dd-trace/src/datastreams/writer.js +2 -2
- package/packages/dd-trace/src/debugger/config.js +1 -0
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +15 -5
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/config.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/index.js +37 -17
- package/packages/dd-trace/src/debugger/devtools_client/inspector_promises_polyfill.js +2 -0
- package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +24 -18
- package/packages/dd-trace/src/debugger/devtools_client/send.js +21 -11
- package/packages/dd-trace/src/debugger/devtools_client/session.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +103 -15
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/constants.js +25 -0
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +56 -25
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +64 -23
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/symbols.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +404 -0
- package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/state.js +8 -3
- package/packages/dd-trace/src/debugger/devtools_client/status.js +3 -3
- package/packages/dd-trace/src/debugger/index.js +2 -2
- package/packages/dd-trace/src/dogstatsd.js +3 -2
- package/packages/dd-trace/src/encode/0.4.js +1 -1
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +2 -2
- package/packages/dd-trace/src/encode/coverage-ci-visibility.js +1 -1
- package/packages/dd-trace/src/encode/span-stats.js +13 -2
- package/packages/dd-trace/src/exporter.js +2 -2
- package/packages/dd-trace/src/exporters/agent/index.js +1 -1
- package/packages/dd-trace/src/exporters/common/agent-info-exporter.js +1 -1
- package/packages/dd-trace/src/exporters/common/request.js +2 -2
- package/packages/dd-trace/src/exporters/common/writer.js +1 -1
- package/packages/dd-trace/src/exporters/span-stats/index.js +1 -1
- package/packages/dd-trace/src/external-logger/src/index.js +1 -2
- package/packages/dd-trace/src/flare/index.js +1 -1
- package/packages/dd-trace/src/guardrails/index.js +6 -3
- package/packages/dd-trace/src/histogram.js +1 -1
- package/packages/dd-trace/src/id.js +60 -0
- package/packages/dd-trace/src/index.js +1 -1
- package/packages/dd-trace/src/lambda/handler.js +4 -4
- package/packages/dd-trace/src/lambda/index.js +1 -1
- package/packages/dd-trace/src/lambda/runtime/patch.js +4 -4
- package/packages/dd-trace/src/lambda/runtime/ritm.js +2 -2
- package/packages/dd-trace/src/llmobs/constants/tags.js +8 -1
- package/packages/dd-trace/src/llmobs/index.js +8 -9
- package/packages/dd-trace/src/llmobs/plugins/ai/index.js +38 -7
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +30 -9
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +3 -3
- package/packages/dd-trace/src/llmobs/plugins/genai/index.js +104 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +486 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chain.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/embedding.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/llm.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/vectorstore.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +2 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +16 -0
- package/packages/dd-trace/src/llmobs/plugins/{openai.js → openai/index.js} +63 -6
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +126 -0
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +1 -1
- package/packages/dd-trace/src/llmobs/sdk.js +20 -22
- package/packages/dd-trace/src/llmobs/span_processor.js +15 -14
- package/packages/dd-trace/src/llmobs/tagger.js +4 -0
- package/packages/dd-trace/src/llmobs/telemetry.js +3 -4
- package/packages/dd-trace/src/llmobs/writers/base.js +2 -2
- package/packages/dd-trace/src/llmobs/writers/spans.js +1 -2
- package/packages/dd-trace/src/log/index.js +1 -1
- package/packages/dd-trace/src/noop/proxy.js +2 -2
- package/packages/dd-trace/src/noop/span.js +1 -1
- package/packages/dd-trace/src/openfeature/index.js +2 -2
- package/packages/dd-trace/src/openfeature/noop.js +14 -14
- package/packages/dd-trace/src/openfeature/remote_config.js +31 -0
- package/packages/dd-trace/src/openfeature/writers/base.js +5 -5
- package/packages/dd-trace/src/openfeature/writers/exposures.js +9 -9
- package/packages/dd-trace/src/opentelemetry/context_manager.js +2 -2
- package/packages/dd-trace/src/opentelemetry/logs/index.js +2 -2
- package/packages/dd-trace/src/opentelemetry/logs/logger.js +3 -2
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +4 -4
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +5 -3
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +17 -16
- package/packages/dd-trace/src/opentelemetry/metrics/constants.js +34 -0
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +81 -0
- package/packages/dd-trace/src/opentelemetry/metrics/instruments.js +225 -0
- package/packages/dd-trace/src/opentelemetry/metrics/meter.js +171 -0
- package/packages/dd-trace/src/opentelemetry/metrics/meter_provider.js +54 -0
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +62 -0
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +251 -0
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +557 -0
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +10 -18
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +47 -32
- package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +1 -1
- package/packages/dd-trace/src/opentelemetry/span.js +3 -3
- package/packages/dd-trace/src/opentelemetry/tracer.js +4 -4
- package/packages/dd-trace/src/opentelemetry/tracer_provider.js +1 -1
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +24 -8
- package/packages/dd-trace/src/opentracing/span.js +3 -3
- package/packages/dd-trace/src/opentracing/tracer.js +5 -5
- package/packages/dd-trace/src/payload-tagging/index.js +8 -4
- package/packages/dd-trace/src/plugin_manager.js +5 -3
- package/packages/dd-trace/src/plugins/apollo.js +1 -1
- package/packages/dd-trace/src/plugins/ci_plugin.js +27 -27
- package/packages/dd-trace/src/plugins/database.js +1 -1
- package/packages/dd-trace/src/plugins/index.js +6 -1
- package/packages/dd-trace/src/plugins/log_plugin.js +1 -1
- package/packages/dd-trace/src/plugins/outbound.js +1 -1
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/ci.js +1 -1
- package/packages/dd-trace/src/plugins/util/git.js +8 -8
- package/packages/dd-trace/src/plugins/util/stacktrace.js +1 -1
- package/packages/dd-trace/src/plugins/util/test.js +27 -27
- package/packages/dd-trace/src/plugins/util/url.js +119 -1
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +1 -1
- package/packages/dd-trace/src/plugins/util/web.js +18 -46
- package/packages/dd-trace/src/priority_sampler.js +15 -16
- package/packages/dd-trace/src/process-tags/index.js +83 -0
- package/packages/dd-trace/src/profiling/config.js +33 -22
- package/packages/dd-trace/src/profiling/exporter_cli.js +4 -4
- package/packages/dd-trace/src/profiling/exporters/agent.js +5 -5
- package/packages/dd-trace/src/profiling/index.js +1 -1
- package/packages/dd-trace/src/profiling/libuv-size.js +1 -1
- package/packages/dd-trace/src/profiling/profiler.js +4 -5
- package/packages/dd-trace/src/profiling/profilers/event_plugins/event.js +1 -1
- package/packages/dd-trace/src/profiling/profilers/events.js +11 -2
- package/packages/dd-trace/src/profiling/profilers/wall.js +4 -4
- package/packages/dd-trace/src/proxy.js +17 -18
- package/packages/dd-trace/src/rate_limiter.js +1 -1
- package/packages/dd-trace/src/remote_config/index.js +541 -137
- package/packages/dd-trace/src/require-package-json.js +1 -1
- package/packages/dd-trace/src/ritm.js +50 -27
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +1 -1
- package/packages/dd-trace/src/serverless.js +16 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +8 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +4 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +8 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/web.js +4 -0
- package/packages/dd-trace/src/span_format.js +10 -5
- package/packages/dd-trace/src/span_processor.js +8 -3
- package/packages/dd-trace/src/span_stats.js +21 -8
- package/packages/dd-trace/src/spanleak.js +1 -1
- package/packages/dd-trace/src/standalone/index.js +1 -1
- package/packages/dd-trace/src/startup-log.js +3 -3
- package/packages/dd-trace/src/supported-configurations.json +16 -0
- package/packages/dd-trace/src/telemetry/dependencies.js +4 -4
- package/packages/dd-trace/src/telemetry/endpoints.js +8 -8
- package/packages/dd-trace/src/telemetry/logs/index.js +1 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +22 -8
- package/packages/dd-trace/src/tracer.js +3 -3
- package/packages/dd-trace/src/tracer_metadata.js +19 -15
- package/vendor/dist/@datadog/sketches-js/LICENSE +39 -0
- package/vendor/dist/@datadog/sketches-js/index.js +1 -0
- package/vendor/dist/@datadog/source-map/LICENSE +28 -0
- package/vendor/dist/@datadog/source-map/index.js +1 -0
- package/vendor/dist/@isaacs/ttlcache/LICENSE +55 -0
- package/vendor/dist/@isaacs/ttlcache/index.js +1 -0
- package/vendor/dist/@opentelemetry/core/LICENSE +201 -0
- package/vendor/dist/@opentelemetry/core/index.js +1 -0
- package/vendor/dist/@opentelemetry/resources/LICENSE +201 -0
- package/vendor/dist/@opentelemetry/resources/index.js +1 -0
- package/vendor/dist/astring/LICENSE +19 -0
- package/vendor/dist/astring/index.js +1 -0
- package/vendor/dist/crypto-randomuuid/index.js +1 -0
- package/vendor/dist/escape-string-regexp/LICENSE +9 -0
- package/vendor/dist/escape-string-regexp/index.js +1 -0
- package/vendor/dist/esquery/LICENSE +24 -0
- package/vendor/dist/esquery/index.js +1 -0
- package/vendor/dist/ignore/LICENSE +21 -0
- package/vendor/dist/ignore/index.js +1 -0
- package/vendor/dist/istanbul-lib-coverage/LICENSE +24 -0
- package/vendor/dist/istanbul-lib-coverage/index.js +1 -0
- package/vendor/dist/jest-docblock/LICENSE +21 -0
- package/vendor/dist/jest-docblock/index.js +1 -0
- package/vendor/dist/jsonpath-plus/LICENSE +22 -0
- package/vendor/dist/jsonpath-plus/index.js +1 -0
- package/vendor/dist/limiter/LICENSE +19 -0
- package/vendor/dist/limiter/index.js +1 -0
- package/vendor/dist/lodash.sortby/LICENSE +47 -0
- package/vendor/dist/lodash.sortby/index.js +1 -0
- package/vendor/dist/lru-cache/LICENSE +15 -0
- package/vendor/dist/lru-cache/index.js +1 -0
- package/vendor/dist/meriyah/LICENSE +7 -0
- package/vendor/dist/meriyah/index.js +1 -0
- package/vendor/dist/module-details-from-path/LICENSE +21 -0
- package/vendor/dist/module-details-from-path/index.js +1 -0
- package/vendor/dist/mutexify/promise/LICENSE +21 -0
- package/vendor/dist/mutexify/promise/index.js +1 -0
- package/vendor/dist/opentracing/LICENSE +201 -0
- package/vendor/dist/opentracing/binary_carrier.d.ts +11 -0
- package/vendor/dist/opentracing/constants.d.ts +61 -0
- package/vendor/dist/opentracing/examples/demo/demo.d.ts +2 -0
- package/vendor/dist/opentracing/ext/tags.d.ts +90 -0
- package/vendor/dist/opentracing/functions.d.ts +20 -0
- package/vendor/dist/opentracing/global_tracer.d.ts +14 -0
- package/vendor/dist/opentracing/index.d.ts +12 -0
- package/vendor/dist/opentracing/index.js +1 -0
- package/vendor/dist/opentracing/mock_tracer/index.d.ts +5 -0
- package/vendor/dist/opentracing/mock_tracer/mock_context.d.ts +13 -0
- package/vendor/dist/opentracing/mock_tracer/mock_report.d.ts +16 -0
- package/vendor/dist/opentracing/mock_tracer/mock_span.d.ts +50 -0
- package/vendor/dist/opentracing/mock_tracer/mock_tracer.d.ts +26 -0
- package/vendor/dist/opentracing/noop.d.ts +8 -0
- package/vendor/dist/opentracing/reference.d.ts +33 -0
- package/vendor/dist/opentracing/span.d.ts +147 -0
- package/vendor/dist/opentracing/span_context.d.ts +26 -0
- package/vendor/dist/opentracing/test/api_compatibility.d.ts +16 -0
- package/vendor/dist/opentracing/test/mocktracer_implemenation.d.ts +3 -0
- package/vendor/dist/opentracing/test/noop_implementation.d.ts +4 -0
- package/vendor/dist/opentracing/test/opentracing_api.d.ts +3 -0
- package/vendor/dist/opentracing/test/unittest.d.ts +2 -0
- package/vendor/dist/opentracing/tracer.d.ts +127 -0
- package/vendor/dist/path-to-regexp/LICENSE +21 -0
- package/vendor/dist/path-to-regexp/index.js +1 -0
- package/vendor/dist/pprof-format/LICENSE +8 -0
- package/vendor/dist/pprof-format/index.js +1 -0
- package/vendor/dist/protobufjs/LICENSE +39 -0
- package/vendor/dist/protobufjs/index.js +1 -0
- package/vendor/dist/protobufjs/minimal/LICENSE +39 -0
- package/vendor/dist/protobufjs/minimal/index.js +1 -0
- package/vendor/dist/retry/LICENSE +21 -0
- package/vendor/dist/retry/index.js +1 -0
- package/vendor/dist/rfdc/LICENSE +15 -0
- package/vendor/dist/rfdc/index.js +1 -0
- package/vendor/dist/semifies/LICENSE +201 -0
- package/vendor/dist/semifies/index.js +1 -0
- package/vendor/dist/shell-quote/LICENSE +24 -0
- package/vendor/dist/shell-quote/index.js +1 -0
- package/vendor/dist/source-map/LICENSE +28 -0
- package/vendor/dist/source-map/index.js +1 -0
- package/vendor/dist/source-map/lib/util/LICENSE +28 -0
- package/vendor/dist/source-map/lib/util/index.js +1 -0
- package/vendor/dist/source-map/mappings.wasm +0 -0
- package/vendor/dist/tlhunter-sorted-set/LICENSE +21 -0
- package/vendor/dist/tlhunter-sorted-set/index.js +1 -0
- package/vendor/dist/ttl-set/LICENSE +21 -0
- package/vendor/dist/ttl-set/index.js +1 -0
- package/packages/dd-trace/src/remote_config/manager.js +0 -368
|
@@ -2,25 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs')
|
|
4
4
|
const os = require('os')
|
|
5
|
-
const uuid = require('crypto-randomuuid') // we need to keep the old uuid dep because of cypress
|
|
6
5
|
const { URL } = require('url')
|
|
6
|
+
const path = require('path')
|
|
7
|
+
const uuid = require('../../../vendor/dist/crypto-randomuuid') // we need to keep the old uuid dep because of cypress
|
|
7
8
|
|
|
9
|
+
const set = require('../../datadog-core/src/utils/src/set')
|
|
10
|
+
const { DD_MAJOR } = require('../../../version')
|
|
8
11
|
const log = require('./log')
|
|
9
12
|
const tagger = require('./tagger')
|
|
10
|
-
const set = require('../../datadog-core/src/utils/src/set')
|
|
11
13
|
const { isTrue, isFalse, normalizeProfilingEnabledValue } = require('./util')
|
|
12
14
|
const { GIT_REPOSITORY_URL, GIT_COMMIT_SHA } = require('./plugins/util/tags')
|
|
13
15
|
const { getGitMetadataFromGitProperties, removeUserSensitiveInfo, getRemoteOriginURL, resolveGitHeadSHA } =
|
|
14
16
|
require('./git_properties')
|
|
15
17
|
const { updateConfig } = require('./telemetry')
|
|
16
18
|
const telemetryMetrics = require('./telemetry/metrics')
|
|
17
|
-
const {
|
|
19
|
+
const {
|
|
20
|
+
isInServerlessEnvironment,
|
|
21
|
+
getIsGCPFunction,
|
|
22
|
+
getIsAzureFunction,
|
|
23
|
+
enableGCPPubSubPushSubscription
|
|
24
|
+
} = require('./serverless')
|
|
18
25
|
const { ORIGIN_KEY } = require('./constants')
|
|
19
26
|
const { appendRules } = require('./payload-tagging/config')
|
|
20
27
|
const { getEnvironmentVariable: getEnv, getEnvironmentVariables } = require('./config-helper')
|
|
21
28
|
const defaults = require('./config_defaults')
|
|
22
|
-
const path = require('path')
|
|
23
|
-
const { DD_MAJOR } = require('../../../version')
|
|
24
29
|
|
|
25
30
|
const tracerMetrics = telemetryMetrics.manager.namespace('tracers')
|
|
26
31
|
|
|
@@ -182,7 +187,7 @@ function validateNamingVersion (versionString) {
|
|
|
182
187
|
* @param {string | string[]} input
|
|
183
188
|
*/
|
|
184
189
|
function splitJSONPathRules (input) {
|
|
185
|
-
if (!input) return
|
|
190
|
+
if (!input || input === '$') return
|
|
186
191
|
if (Array.isArray(input)) return input
|
|
187
192
|
if (input === 'all') return []
|
|
188
193
|
return input.split(',')
|
|
@@ -276,8 +281,6 @@ class Config {
|
|
|
276
281
|
this.stableConfig = new StableConfig()
|
|
277
282
|
}
|
|
278
283
|
|
|
279
|
-
const envs = getEnvironmentVariables()
|
|
280
|
-
|
|
281
284
|
options = {
|
|
282
285
|
...options,
|
|
283
286
|
appsec: options.appsec == null ? options.experimental?.appsec : options.appsec,
|
|
@@ -321,7 +324,7 @@ class Config {
|
|
|
321
324
|
this.#defaults = defaults
|
|
322
325
|
this.#applyDefaults()
|
|
323
326
|
this.#applyStableConfig(this.stableConfig?.localEntries ?? {}, this.#localStableConfig)
|
|
324
|
-
this.#applyEnvironment(
|
|
327
|
+
this.#applyEnvironment()
|
|
325
328
|
this.#applyStableConfig(this.stableConfig?.fleetEntries ?? {}, this.#fleetStableConfig)
|
|
326
329
|
this.#applyOptions(options)
|
|
327
330
|
this.#applyCalculated()
|
|
@@ -342,7 +345,7 @@ class Config {
|
|
|
342
345
|
}
|
|
343
346
|
|
|
344
347
|
if (this.gitMetadataEnabled) {
|
|
345
|
-
this.#loadGitMetadata(
|
|
348
|
+
this.#loadGitMetadata()
|
|
346
349
|
}
|
|
347
350
|
}
|
|
348
351
|
|
|
@@ -446,6 +449,7 @@ class Config {
|
|
|
446
449
|
DD_DBM_PROPAGATION_MODE,
|
|
447
450
|
DD_DOGSTATSD_HOST,
|
|
448
451
|
DD_DOGSTATSD_PORT,
|
|
452
|
+
DD_DYNAMIC_INSTRUMENTATION_CAPTURE_TIMEOUT_MS,
|
|
449
453
|
DD_DYNAMIC_INSTRUMENTATION_ENABLED,
|
|
450
454
|
DD_DYNAMIC_INSTRUMENTATION_PROBE_FILE,
|
|
451
455
|
DD_DYNAMIC_INSTRUMENTATION_REDACTED_IDENTIFIERS,
|
|
@@ -453,6 +457,7 @@ class Config {
|
|
|
453
457
|
DD_DYNAMIC_INSTRUMENTATION_UPLOAD_INTERVAL_SECONDS,
|
|
454
458
|
DD_ENV,
|
|
455
459
|
DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED,
|
|
460
|
+
DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED,
|
|
456
461
|
DD_PROFILING_ENABLED,
|
|
457
462
|
DD_GRPC_CLIENT_ERROR_STATUSES,
|
|
458
463
|
DD_GRPC_SERVER_ERROR_STATUSES,
|
|
@@ -477,6 +482,7 @@ class Config {
|
|
|
477
482
|
DD_INSTRUMENTATION_CONFIG_ID,
|
|
478
483
|
DD_LOGS_INJECTION,
|
|
479
484
|
DD_LOGS_OTEL_ENABLED,
|
|
485
|
+
DD_METRICS_OTEL_ENABLED,
|
|
480
486
|
DD_LANGCHAIN_SPAN_CHAR_LIMIT,
|
|
481
487
|
DD_LANGCHAIN_SPAN_PROMPT_COMPLETION_SAMPLE_RATE,
|
|
482
488
|
DD_LLMOBS_AGENTLESS_ENABLED,
|
|
@@ -543,6 +549,7 @@ class Config {
|
|
|
543
549
|
DD_TRACE_RATE_LIMIT,
|
|
544
550
|
DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED,
|
|
545
551
|
DD_TRACE_REPORT_HOSTNAME,
|
|
552
|
+
DD_TRACE_RESOURCE_RENAMING_ENABLED,
|
|
546
553
|
DD_TRACE_SAMPLE_RATE,
|
|
547
554
|
DD_TRACE_SAMPLING_RULES,
|
|
548
555
|
DD_TRACE_SCOPE,
|
|
@@ -571,12 +578,20 @@ class Config {
|
|
|
571
578
|
OTEL_EXPORTER_OTLP_LOGS_HEADERS,
|
|
572
579
|
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL,
|
|
573
580
|
OTEL_EXPORTER_OTLP_LOGS_TIMEOUT,
|
|
581
|
+
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT,
|
|
582
|
+
OTEL_EXPORTER_OTLP_METRICS_HEADERS,
|
|
583
|
+
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL,
|
|
584
|
+
OTEL_EXPORTER_OTLP_METRICS_TIMEOUT,
|
|
585
|
+
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE,
|
|
586
|
+
OTEL_METRIC_EXPORT_TIMEOUT,
|
|
574
587
|
OTEL_EXPORTER_OTLP_PROTOCOL,
|
|
575
588
|
OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
576
589
|
OTEL_EXPORTER_OTLP_HEADERS,
|
|
577
590
|
OTEL_EXPORTER_OTLP_TIMEOUT,
|
|
578
591
|
OTEL_BSP_SCHEDULE_DELAY,
|
|
579
|
-
OTEL_BSP_MAX_EXPORT_BATCH_SIZE
|
|
592
|
+
OTEL_BSP_MAX_EXPORT_BATCH_SIZE,
|
|
593
|
+
OTEL_BSP_MAX_QUEUE_SIZE,
|
|
594
|
+
OTEL_METRIC_EXPORT_INTERVAL
|
|
580
595
|
} = source
|
|
581
596
|
|
|
582
597
|
const tags = {}
|
|
@@ -603,16 +618,51 @@ class Config {
|
|
|
603
618
|
this.#setString(target, 'otelLogsHeaders', OTEL_EXPORTER_OTLP_LOGS_HEADERS || target.otelHeaders)
|
|
604
619
|
this.#setString(target, 'otelProtocol', OTEL_EXPORTER_OTLP_PROTOCOL)
|
|
605
620
|
this.#setString(target, 'otelLogsProtocol', OTEL_EXPORTER_OTLP_LOGS_PROTOCOL || target.otelProtocol)
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
621
|
+
const otelTimeout = nonNegInt(OTEL_EXPORTER_OTLP_TIMEOUT, 'OTEL_EXPORTER_OTLP_TIMEOUT')
|
|
622
|
+
if (otelTimeout !== undefined) {
|
|
623
|
+
target.otelTimeout = otelTimeout
|
|
624
|
+
}
|
|
625
|
+
const otelLogsTimeout = nonNegInt(OTEL_EXPORTER_OTLP_LOGS_TIMEOUT, 'OTEL_EXPORTER_OTLP_LOGS_TIMEOUT')
|
|
626
|
+
target.otelLogsTimeout = otelLogsTimeout === undefined ? target.otelTimeout : otelLogsTimeout
|
|
627
|
+
const otelBatchTimeout = nonNegInt(OTEL_BSP_SCHEDULE_DELAY, 'OTEL_BSP_SCHEDULE_DELAY', false)
|
|
628
|
+
if (otelBatchTimeout !== undefined) {
|
|
629
|
+
target.otelBatchTimeout = otelBatchTimeout
|
|
630
|
+
}
|
|
631
|
+
target.otelMaxExportBatchSize = nonNegInt(OTEL_BSP_MAX_EXPORT_BATCH_SIZE, 'OTEL_BSP_MAX_EXPORT_BATCH_SIZE', false)
|
|
632
|
+
target.otelMaxQueueSize = nonNegInt(OTEL_BSP_MAX_QUEUE_SIZE, 'OTEL_BSP_MAX_QUEUE_SIZE', false)
|
|
633
|
+
|
|
634
|
+
const otelMetricsExporterEnabled = OTEL_METRICS_EXPORTER?.toLowerCase() !== 'none'
|
|
635
|
+
this.#setBoolean(
|
|
636
|
+
target,
|
|
637
|
+
'otelMetricsEnabled',
|
|
638
|
+
DD_METRICS_OTEL_ENABLED && isTrue(DD_METRICS_OTEL_ENABLED) && otelMetricsExporterEnabled
|
|
639
|
+
)
|
|
640
|
+
// Set OpenTelemetry metrics configuration with specific _METRICS_ vars
|
|
641
|
+
// taking precedence over generic _EXPORTERS_ vars
|
|
642
|
+
if (OTEL_EXPORTER_OTLP_ENDPOINT || OTEL_EXPORTER_OTLP_METRICS_ENDPOINT) {
|
|
643
|
+
this.#setString(target, 'otelMetricsUrl', OTEL_EXPORTER_OTLP_METRICS_ENDPOINT || target.otelUrl)
|
|
644
|
+
}
|
|
645
|
+
this.#setString(target, 'otelMetricsHeaders', OTEL_EXPORTER_OTLP_METRICS_HEADERS || target.otelHeaders)
|
|
646
|
+
this.#setString(target, 'otelMetricsProtocol', OTEL_EXPORTER_OTLP_METRICS_PROTOCOL || target.otelProtocol)
|
|
647
|
+
const otelMetricsTimeout = nonNegInt(OTEL_EXPORTER_OTLP_METRICS_TIMEOUT, 'OTEL_EXPORTER_OTLP_METRICS_TIMEOUT')
|
|
648
|
+
target.otelMetricsTimeout = otelMetricsTimeout === undefined ? target.otelTimeout : otelMetricsTimeout
|
|
649
|
+
target.otelMetricsExportTimeout = nonNegInt(OTEL_METRIC_EXPORT_TIMEOUT, 'OTEL_METRIC_EXPORT_TIMEOUT')
|
|
650
|
+
target.otelMetricsExportInterval = nonNegInt(OTEL_METRIC_EXPORT_INTERVAL, 'OTEL_METRIC_EXPORT_INTERVAL', false)
|
|
651
|
+
|
|
652
|
+
// Parse temporality preference (default to DELTA for Datadog)
|
|
653
|
+
if (OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE) {
|
|
654
|
+
const temporalityPref = OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.toUpperCase()
|
|
655
|
+
if (['DELTA', 'CUMULATIVE', 'LOWMEMORY'].includes(temporalityPref)) {
|
|
656
|
+
this.#setString(target, 'otelMetricsTemporalityPreference', temporalityPref)
|
|
657
|
+
}
|
|
658
|
+
}
|
|
610
659
|
this.#setBoolean(
|
|
611
660
|
target,
|
|
612
661
|
'apmTracingEnabled',
|
|
613
662
|
DD_APM_TRACING_ENABLED ??
|
|
614
663
|
(DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED && isFalse(DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED))
|
|
615
664
|
)
|
|
665
|
+
this.#setBoolean(target, 'propagateProcessTags.enabled', DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED)
|
|
616
666
|
this.#setString(target, 'appKey', DD_APP_KEY)
|
|
617
667
|
this.#setBoolean(target, 'appsec.apiSecurity.enabled', DD_API_SECURITY_ENABLED && isTrue(DD_API_SECURITY_ENABLED))
|
|
618
668
|
target['appsec.apiSecurity.sampleDelay'] = maybeFloat(DD_API_SECURITY_SAMPLE_DELAY)
|
|
@@ -684,6 +734,8 @@ class Config {
|
|
|
684
734
|
this.#setString(target, 'dogstatsd.hostname', DD_DOGSTATSD_HOST)
|
|
685
735
|
this.#setString(target, 'dogstatsd.port', DD_DOGSTATSD_PORT)
|
|
686
736
|
this.#setBoolean(target, 'dsmEnabled', DD_DATA_STREAMS_ENABLED)
|
|
737
|
+
target['dynamicInstrumentation.captureTimeoutMs'] = maybeInt(DD_DYNAMIC_INSTRUMENTATION_CAPTURE_TIMEOUT_MS)
|
|
738
|
+
unprocessedTarget['dynamicInstrumentation.captureTimeoutMs'] = DD_DYNAMIC_INSTRUMENTATION_CAPTURE_TIMEOUT_MS
|
|
687
739
|
this.#setBoolean(target, 'dynamicInstrumentation.enabled', DD_DYNAMIC_INSTRUMENTATION_ENABLED)
|
|
688
740
|
this.#setString(target, 'dynamicInstrumentation.probeFile', DD_DYNAMIC_INSTRUMENTATION_PROBE_FILE)
|
|
689
741
|
this.#setArray(target, 'dynamicInstrumentation.redactedIdentifiers',
|
|
@@ -752,6 +804,7 @@ class Config {
|
|
|
752
804
|
this.#setBoolean(target, 'injectForce', DD_INJECT_FORCE)
|
|
753
805
|
this.#setBoolean(target, 'isAzureFunction', getIsAzureFunction())
|
|
754
806
|
this.#setBoolean(target, 'isGCPFunction', getIsGCPFunction())
|
|
807
|
+
this.#setBoolean(target, 'gcpPubSubPushSubscriptionEnabled', enableGCPPubSubPushSubscription())
|
|
755
808
|
target['langchain.spanCharLimit'] = maybeInt(DD_LANGCHAIN_SPAN_CHAR_LIMIT)
|
|
756
809
|
target['langchain.spanPromptCompletionSampleRate'] = maybeFloat(DD_LANGCHAIN_SPAN_PROMPT_COMPLETION_SAMPLE_RATE)
|
|
757
810
|
this.#setBoolean(target, 'legacyBaggageEnabled', DD_TRACE_LEGACY_BAGGAGE_ENABLED)
|
|
@@ -787,6 +840,9 @@ class Config {
|
|
|
787
840
|
target['remoteConfig.pollInterval'] = maybeFloat(DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS)
|
|
788
841
|
unprocessedTarget['remoteConfig.pollInterval'] = DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS
|
|
789
842
|
this.#setBoolean(target, 'reportHostname', DD_TRACE_REPORT_HOSTNAME)
|
|
843
|
+
if (DD_TRACE_RESOURCE_RENAMING_ENABLED !== undefined) {
|
|
844
|
+
this.#setBoolean(target, 'resourceRenamingEnabled', DD_TRACE_RESOURCE_RENAMING_ENABLED)
|
|
845
|
+
}
|
|
790
846
|
// only used to explicitly set runtimeMetrics to false
|
|
791
847
|
const otelSetRuntimeMetrics = String(OTEL_METRICS_EXPORTER).toLowerCase() === 'none'
|
|
792
848
|
? false
|
|
@@ -984,6 +1040,8 @@ class Config {
|
|
|
984
1040
|
this.#setString(opts, 'dogstatsd.port', options.dogstatsd.port)
|
|
985
1041
|
}
|
|
986
1042
|
this.#setBoolean(opts, 'dsmEnabled', options.dsmEnabled)
|
|
1043
|
+
opts['dynamicInstrumentation.captureTimeoutMs'] = maybeInt(options.dynamicInstrumentation?.captureTimeoutMs)
|
|
1044
|
+
this.#optsUnprocessed['dynamicInstrumentation.captureTimeoutMs'] = options.dynamicInstrumentation?.captureTimeoutMs
|
|
987
1045
|
this.#setBoolean(opts, 'dynamicInstrumentation.enabled', options.dynamicInstrumentation?.enabled)
|
|
988
1046
|
this.#setString(opts, 'dynamicInstrumentation.probeFile', options.dynamicInstrumentation?.probeFile)
|
|
989
1047
|
this.#setArray(
|
|
@@ -1098,9 +1156,8 @@ class Config {
|
|
|
1098
1156
|
// This is reliant on environment config being set before options.
|
|
1099
1157
|
// This is to make sure the origins of each value are tracked appropriately for telemetry.
|
|
1100
1158
|
// We'll only set `llmobs.enabled` on the opts when it's not set on the environment, and options.llmobs is provided.
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
this.#setBoolean(opts, 'llmobs.enabled', !!options.llmobs)
|
|
1159
|
+
if (this.#env['llmobs.enabled'] == null && options.llmobs) {
|
|
1160
|
+
this.#setBoolean(opts, 'llmobs.enabled', true)
|
|
1104
1161
|
}
|
|
1105
1162
|
}
|
|
1106
1163
|
|
|
@@ -1201,14 +1258,24 @@ class Config {
|
|
|
1201
1258
|
|
|
1202
1259
|
calc['dogstatsd.hostname'] = this.#getHostname()
|
|
1203
1260
|
|
|
1204
|
-
// Compute OTLP logs
|
|
1261
|
+
// Compute OTLP logs and metrics URLs to send payloads to the active Datadog Agent
|
|
1205
1262
|
const agentHostname = this.#getHostname()
|
|
1206
1263
|
calc.otelLogsUrl = `http://${agentHostname}:${DEFAULT_OTLP_PORT}`
|
|
1264
|
+
calc.otelMetricsUrl = `http://${agentHostname}:${DEFAULT_OTLP_PORT}/v1/metrics`
|
|
1207
1265
|
calc.otelUrl = `http://${agentHostname}:${DEFAULT_OTLP_PORT}`
|
|
1208
1266
|
|
|
1209
1267
|
this.#setBoolean(calc, 'isGitUploadEnabled',
|
|
1210
1268
|
calc.isIntelligentTestRunnerEnabled && !isFalse(getEnv('DD_CIVISIBILITY_GIT_UPLOAD_ENABLED')))
|
|
1211
1269
|
|
|
1270
|
+
// Enable resourceRenamingEnabled when appsec is enabled and only
|
|
1271
|
+
// if DD_TRACE_RESOURCE_RENAMING_ENABLED is not explicitly set
|
|
1272
|
+
if (this.#env.resourceRenamingEnabled === undefined) {
|
|
1273
|
+
const appsecEnabled = this.#options['appsec.enabled'] ?? this.#env['appsec.enabled']
|
|
1274
|
+
if (appsecEnabled) {
|
|
1275
|
+
this.#setBoolean(calc, 'resourceRenamingEnabled', true)
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1212
1279
|
this.#setBoolean(calc, 'spanComputePeerService', this.#getSpanComputePeerService())
|
|
1213
1280
|
this.#setBoolean(calc, 'stats.enabled', this.#isTraceStatsComputationEnabled())
|
|
1214
1281
|
const defaultPropagationStyle = this.#getDefaultPropagationStyle(this.#optionsArg)
|
|
@@ -1409,26 +1476,24 @@ class Config {
|
|
|
1409
1476
|
}
|
|
1410
1477
|
}
|
|
1411
1478
|
|
|
1412
|
-
#loadGitMetadata (
|
|
1479
|
+
#loadGitMetadata () {
|
|
1413
1480
|
// try to read Git metadata from the environment variables
|
|
1414
1481
|
this.repositoryUrl = removeUserSensitiveInfo(
|
|
1415
|
-
|
|
1416
|
-
this.tags[GIT_REPOSITORY_URL]
|
|
1482
|
+
getEnv('DD_GIT_REPOSITORY_URL') ?? this.tags[GIT_REPOSITORY_URL]
|
|
1417
1483
|
)
|
|
1418
|
-
this.commitSHA =
|
|
1419
|
-
this.tags[GIT_COMMIT_SHA]
|
|
1484
|
+
this.commitSHA = getEnv('DD_GIT_COMMIT_SHA') ?? this.tags[GIT_COMMIT_SHA]
|
|
1420
1485
|
|
|
1421
1486
|
// otherwise, try to read Git metadata from the git.properties file
|
|
1422
1487
|
if (!this.repositoryUrl || !this.commitSHA) {
|
|
1423
|
-
const DD_GIT_PROPERTIES_FILE =
|
|
1424
|
-
|
|
1488
|
+
const DD_GIT_PROPERTIES_FILE = getEnv('DD_GIT_PROPERTIES_FILE')
|
|
1489
|
+
const gitPropertiesFile = DD_GIT_PROPERTIES_FILE ?? `${process.cwd()}/git.properties`
|
|
1425
1490
|
let gitPropertiesString
|
|
1426
1491
|
try {
|
|
1427
|
-
gitPropertiesString = fs.readFileSync(
|
|
1492
|
+
gitPropertiesString = fs.readFileSync(gitPropertiesFile, 'utf8')
|
|
1428
1493
|
} catch (e) {
|
|
1429
1494
|
// Only log error if the user has set a git.properties path
|
|
1430
|
-
if (
|
|
1431
|
-
log.error('Error reading DD_GIT_PROPERTIES_FILE: %s',
|
|
1495
|
+
if (DD_GIT_PROPERTIES_FILE) {
|
|
1496
|
+
log.error('Error reading DD_GIT_PROPERTIES_FILE: %s', gitPropertiesFile, e)
|
|
1432
1497
|
}
|
|
1433
1498
|
}
|
|
1434
1499
|
if (gitPropertiesString) {
|
|
@@ -1439,11 +1504,11 @@ class Config {
|
|
|
1439
1504
|
}
|
|
1440
1505
|
// otherwise, try to read Git metadata from the .git/ folder
|
|
1441
1506
|
if (!this.repositoryUrl || !this.commitSHA) {
|
|
1442
|
-
const DD_GIT_FOLDER_PATH =
|
|
1443
|
-
|
|
1507
|
+
const DD_GIT_FOLDER_PATH = getEnv('DD_GIT_FOLDER_PATH')
|
|
1508
|
+
const gitFolderPath = DD_GIT_FOLDER_PATH ?? path.join(process.cwd(), '.git')
|
|
1444
1509
|
if (!this.repositoryUrl) {
|
|
1445
1510
|
// try to read git config (repository URL)
|
|
1446
|
-
const gitConfigPath = path.join(
|
|
1511
|
+
const gitConfigPath = path.join(gitFolderPath, 'config')
|
|
1447
1512
|
try {
|
|
1448
1513
|
const gitConfigContent = fs.readFileSync(gitConfigPath, 'utf8')
|
|
1449
1514
|
if (gitConfigContent) {
|
|
@@ -1451,14 +1516,14 @@ class Config {
|
|
|
1451
1516
|
}
|
|
1452
1517
|
} catch (e) {
|
|
1453
1518
|
// Only log error if the user has set a .git/ path
|
|
1454
|
-
if (
|
|
1519
|
+
if (DD_GIT_FOLDER_PATH) {
|
|
1455
1520
|
log.error('Error reading git config: %s', gitConfigPath, e)
|
|
1456
1521
|
}
|
|
1457
1522
|
}
|
|
1458
1523
|
}
|
|
1459
1524
|
if (!this.commitSHA) {
|
|
1460
1525
|
// try to read git HEAD (commit SHA)
|
|
1461
|
-
const gitHeadSha = resolveGitHeadSHA(
|
|
1526
|
+
const gitHeadSha = resolveGitHeadSHA(gitFolderPath)
|
|
1462
1527
|
if (gitHeadSha) {
|
|
1463
1528
|
this.commitSHA = gitHeadSha
|
|
1464
1529
|
}
|
|
@@ -1492,6 +1557,16 @@ function maybeFloat (number) {
|
|
|
1492
1557
|
return Number.isNaN(parsed) ? undefined : parsed
|
|
1493
1558
|
}
|
|
1494
1559
|
|
|
1560
|
+
function nonNegInt (value, envVarName, allowZero = true) {
|
|
1561
|
+
if (value === undefined) return
|
|
1562
|
+
const parsed = Number.parseInt(value)
|
|
1563
|
+
if (Number.isNaN(parsed) || parsed < 0 || (parsed === 0 && !allowZero)) {
|
|
1564
|
+
log.warn(`Invalid value ${parsed} for ${envVarName}. Using default value.`)
|
|
1565
|
+
return
|
|
1566
|
+
}
|
|
1567
|
+
return parsed
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1495
1570
|
function getAgentUrl (url, options) {
|
|
1496
1571
|
if (url) return new URL(url)
|
|
1497
1572
|
|
|
@@ -63,6 +63,7 @@ module.exports = {
|
|
|
63
63
|
'dogstatsd.hostname': '127.0.0.1',
|
|
64
64
|
'dogstatsd.port': '8125',
|
|
65
65
|
dsmEnabled: false,
|
|
66
|
+
'dynamicInstrumentation.captureTimeoutMs': 15,
|
|
66
67
|
'dynamicInstrumentation.enabled': false,
|
|
67
68
|
'dynamicInstrumentation.probeFile': undefined,
|
|
68
69
|
'dynamicInstrumentation.redactedIdentifiers': [],
|
|
@@ -113,6 +114,7 @@ module.exports = {
|
|
|
113
114
|
isFlakyTestRetriesEnabled: false,
|
|
114
115
|
flakyTestRetriesCount: 5,
|
|
115
116
|
isGCPFunction: false,
|
|
117
|
+
isGCPPubSubPushSubscriptionEnabled: true,
|
|
116
118
|
isGitUploadEnabled: false,
|
|
117
119
|
isIntelligentTestRunnerEnabled: false,
|
|
118
120
|
isManualApiEnabled: false,
|
|
@@ -139,8 +141,17 @@ module.exports = {
|
|
|
139
141
|
otelLogsProtocol: 'http/protobuf',
|
|
140
142
|
otelLogsTimeout: 10_000,
|
|
141
143
|
otelTimeout: 10_000,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
otelBatchTimeout: 5000,
|
|
145
|
+
otelMaxExportBatchSize: 512,
|
|
146
|
+
otelMaxQueueSize: 2048,
|
|
147
|
+
otelMetricsEnabled: false,
|
|
148
|
+
otelMetricsUrl: undefined, // Will be computed using agent host
|
|
149
|
+
otelMetricsHeaders: '',
|
|
150
|
+
otelMetricsProtocol: 'http/protobuf',
|
|
151
|
+
otelMetricsTimeout: 10_000,
|
|
152
|
+
otelMetricsExportTimeout: 7500,
|
|
153
|
+
otelMetricsExportInterval: 10_000,
|
|
154
|
+
otelMetricsTemporalityPreference: 'DELTA', // DELTA, CUMULATIVE, or LOWMEMORY
|
|
144
155
|
lookup: undefined,
|
|
145
156
|
inferredProxyServicesEnabled: false,
|
|
146
157
|
memcachedCommandEnabled: false,
|
|
@@ -151,6 +162,7 @@ module.exports = {
|
|
|
151
162
|
plugins: true,
|
|
152
163
|
port: '8126',
|
|
153
164
|
'profiling.enabled': undefined,
|
|
165
|
+
'propagateProcessTags.enabled': undefined,
|
|
154
166
|
'profiling.exporters': 'agent',
|
|
155
167
|
'profiling.sourceMap': true,
|
|
156
168
|
'profiling.longLivedThreshold': undefined,
|
|
@@ -159,6 +171,7 @@ module.exports = {
|
|
|
159
171
|
'remoteConfig.enabled': true,
|
|
160
172
|
'remoteConfig.pollInterval': 5, // seconds
|
|
161
173
|
reportHostname: false,
|
|
174
|
+
resourceRenamingEnabled: false,
|
|
162
175
|
'runtimeMetrics.enabled': false,
|
|
163
176
|
'runtimeMetrics.eventLoop': true,
|
|
164
177
|
'runtimeMetrics.gc': true,
|
|
@@ -193,7 +206,7 @@ module.exports = {
|
|
|
193
206
|
'tracePropagationStyle.inject': ['datadog', 'tracecontext', 'baggage'],
|
|
194
207
|
'tracePropagationStyle.extract': ['datadog', 'tracecontext', 'baggage'],
|
|
195
208
|
'tracePropagationStyle.otelPropagators': false,
|
|
196
|
-
traceWebsocketMessagesEnabled:
|
|
209
|
+
traceWebsocketMessagesEnabled: true,
|
|
197
210
|
traceWebsocketMessagesInheritSampling: true,
|
|
198
211
|
traceWebsocketMessagesSeparateTraces: true,
|
|
199
212
|
tracing: true,
|
|
@@ -50,8 +50,13 @@ module.exports = {
|
|
|
50
50
|
GRPC_SERVER_ERROR_STATUSES: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
|
|
51
51
|
DYNAMODB_PTR_KIND: 'aws.dynamodb.item',
|
|
52
52
|
S3_PTR_KIND: 'aws.s3.object',
|
|
53
|
+
WEBSOCKET_PTR_KIND: 'websocket',
|
|
53
54
|
SPAN_POINTER_DIRECTION: Object.freeze({
|
|
54
55
|
UPSTREAM: 'u',
|
|
55
56
|
DOWNSTREAM: 'd'
|
|
57
|
+
}),
|
|
58
|
+
SPAN_POINTER_DIRECTION_NAME: Object.freeze({
|
|
59
|
+
UPSTREAM: 'span-pointer-up',
|
|
60
|
+
DOWNSTREAM: 'span-pointer-down'
|
|
56
61
|
})
|
|
57
62
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { URL } = require('url')
|
|
4
|
+
|
|
3
5
|
// Load binding first to not import other modules if it throws
|
|
4
6
|
const libdatadog = require('@datadog/libdatadog')
|
|
5
7
|
const binding = libdatadog.load('crashtracker')
|
|
6
8
|
|
|
7
9
|
const log = require('../log')
|
|
8
10
|
const defaults = require('../config_defaults')
|
|
9
|
-
const { URL } = require('url')
|
|
10
11
|
const pkg = require('../../../../package.json')
|
|
12
|
+
const processTags = require('../process-tags')
|
|
11
13
|
|
|
12
14
|
class Crashtracker {
|
|
13
15
|
#started = false
|
|
@@ -77,6 +79,13 @@ class Crashtracker {
|
|
|
77
79
|
#getMetadata (config) {
|
|
78
80
|
const tags = Object.keys(config.tags).map(key => `${key}:${config.tags[key]}`)
|
|
79
81
|
|
|
82
|
+
// Add process tags to the tags array
|
|
83
|
+
for (const [key, value] of processTags.tags) {
|
|
84
|
+
if (value !== undefined) {
|
|
85
|
+
tags.push(`${key}:${value}`)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
80
89
|
return {
|
|
81
90
|
library_name: pkg.name,
|
|
82
91
|
library_version: pkg.version,
|
|
@@ -13,7 +13,7 @@ class DataStreamsCheckpointer {
|
|
|
13
13
|
* @param {string} type - The type of the checkpoint, usually the streaming technology being used.
|
|
14
14
|
* Examples include kafka, kinesis, sns etc.
|
|
15
15
|
* @param {string} target - The target of data. This can be a topic, exchange or stream name.
|
|
16
|
-
* @param {
|
|
16
|
+
* @param {object} carrier - The carrier object to inject context into.
|
|
17
17
|
*/
|
|
18
18
|
setProduceCheckpoint (type, target, carrier) {
|
|
19
19
|
if (!this.config.dsmEnabled) return
|
|
@@ -33,7 +33,7 @@ class DataStreamsCheckpointer {
|
|
|
33
33
|
* @param {string} type - The type of the checkpoint, usually the streaming technology being used.
|
|
34
34
|
* Examples include kafka, kinesis, sns etc.
|
|
35
35
|
* @param {string} source - The source of data. This can be a topic, exchange or stream name.
|
|
36
|
-
* @param {
|
|
36
|
+
* @param {object} carrier - The carrier object to extract context from.
|
|
37
37
|
* @param {boolean} [manualCheckpoint=true] - Whether this checkpoint was manually set. Keep true if manually
|
|
38
38
|
* instrumenting. Manual instrumentation always overrides automatic
|
|
39
39
|
* instrumentation in the case a call is both manually and automatically
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Encodes positive and negative numbers, using zig zag encoding to reduce the size of the variable length encoding.
|
|
5
|
+
* Uses high and low part to ensure those parts are under the limit for byte operations in javascript (32 bits)
|
|
6
|
+
* Maximum number possible to encode is MAX_SAFE_INTEGER/2 (using zig zag shifts the bits by 1 to the left)
|
|
7
|
+
* @param {number} v
|
|
8
|
+
* @returns {Uint8Array|undefined}
|
|
9
|
+
*/
|
|
6
10
|
function encodeVarint (v) {
|
|
7
11
|
const sign = v >= 0 ? 0 : 1
|
|
8
|
-
//
|
|
12
|
+
// We leave the least significant bit for the sign.
|
|
9
13
|
const double = Math.abs(v) * 2
|
|
10
14
|
if (double > Number.MAX_SAFE_INTEGER) {
|
|
11
15
|
return
|
|
@@ -15,8 +19,12 @@ function encodeVarint (v) {
|
|
|
15
19
|
return encodeUvarint64(low, high)
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Decodes positive and negative numbers, using zig zag encoding to reduce the size of the variable length encoding.
|
|
24
|
+
* Uses high and low part to ensure those parts are under the limit for byte operations in javascript (32 bits)
|
|
25
|
+
* @param {Uint8Array} b
|
|
26
|
+
* @returns {[number|undefined, Uint8Array]}
|
|
27
|
+
*/
|
|
20
28
|
function decodeVarint (b) {
|
|
21
29
|
const [low, high, bytes] = decodeUvarint64(b)
|
|
22
30
|
if (low === undefined || high === undefined) {
|
|
@@ -29,6 +37,11 @@ function decodeVarint (b) {
|
|
|
29
37
|
|
|
30
38
|
const maxVarLen64 = 9
|
|
31
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @param {number} low
|
|
42
|
+
* @param {number} high
|
|
43
|
+
* @returns {Uint8Array}
|
|
44
|
+
*/
|
|
32
45
|
function encodeUvarint64 (low, high) {
|
|
33
46
|
const result = new Uint8Array(maxVarLen64)
|
|
34
47
|
let i = 0
|
|
@@ -44,6 +57,10 @@ function encodeUvarint64 (low, high) {
|
|
|
44
57
|
return result.slice(0, i + 1)
|
|
45
58
|
}
|
|
46
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @param {Uint8Array} bytes
|
|
62
|
+
* @returns {[number|undefined, number|undefined, Uint8Array]}
|
|
63
|
+
*/
|
|
47
64
|
function decodeUvarint64 (
|
|
48
65
|
bytes
|
|
49
66
|
) {
|
|
@@ -13,7 +13,7 @@ const {
|
|
|
13
13
|
//
|
|
14
14
|
// TODO: Remove this when DSM has been moved to dedicated plugins.
|
|
15
15
|
/**
|
|
16
|
-
* @template T extends new (...args:
|
|
16
|
+
* @template T extends new (...args: unknown[]) => unknown
|
|
17
17
|
* @param {() => T} classGetter
|
|
18
18
|
* @param {string[]} methods
|
|
19
19
|
* @param {string[]} staticMethods
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
// other languages use FNV1
|
|
5
5
|
// this inconsistency is ok because hashes do not need to be consistent across services
|
|
6
6
|
const crypto = require('crypto')
|
|
7
|
-
const {
|
|
8
|
-
const { LRUCache } = require('lru-cache')
|
|
7
|
+
const { LRUCache } = require('../../../../vendor/dist/lru-cache')
|
|
9
8
|
const log = require('../log')
|
|
10
9
|
const pick = require('../../../datadog-core/src/utils/src/pick')
|
|
10
|
+
const { encodeVarint, decodeVarint } = require('./encoding')
|
|
11
11
|
|
|
12
12
|
const cache = new LRUCache({ max: 500 })
|
|
13
13
|
|
|
@@ -21,6 +21,12 @@ function shaHash (checkpointString) {
|
|
|
21
21
|
return Buffer.from(hash, 'hex')
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @param {string} service
|
|
26
|
+
* @param {string} env
|
|
27
|
+
* @param {string[]} edgeTags
|
|
28
|
+
* @param {Buffer} parentHash
|
|
29
|
+
*/
|
|
24
30
|
function computeHash (service, env, edgeTags, parentHash) {
|
|
25
31
|
edgeTags.sort()
|
|
26
32
|
const hashableEdgeTags = edgeTags.filter(item => item !== 'manual_checkpoint:true')
|
|
@@ -37,6 +43,13 @@ function computeHash (service, env, edgeTags, parentHash) {
|
|
|
37
43
|
return value
|
|
38
44
|
}
|
|
39
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @param {object} dataStreamsContext
|
|
48
|
+
* @param {Buffer} dataStreamsContext.hash
|
|
49
|
+
* @param {number} dataStreamsContext.pathwayStartNs
|
|
50
|
+
* @param {number} dataStreamsContext.edgeStartNs
|
|
51
|
+
* @returns {Buffer}
|
|
52
|
+
*/
|
|
40
53
|
function encodePathwayContext (dataStreamsContext) {
|
|
41
54
|
return Buffer.concat([
|
|
42
55
|
dataStreamsContext.hash,
|
|
@@ -45,11 +58,22 @@ function encodePathwayContext (dataStreamsContext) {
|
|
|
45
58
|
], 20)
|
|
46
59
|
}
|
|
47
60
|
|
|
61
|
+
/**
|
|
62
|
+
* @param {object} dataStreamsContext
|
|
63
|
+
* @param {Buffer} dataStreamsContext.hash
|
|
64
|
+
* @param {number} dataStreamsContext.pathwayStartNs
|
|
65
|
+
* @param {number} dataStreamsContext.edgeStartNs
|
|
66
|
+
* @returns {string}
|
|
67
|
+
*/
|
|
48
68
|
function encodePathwayContextBase64 (dataStreamsContext) {
|
|
49
69
|
const encodedPathway = encodePathwayContext(dataStreamsContext)
|
|
50
70
|
return encodedPathway.toString('base64')
|
|
51
71
|
}
|
|
52
72
|
|
|
73
|
+
/**
|
|
74
|
+
* @param {Buffer} pathwayContext
|
|
75
|
+
* @returns {object}
|
|
76
|
+
*/
|
|
53
77
|
function decodePathwayContext (pathwayContext) {
|
|
54
78
|
if (pathwayContext == null || pathwayContext.length < 8) {
|
|
55
79
|
return null
|
|
@@ -68,6 +92,10 @@ function decodePathwayContext (pathwayContext) {
|
|
|
68
92
|
return { hash: pathwayHash, pathwayStartNs: pathwayStartMs * 1e6, edgeStartNs: edgeStartMs * 1e6 }
|
|
69
93
|
}
|
|
70
94
|
|
|
95
|
+
/**
|
|
96
|
+
* @param {string} pathwayContext
|
|
97
|
+
* @returns {ReturnType<typeof decodePathwayContext>|undefined}
|
|
98
|
+
*/
|
|
71
99
|
function decodePathwayContextBase64 (pathwayContext) {
|
|
72
100
|
if (pathwayContext == null || pathwayContext.length < 8) {
|
|
73
101
|
return
|
|
@@ -82,6 +110,13 @@ function decodePathwayContextBase64 (pathwayContext) {
|
|
|
82
110
|
const DsmPathwayCodec = {
|
|
83
111
|
// we use a class for encoding / decoding in case we update our encoding/decoding. A class will make updates easier
|
|
84
112
|
// instead of using individual functions.
|
|
113
|
+
/**
|
|
114
|
+
* @param {object} dataStreamsContext
|
|
115
|
+
* @param {Buffer} dataStreamsContext.hash
|
|
116
|
+
* @param {number} dataStreamsContext.pathwayStartNs
|
|
117
|
+
* @param {number} dataStreamsContext.edgeStartNs
|
|
118
|
+
* @param {object} carrier
|
|
119
|
+
*/
|
|
85
120
|
encode (dataStreamsContext, carrier) {
|
|
86
121
|
if (!dataStreamsContext || !dataStreamsContext.hash) {
|
|
87
122
|
return
|
|
@@ -91,6 +126,10 @@ const DsmPathwayCodec = {
|
|
|
91
126
|
log.debug(() => `Injected into DSM carrier: ${JSON.stringify(pick(carrier, logKeys))}.`)
|
|
92
127
|
},
|
|
93
128
|
|
|
129
|
+
/**
|
|
130
|
+
* @param {object} carrier
|
|
131
|
+
* @returns {ReturnType<typeof decodePathwayContext>|undefined}
|
|
132
|
+
*/
|
|
94
133
|
decode (carrier) {
|
|
95
134
|
log.debug(() => `Attempting extract from DSM carrier: ${JSON.stringify(pick(carrier, logKeys))}.`)
|
|
96
135
|
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
const os = require('os')
|
|
4
4
|
const pkg = require('../../../../package.json')
|
|
5
5
|
|
|
6
|
-
const { LogCollapsingLowestDenseDDSketch } = require('
|
|
6
|
+
const { LogCollapsingLowestDenseDDSketch } = require('../../../../vendor/dist/@datadog/sketches-js')
|
|
7
|
+
const { PATHWAY_HASH } = require('../../../../ext/tags')
|
|
8
|
+
const log = require('../log')
|
|
7
9
|
const { DsmPathwayCodec } = require('./pathway')
|
|
8
10
|
const { DataStreamsWriter } = require('./writer')
|
|
9
11
|
const { computePathwayHash } = require('./pathway')
|
|
10
12
|
const { getAmqpMessageSize, getHeadersSize, getMessageSize, getSizeOrZero } = require('./size')
|
|
11
|
-
const { PATHWAY_HASH } = require('../../../../ext/tags')
|
|
12
13
|
const { SchemaBuilder } = require('./schemas/schema_builder')
|
|
13
14
|
const { SchemaSampler } = require('./schemas/schema_sampler')
|
|
14
|
-
const log = require('../log')
|
|
15
15
|
|
|
16
16
|
const ENTRY_PARENT_HASH = Buffer.from('0000000000000000', 'hex')
|
|
17
17
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { URL, format } = require('url')
|
|
4
|
+
const zlib = require('zlib')
|
|
3
5
|
const pkg = require('../../../../package.json')
|
|
4
6
|
const log = require('../log')
|
|
5
7
|
const request = require('../exporters/common/request')
|
|
6
|
-
const { URL, format } = require('url')
|
|
7
8
|
const { MsgpackEncoder } = require('../msgpack')
|
|
8
9
|
const defaults = require('../config_defaults')
|
|
9
|
-
const zlib = require('zlib')
|
|
10
10
|
|
|
11
11
|
const msgpack = new MsgpackEncoder()
|
|
12
12
|
|