dd-trace 5.61.1 → 5.63.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/README.md +0 -5
- package/package.json +2 -2
- package/packages/datadog-instrumentations/src/ai.js +140 -0
- package/packages/datadog-instrumentations/src/apollo-server.js +50 -8
- package/packages/datadog-instrumentations/src/aws-sdk.js +49 -60
- package/packages/datadog-instrumentations/src/couchbase.js +102 -65
- package/packages/datadog-instrumentations/src/fastify.js +61 -55
- package/packages/datadog-instrumentations/src/graphql.js +90 -122
- package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
- package/packages/datadog-instrumentations/src/helpers/register.js +2 -22
- package/packages/datadog-instrumentations/src/hono.js +11 -8
- package/packages/datadog-instrumentations/src/http2/server.js +14 -20
- package/packages/datadog-instrumentations/src/knex.js +15 -17
- package/packages/datadog-instrumentations/src/microgateway-core.js +16 -15
- package/packages/datadog-instrumentations/src/mongodb-core.js +35 -32
- package/packages/datadog-instrumentations/src/mongodb.js +9 -13
- package/packages/datadog-instrumentations/src/mongoose.js +25 -29
- package/packages/datadog-instrumentations/src/next.js +4 -8
- package/packages/datadog-instrumentations/src/openai.js +0 -2
- package/packages/datadog-instrumentations/src/oracledb.js +39 -33
- package/packages/datadog-instrumentations/src/pg.js +38 -48
- package/packages/datadog-plugin-aerospike/src/index.js +11 -11
- package/packages/datadog-plugin-ai/src/index.js +17 -0
- package/packages/datadog-plugin-ai/src/tracing.js +33 -0
- package/packages/datadog-plugin-ai/src/utils.js +28 -0
- package/packages/datadog-plugin-amqp10/src/consumer.js +2 -2
- package/packages/datadog-plugin-amqp10/src/index.js +1 -1
- package/packages/datadog-plugin-amqp10/src/producer.js +3 -3
- package/packages/datadog-plugin-amqplib/src/client.js +3 -3
- package/packages/datadog-plugin-amqplib/src/consumer.js +2 -2
- package/packages/datadog-plugin-amqplib/src/index.js +1 -1
- package/packages/datadog-plugin-amqplib/src/producer.js +2 -2
- package/packages/datadog-plugin-apollo/src/gateway/execute.js +2 -4
- package/packages/datadog-plugin-apollo/src/gateway/fetch.js +2 -4
- package/packages/datadog-plugin-apollo/src/gateway/index.js +1 -1
- package/packages/datadog-plugin-apollo/src/gateway/plan.js +2 -4
- package/packages/datadog-plugin-apollo/src/gateway/postprocessing.js +2 -4
- package/packages/datadog-plugin-apollo/src/gateway/request.js +2 -4
- package/packages/datadog-plugin-apollo/src/gateway/validate.js +2 -4
- package/packages/datadog-plugin-apollo/src/index.js +1 -1
- package/packages/datadog-plugin-avsc/src/index.js +2 -2
- package/packages/datadog-plugin-aws-sdk/src/base.js +70 -46
- package/packages/datadog-plugin-aws-sdk/src/index.js +1 -3
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/index.js +1 -3
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/tracing.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +3 -3
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +2 -2
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +22 -20
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/s3.js +3 -3
- package/packages/datadog-plugin-aws-sdk/src/services/sfn.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +3 -3
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +17 -15
- package/packages/datadog-plugin-aws-sdk/src/services/states.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +1 -1
- package/packages/datadog-plugin-azure-functions/src/index.js +5 -5
- package/packages/datadog-plugin-azure-service-bus/src/index.js +1 -1
- package/packages/datadog-plugin-azure-service-bus/src/producer.js +2 -2
- package/packages/datadog-plugin-bunyan/src/index.js +3 -5
- package/packages/datadog-plugin-cassandra-driver/src/index.js +3 -3
- package/packages/datadog-plugin-child_process/src/index.js +2 -2
- package/packages/datadog-plugin-confluentinc-kafka-javascript/src/batch-consumer.js +1 -3
- package/packages/datadog-plugin-confluentinc-kafka-javascript/src/consumer.js +1 -3
- package/packages/datadog-plugin-confluentinc-kafka-javascript/src/index.js +1 -1
- package/packages/datadog-plugin-confluentinc-kafka-javascript/src/producer.js +1 -3
- package/packages/datadog-plugin-connect/src/index.js +1 -3
- package/packages/datadog-plugin-couchbase/src/index.js +39 -19
- package/packages/datadog-plugin-cucumber/src/index.js +1 -3
- package/packages/datadog-plugin-cypress/src/index.js +1 -3
- package/packages/datadog-plugin-dd-trace-api/src/index.js +1 -3
- package/packages/datadog-plugin-dns/src/index.js +1 -1
- package/packages/datadog-plugin-dns/src/lookup.js +2 -2
- package/packages/datadog-plugin-dns/src/lookup_service.js +2 -2
- package/packages/datadog-plugin-dns/src/resolve.js +2 -2
- package/packages/datadog-plugin-dns/src/reverse.js +2 -2
- package/packages/datadog-plugin-elasticsearch/src/index.js +1 -1
- package/packages/datadog-plugin-express/src/code_origin.js +1 -3
- package/packages/datadog-plugin-express/src/index.js +1 -1
- package/packages/datadog-plugin-express/src/tracing.js +1 -3
- package/packages/datadog-plugin-fastify/src/code_origin.js +1 -3
- package/packages/datadog-plugin-fastify/src/index.js +1 -1
- package/packages/datadog-plugin-fastify/src/tracing.js +18 -3
- package/packages/datadog-plugin-fetch/src/index.js +2 -2
- package/packages/datadog-plugin-find-my-way/src/index.js +1 -3
- package/packages/datadog-plugin-fs/src/index.js +2 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +3 -3
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +2 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/index.js +1 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +2 -2
- package/packages/datadog-plugin-google-cloud-vertexai/src/index.js +1 -1
- package/packages/datadog-plugin-google-cloud-vertexai/src/tracing.js +2 -4
- package/packages/datadog-plugin-graphql/src/execute.js +16 -9
- package/packages/datadog-plugin-graphql/src/index.js +1 -1
- package/packages/datadog-plugin-graphql/src/parse.js +12 -7
- package/packages/datadog-plugin-graphql/src/resolve.js +50 -16
- package/packages/datadog-plugin-graphql/src/validate.js +13 -7
- package/packages/datadog-plugin-grpc/src/client.js +4 -4
- package/packages/datadog-plugin-grpc/src/index.js +1 -1
- package/packages/datadog-plugin-grpc/src/server.js +3 -3
- package/packages/datadog-plugin-hapi/src/index.js +1 -3
- package/packages/datadog-plugin-hono/src/index.js +1 -3
- package/packages/datadog-plugin-http/src/client.js +2 -2
- package/packages/datadog-plugin-http/src/index.js +1 -1
- package/packages/datadog-plugin-http/src/server.js +3 -7
- package/packages/datadog-plugin-http2/src/client.js +2 -2
- package/packages/datadog-plugin-http2/src/index.js +1 -1
- package/packages/datadog-plugin-http2/src/server.js +22 -11
- package/packages/datadog-plugin-ioredis/src/index.js +1 -3
- package/packages/datadog-plugin-iovalkey/src/index.js +2 -4
- package/packages/datadog-plugin-jest/src/index.js +1 -3
- package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +2 -2
- package/packages/datadog-plugin-kafkajs/src/consumer.js +2 -2
- package/packages/datadog-plugin-kafkajs/src/index.js +1 -1
- package/packages/datadog-plugin-kafkajs/src/producer.js +3 -3
- package/packages/datadog-plugin-koa/src/index.js +1 -3
- package/packages/datadog-plugin-langchain/src/index.js +2 -2
- package/packages/datadog-plugin-langchain/src/tracing.js +30 -48
- package/packages/datadog-plugin-mariadb/src/index.js +2 -2
- package/packages/datadog-plugin-memcached/src/index.js +1 -1
- package/packages/datadog-plugin-microgateway-core/src/index.js +4 -4
- package/packages/datadog-plugin-mocha/src/index.js +1 -3
- package/packages/datadog-plugin-moleculer/src/client.js +2 -2
- package/packages/datadog-plugin-moleculer/src/index.js +1 -1
- package/packages/datadog-plugin-moleculer/src/server.js +2 -2
- package/packages/datadog-plugin-mongodb-core/src/index.js +9 -5
- package/packages/datadog-plugin-mongoose/src/index.js +20 -0
- package/packages/datadog-plugin-mysql/src/index.js +2 -2
- package/packages/datadog-plugin-mysql2/src/index.js +1 -1
- package/packages/datadog-plugin-net/src/index.js +1 -1
- package/packages/datadog-plugin-net/src/ipc.js +2 -2
- package/packages/datadog-plugin-net/src/tcp.js +2 -2
- package/packages/datadog-plugin-next/src/index.js +1 -3
- package/packages/datadog-plugin-nyc/src/index.js +1 -3
- package/packages/datadog-plugin-openai/src/index.js +1 -1
- package/packages/datadog-plugin-openai/src/tracing.js +7 -411
- package/packages/datadog-plugin-opensearch/src/index.js +1 -3
- package/packages/datadog-plugin-oracledb/src/index.js +9 -5
- package/packages/datadog-plugin-pg/src/index.js +8 -5
- package/packages/datadog-plugin-pino/src/index.js +3 -5
- package/packages/datadog-plugin-playwright/src/index.js +1 -3
- package/packages/datadog-plugin-prisma/src/client.js +4 -6
- package/packages/datadog-plugin-prisma/src/engine.js +3 -3
- package/packages/datadog-plugin-prisma/src/index.js +1 -1
- package/packages/datadog-plugin-protobufjs/src/index.js +2 -6
- package/packages/datadog-plugin-redis/src/index.js +2 -2
- package/packages/datadog-plugin-restify/src/index.js +1 -3
- package/packages/datadog-plugin-rhea/src/consumer.js +1 -1
- package/packages/datadog-plugin-rhea/src/index.js +1 -1
- package/packages/datadog-plugin-rhea/src/producer.js +2 -2
- package/packages/datadog-plugin-router/src/index.js +1 -3
- package/packages/datadog-plugin-selenium/src/index.js +1 -3
- package/packages/datadog-plugin-sharedb/src/index.js +1 -1
- package/packages/datadog-plugin-tedious/src/index.js +3 -3
- package/packages/datadog-plugin-undici/src/index.js +2 -4
- package/packages/datadog-plugin-vitest/src/index.js +1 -3
- package/packages/datadog-plugin-web/src/index.js +1 -3
- package/packages/datadog-plugin-winston/src/index.js +3 -5
- package/packages/dd-trace/src/appsec/channels.js +1 -0
- package/packages/dd-trace/src/appsec/graphql.js +14 -12
- package/packages/dd-trace/src/appsec/iast/analyzers/sql-injection-analyzer.js +14 -7
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +4 -4
- package/packages/dd-trace/src/appsec/recommended.json +271 -2
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +1 -1
- package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +1 -3
- package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +1 -3
- package/packages/dd-trace/src/config.js +1 -1
- package/packages/dd-trace/src/datastreams/checkpointer.js +23 -2
- package/packages/dd-trace/src/datastreams/processor.js +4 -3
- package/packages/dd-trace/src/guardrails/telemetry.js +18 -2
- package/packages/dd-trace/src/llmobs/plugins/ai/index.js +351 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +179 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +30 -50
- package/packages/dd-trace/src/llmobs/plugins/openai.js +3 -5
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +3 -5
- package/packages/dd-trace/src/llmobs/writers/base.js +3 -2
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +25 -2
- package/packages/dd-trace/src/opentracing/span_context.js +4 -0
- package/packages/dd-trace/src/plugin_manager.js +8 -4
- package/packages/dd-trace/src/plugins/apollo.js +3 -3
- package/packages/dd-trace/src/plugins/cache.js +1 -1
- package/packages/dd-trace/src/plugins/client.js +3 -3
- package/packages/dd-trace/src/plugins/consumer.js +3 -3
- package/packages/dd-trace/src/plugins/database.js +2 -2
- package/packages/dd-trace/src/plugins/index.js +2 -0
- package/packages/dd-trace/src/plugins/log_plugin.js +1 -5
- package/packages/dd-trace/src/plugins/outbound.js +1 -1
- package/packages/dd-trace/src/plugins/plugin.js +1 -1
- package/packages/dd-trace/src/plugins/producer.js +3 -3
- package/packages/dd-trace/src/plugins/server.js +3 -3
- package/packages/dd-trace/src/plugins/storage.js +1 -1
- package/packages/dd-trace/src/plugins/tracing.js +24 -6
- package/packages/dd-trace/src/plugins/util/ci.js +11 -7
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +15 -19
- package/packages/dd-trace/src/plugins/util/ip_extractor.js +44 -3
- package/packages/dd-trace/src/plugins/util/tags.js +2 -0
- package/packages/dd-trace/src/plugins/util/web.js +26 -7
- package/packages/dd-trace/src/profiling/config.js +2 -0
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +2 -21
- package/packages/dd-trace/src/profiling/libuv-size.js +49 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns.js +2 -6
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_lookup.js +1 -3
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_lookupservice.js +1 -3
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_resolve.js +1 -3
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_reverse.js +1 -3
- package/packages/dd-trace/src/profiling/profilers/event_plugins/event.js +24 -23
- package/packages/dd-trace/src/profiling/profilers/event_plugins/fs.js +3 -9
- package/packages/dd-trace/src/profiling/profilers/event_plugins/net.js +3 -9
- package/packages/dd-trace/src/profiling/profilers/events.js +83 -64
- package/packages/dd-trace/src/profiling/profilers/poisson.js +105 -0
- package/packages/dd-trace/src/profiling/profilers/wall.js +3 -3
- package/packages/dd-trace/src/remote_config/manager.js +1 -1
- package/packages/dd-trace/src/supported-configurations.json +2 -0
- package/packages/dd-trace/src/tracer_metadata.js +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { parseModelId } = require('../../datadog-plugin-aws-sdk/src/services/bedrockruntime/utils')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Get the model provider from the span tags or attributes.
|
|
7
|
+
* This is normalized to LLM Observability model provider standards.
|
|
8
|
+
*
|
|
9
|
+
* @param {Record<string, string>} tags
|
|
10
|
+
* @returns {string}
|
|
11
|
+
*/
|
|
12
|
+
function getModelProvider (tags) {
|
|
13
|
+
const modelProviderTag = tags['ai.model.provider']
|
|
14
|
+
const providerParts = modelProviderTag?.split('.')
|
|
15
|
+
const provider = providerParts?.[0]
|
|
16
|
+
|
|
17
|
+
if (provider === 'amazon-bedrock') {
|
|
18
|
+
const modelId = tags['ai.model.id']
|
|
19
|
+
const model = modelId && parseModelId(modelId)
|
|
20
|
+
return model?.modelProvider ?? provider
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return provider
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = {
|
|
27
|
+
getModelProvider
|
|
28
|
+
}
|
|
@@ -4,8 +4,8 @@ const ConsumerPlugin = require('../../dd-trace/src/plugins/consumer')
|
|
|
4
4
|
const { getAddress, getShortName } = require('./util')
|
|
5
5
|
|
|
6
6
|
class Amqp10ConsumerPlugin extends ConsumerPlugin {
|
|
7
|
-
static
|
|
8
|
-
static
|
|
7
|
+
static id = 'amqp10'
|
|
8
|
+
static system = 'amqp'
|
|
9
9
|
|
|
10
10
|
bindStart (ctx) {
|
|
11
11
|
const { link } = ctx
|
|
@@ -5,7 +5,7 @@ const ConsumerPlugin = require('./consumer')
|
|
|
5
5
|
const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
6
6
|
|
|
7
7
|
class Amqp10Plugin extends CompositePlugin {
|
|
8
|
-
static
|
|
8
|
+
static id = 'amqp10'
|
|
9
9
|
static get plugins () {
|
|
10
10
|
return {
|
|
11
11
|
producer: ProducerPlugin,
|
|
@@ -5,9 +5,9 @@ const { CLIENT_PORT_KEY } = require('../../dd-trace/src/constants')
|
|
|
5
5
|
const { getAddress, getShortName } = require('./util')
|
|
6
6
|
|
|
7
7
|
class Amqp10ProducerPlugin extends ProducerPlugin {
|
|
8
|
-
static
|
|
9
|
-
static
|
|
10
|
-
static
|
|
8
|
+
static id = 'amqp10'
|
|
9
|
+
static operation = 'send'
|
|
10
|
+
static system = 'amqp'
|
|
11
11
|
|
|
12
12
|
bindStart (ctx) {
|
|
13
13
|
const { link } = ctx
|
|
@@ -6,9 +6,9 @@ const ClientPlugin = require('../../dd-trace/src/plugins/client')
|
|
|
6
6
|
const { getResourceName } = require('./util')
|
|
7
7
|
|
|
8
8
|
class AmqplibClientPlugin extends ClientPlugin {
|
|
9
|
-
static
|
|
10
|
-
static
|
|
11
|
-
static
|
|
9
|
+
static id = 'amqplib'
|
|
10
|
+
static type = 'messaging'
|
|
11
|
+
static operation = 'command'
|
|
12
12
|
|
|
13
13
|
bindStart (ctx) {
|
|
14
14
|
const { channel = {}, method, fields } = ctx
|
|
@@ -6,8 +6,8 @@ const { getAmqpMessageSize } = require('../../dd-trace/src/datastreams')
|
|
|
6
6
|
const { getResourceName } = require('./util')
|
|
7
7
|
|
|
8
8
|
class AmqplibConsumerPlugin extends ConsumerPlugin {
|
|
9
|
-
static
|
|
10
|
-
static
|
|
9
|
+
static id = 'amqplib'
|
|
10
|
+
static operation = 'consume'
|
|
11
11
|
|
|
12
12
|
bindStart (ctx) {
|
|
13
13
|
const { method, fields, message, queue } = ctx
|
|
@@ -7,7 +7,7 @@ const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
|
7
7
|
|
|
8
8
|
// TODO: Consider splitting channels for publish/receive in the instrumentation.
|
|
9
9
|
class AmqplibPlugin extends CompositePlugin {
|
|
10
|
-
static
|
|
10
|
+
static id = 'amqplib'
|
|
11
11
|
static get plugins () {
|
|
12
12
|
return {
|
|
13
13
|
producer: ProducerPlugin,
|
|
@@ -7,8 +7,8 @@ const { DsmPathwayCodec, getAmqpMessageSize } = require('../../dd-trace/src/data
|
|
|
7
7
|
const { getResourceName } = require('./util')
|
|
8
8
|
|
|
9
9
|
class AmqplibProducerPlugin extends ProducerPlugin {
|
|
10
|
-
static
|
|
11
|
-
static
|
|
10
|
+
static id = 'amqplib'
|
|
11
|
+
static operation = 'publish'
|
|
12
12
|
|
|
13
13
|
bindStart (ctx) {
|
|
14
14
|
const { channel = {}, method, fields, message } = ctx
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
const ApolloBasePlugin = require('../../../dd-trace/src/plugins/apollo')
|
|
4
4
|
|
|
5
5
|
class ApolloGatewayExecutePlugin extends ApolloBasePlugin {
|
|
6
|
-
static
|
|
7
|
-
static
|
|
8
|
-
return 'tracing:apm:apollo:gateway:execute'
|
|
9
|
-
}
|
|
6
|
+
static operation = 'execute'
|
|
7
|
+
static prefix = 'tracing:apm:apollo:gateway:execute'
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
module.exports = ApolloGatewayExecutePlugin
|
|
@@ -4,10 +4,8 @@ const { storage } = require('../../../datadog-core')
|
|
|
4
4
|
const ApolloBasePlugin = require('../../../dd-trace/src/plugins/apollo')
|
|
5
5
|
|
|
6
6
|
class ApolloGatewayFetchPlugin extends ApolloBasePlugin {
|
|
7
|
-
static
|
|
8
|
-
static
|
|
9
|
-
return 'tracing:apm:apollo:gateway:fetch'
|
|
10
|
-
}
|
|
7
|
+
static operation = 'fetch'
|
|
8
|
+
static prefix = 'tracing:apm:apollo:gateway:fetch'
|
|
11
9
|
|
|
12
10
|
bindStart (ctx) {
|
|
13
11
|
const store = storage('legacy').getStore()
|
|
@@ -10,7 +10,7 @@ const ApolloGatewayValidatePlugin = require('./validate')
|
|
|
10
10
|
const ApolloGatewayFetchPlugin = require('./fetch')
|
|
11
11
|
|
|
12
12
|
class ApolloGatewayPlugin extends CompositePlugin {
|
|
13
|
-
static
|
|
13
|
+
static id = 'gateway'
|
|
14
14
|
static get plugins () {
|
|
15
15
|
return {
|
|
16
16
|
execute: ApolloGatewayExecutePlugin,
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
const ApolloBasePlugin = require('../../../dd-trace/src/plugins/apollo')
|
|
4
4
|
|
|
5
5
|
class ApolloGatewayPlanPlugin extends ApolloBasePlugin {
|
|
6
|
-
static
|
|
7
|
-
static
|
|
8
|
-
return 'tracing:apm:apollo:gateway:plan'
|
|
9
|
-
}
|
|
6
|
+
static operation = 'plan'
|
|
7
|
+
static prefix = 'tracing:apm:apollo:gateway:plan'
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
module.exports = ApolloGatewayPlanPlugin
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
const ApolloBasePlugin = require('../../../dd-trace/src/plugins/apollo')
|
|
4
4
|
|
|
5
5
|
class ApolloGatewayPostProcessingPlugin extends ApolloBasePlugin {
|
|
6
|
-
static
|
|
7
|
-
static
|
|
8
|
-
return 'tracing:apm:apollo:gateway:postprocessing'
|
|
9
|
-
}
|
|
6
|
+
static operation = 'postprocessing'
|
|
7
|
+
static prefix = 'tracing:apm:apollo:gateway:postprocessing'
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
module.exports = ApolloGatewayPostProcessingPlugin
|
|
@@ -9,10 +9,8 @@ const OPERATION_DEFINITION = 'OperationDefinition'
|
|
|
9
9
|
const FRAGMENT_DEFINITION = 'FragmentDefinition'
|
|
10
10
|
|
|
11
11
|
class ApolloGatewayRequestPlugin extends ApolloBasePlugin {
|
|
12
|
-
static
|
|
13
|
-
static
|
|
14
|
-
return 'tracing:apm:apollo:gateway:request'
|
|
15
|
-
}
|
|
12
|
+
static operation = 'request'
|
|
13
|
+
static prefix = 'tracing:apm:apollo:gateway:request'
|
|
16
14
|
|
|
17
15
|
bindStart (ctx) {
|
|
18
16
|
const store = storage('legacy').getStore()
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
const ApolloBasePlugin = require('../../../dd-trace/src/plugins/apollo')
|
|
4
4
|
|
|
5
5
|
class ApolloGatewayValidatePlugin extends ApolloBasePlugin {
|
|
6
|
-
static
|
|
7
|
-
static
|
|
8
|
-
return 'tracing:apm:apollo:gateway:validate'
|
|
9
|
-
}
|
|
6
|
+
static operation = 'validate'
|
|
7
|
+
static prefix = 'tracing:apm:apollo:gateway:validate'
|
|
10
8
|
|
|
11
9
|
end (ctx) {
|
|
12
10
|
const result = ctx.result
|
|
@@ -4,7 +4,7 @@ const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
|
4
4
|
const ApolloGatewayPlugin = require('./gateway')
|
|
5
5
|
|
|
6
6
|
class ApolloPlugin extends CompositePlugin {
|
|
7
|
-
static
|
|
7
|
+
static id = 'apollo'
|
|
8
8
|
static get plugins () {
|
|
9
9
|
return {
|
|
10
10
|
gateway: ApolloGatewayPlugin
|
|
@@ -4,8 +4,8 @@ const SchemaPlugin = require('../../dd-trace/src/plugins/schema')
|
|
|
4
4
|
const SchemaExtractor = require('./schema_iterator')
|
|
5
5
|
|
|
6
6
|
class AvscPlugin extends SchemaPlugin {
|
|
7
|
-
static
|
|
8
|
-
static
|
|
7
|
+
static id = 'avsc'
|
|
8
|
+
static schemaExtractor = SchemaExtractor
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
module.exports = AvscPlugin
|
|
@@ -9,8 +9,8 @@ const { tagsFromRequest, tagsFromResponse } = require('../../dd-trace/src/payloa
|
|
|
9
9
|
const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
|
|
10
10
|
|
|
11
11
|
class BaseAwsSdkPlugin extends ClientPlugin {
|
|
12
|
-
static
|
|
13
|
-
static
|
|
12
|
+
static id = 'aws'
|
|
13
|
+
static isPayloadReporter = false
|
|
14
14
|
|
|
15
15
|
get serviceIdentifier () {
|
|
16
16
|
const id = this.constructor.id.toLowerCase()
|
|
@@ -34,17 +34,26 @@ class BaseAwsSdkPlugin extends ClientPlugin {
|
|
|
34
34
|
constructor (...args) {
|
|
35
35
|
super(...args)
|
|
36
36
|
|
|
37
|
-
this.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
this._parentMap = new WeakMap()
|
|
38
|
+
|
|
39
|
+
this.addBind(`apm:aws:request:start:${this.serviceIdentifier}`, (ctx) => {
|
|
40
|
+
const {
|
|
41
|
+
request,
|
|
42
|
+
operation,
|
|
43
|
+
awsRegion,
|
|
44
|
+
awsService
|
|
45
|
+
} = ctx
|
|
46
|
+
|
|
47
|
+
const parentStore = ctx.parentStore = storage('legacy').getStore()
|
|
48
|
+
const childOf = parentStore?.span
|
|
49
|
+
|
|
50
|
+
this._parentMap.set(request, parentStore)
|
|
51
|
+
|
|
43
52
|
if (!this.isEnabled(request)) {
|
|
44
|
-
return
|
|
53
|
+
return parentStore
|
|
45
54
|
}
|
|
46
|
-
|
|
47
|
-
const
|
|
55
|
+
|
|
56
|
+
const meta = {
|
|
48
57
|
'span.kind': 'client',
|
|
49
58
|
'service.name': this.serviceName(),
|
|
50
59
|
'aws.operation': operation,
|
|
@@ -54,18 +63,19 @@ class BaseAwsSdkPlugin extends ClientPlugin {
|
|
|
54
63
|
'aws.service': awsService,
|
|
55
64
|
component: 'aws-sdk'
|
|
56
65
|
}
|
|
57
|
-
if (this.requestTags) this.requestTags.set(request,
|
|
66
|
+
if (this.requestTags) this.requestTags.set(request, meta)
|
|
58
67
|
|
|
59
|
-
const span = this.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
})
|
|
68
|
+
const span = this.startSpan(this.operationFromRequest(request), {
|
|
69
|
+
childOf,
|
|
70
|
+
meta,
|
|
71
|
+
integrationName: 'aws-sdk'
|
|
72
|
+
}, ctx)
|
|
65
73
|
|
|
66
74
|
analyticsSampler.sample(span, this.config.measured)
|
|
67
75
|
|
|
68
|
-
|
|
76
|
+
storage('legacy').run(ctx.currentStore, () => {
|
|
77
|
+
this.requestInject(span, request)
|
|
78
|
+
})
|
|
69
79
|
|
|
70
80
|
if (this.constructor.isPayloadReporter && this.cloudTaggingConfig.requestsEnabled) {
|
|
71
81
|
const maxDepth = this.cloudTaggingConfig.maxDepth
|
|
@@ -73,12 +83,15 @@ class BaseAwsSdkPlugin extends ClientPlugin {
|
|
|
73
83
|
span.addTags(requestTags)
|
|
74
84
|
}
|
|
75
85
|
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
return ctx.currentStore
|
|
87
|
+
})
|
|
78
88
|
|
|
79
|
-
|
|
89
|
+
this.addSub(`apm:aws:request:start:${this.serviceIdentifier}`, (ctx) => {
|
|
80
90
|
if (!this._tracerConfig?._isInServerlessEnvironment()) return
|
|
81
91
|
|
|
92
|
+
const { awsRegion, awsService, currentStore, request } = ctx
|
|
93
|
+
const peerServerlessStorage = storage('peerServerless')
|
|
94
|
+
|
|
82
95
|
// Try to resolve the hostname immediately; if not possible, keep enough
|
|
83
96
|
// information so the region callback can resolve it later.
|
|
84
97
|
const hostname = getHostname({ awsParams: request.params, awsService }, awsRegion)
|
|
@@ -86,15 +99,15 @@ class BaseAwsSdkPlugin extends ClientPlugin {
|
|
|
86
99
|
peerServerlessStorage.enterWith(peerServerlessStore)
|
|
87
100
|
|
|
88
101
|
if (hostname) {
|
|
89
|
-
span.setTag('peer.service', hostname)
|
|
102
|
+
currentStore.span.setTag('peer.service', hostname)
|
|
90
103
|
peerServerlessStore.peerHostname = hostname
|
|
91
104
|
} else {
|
|
92
|
-
|
|
93
|
-
|
|
105
|
+
currentStore.awsParams = request.params
|
|
106
|
+
currentStore.awsService = awsService
|
|
94
107
|
}
|
|
95
108
|
})
|
|
96
109
|
|
|
97
|
-
this.addSub(`apm:aws:request:region:${this.serviceIdentifier}`, region => {
|
|
110
|
+
this.addSub(`apm:aws:request:region:${this.serviceIdentifier}`, ({ region }) => {
|
|
98
111
|
const store = storage('legacy').getStore()
|
|
99
112
|
if (!store) return
|
|
100
113
|
const { span } = store
|
|
@@ -114,24 +127,31 @@ class BaseAwsSdkPlugin extends ClientPlugin {
|
|
|
114
127
|
}
|
|
115
128
|
})
|
|
116
129
|
|
|
117
|
-
this.addSub(`apm:aws:request:complete:${this.serviceIdentifier}`,
|
|
118
|
-
const
|
|
119
|
-
if (!
|
|
120
|
-
const { span } =
|
|
130
|
+
this.addSub(`apm:aws:request:complete:${this.serviceIdentifier}`, ctx => {
|
|
131
|
+
const { response, cbExists = false, currentStore } = ctx
|
|
132
|
+
if (!currentStore) return
|
|
133
|
+
const { span } = currentStore
|
|
121
134
|
if (!span) return
|
|
122
|
-
// try to extract DSM context from response if no callback exists as extraction normally happens in CB
|
|
123
|
-
if (!cbExists && this.serviceIdentifier === 'sqs') {
|
|
124
|
-
const params = response.request.params
|
|
125
|
-
const operation = response.request.operation
|
|
126
|
-
this.responseExtractDSMContext(operation, params, response.data ?? response, span)
|
|
127
|
-
}
|
|
128
|
-
this.addResponseTags(span, response)
|
|
129
135
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
136
|
+
storage('legacy').run(currentStore, () => {
|
|
137
|
+
// try to extract DSM context from response if no callback exists as extraction normally happens in CB
|
|
138
|
+
if (!cbExists && this.serviceIdentifier === 'sqs') {
|
|
139
|
+
const params = response.request.params
|
|
140
|
+
const operation = response.request.operation
|
|
141
|
+
this.responseExtractDSMContext(operation, params, response.data ?? response, span)
|
|
142
|
+
}
|
|
143
|
+
this.addResponseTags(span, response)
|
|
144
|
+
|
|
145
|
+
if (this._tracerConfig?.trace?.aws?.addSpanPointers) {
|
|
146
|
+
this.addSpanPointers(span, response)
|
|
147
|
+
}
|
|
148
|
+
})
|
|
133
149
|
|
|
134
|
-
this.finish(
|
|
150
|
+
this.finish(ctx)
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
this.addBind(`apm:aws:response:start:${this.serviceIdentifier}`, ctx => {
|
|
154
|
+
return this._parentMap.get(ctx.request)
|
|
135
155
|
})
|
|
136
156
|
}
|
|
137
157
|
|
|
@@ -205,11 +225,15 @@ class BaseAwsSdkPlugin extends ClientPlugin {
|
|
|
205
225
|
// implemented by subclasses, or not
|
|
206
226
|
}
|
|
207
227
|
|
|
208
|
-
finish (
|
|
209
|
-
|
|
210
|
-
|
|
228
|
+
finish (ctx) {
|
|
229
|
+
const { currentStore, response } = ctx
|
|
230
|
+
const { span } = currentStore
|
|
231
|
+
const error = response?.error || ctx.error
|
|
232
|
+
|
|
233
|
+
if (error) {
|
|
234
|
+
span.setTag('error', error)
|
|
211
235
|
|
|
212
|
-
const requestId =
|
|
236
|
+
const requestId = error.RequestId || error.requestId
|
|
213
237
|
if (requestId) {
|
|
214
238
|
span.addTags({ 'aws.response.request_id': requestId })
|
|
215
239
|
}
|
|
@@ -219,7 +243,7 @@ class BaseAwsSdkPlugin extends ClientPlugin {
|
|
|
219
243
|
this.config.hooks.request(span, response)
|
|
220
244
|
}
|
|
221
245
|
|
|
222
|
-
super.finish()
|
|
246
|
+
super.finish(ctx)
|
|
223
247
|
}
|
|
224
248
|
|
|
225
249
|
configure (config) {
|
|
@@ -4,9 +4,7 @@ const CompositePlugin = require('../../../../dd-trace/src/plugins/composite')
|
|
|
4
4
|
const BedrockRuntimeTracing = require('./tracing')
|
|
5
5
|
const BedrockRuntimeLLMObsPlugin = require('../../../../dd-trace/src/llmobs/plugins/bedrockruntime')
|
|
6
6
|
class BedrockRuntimePlugin extends CompositePlugin {
|
|
7
|
-
static
|
|
8
|
-
return 'bedrockruntime'
|
|
9
|
-
}
|
|
7
|
+
static id = 'bedrockruntime'
|
|
10
8
|
|
|
11
9
|
static get plugins () {
|
|
12
10
|
return {
|
|
@@ -6,7 +6,7 @@ const { parseModelId } = require('./utils')
|
|
|
6
6
|
const enabledOperations = new Set(['invokeModel'])
|
|
7
7
|
|
|
8
8
|
class BedrockRuntime extends BaseAwsSdkPlugin {
|
|
9
|
-
static
|
|
9
|
+
static id = 'bedrockruntime'
|
|
10
10
|
|
|
11
11
|
isEnabled (request) {
|
|
12
12
|
const operation = request.operation
|
|
@@ -6,9 +6,9 @@ const { DYNAMODB_PTR_KIND, SPAN_POINTER_DIRECTION } = require('../../../dd-trace
|
|
|
6
6
|
const { extractPrimaryKeys, generatePointerHash } = require('../util')
|
|
7
7
|
|
|
8
8
|
class DynamoDb extends BaseAwsSdkPlugin {
|
|
9
|
-
static
|
|
10
|
-
static
|
|
11
|
-
static
|
|
9
|
+
static id = 'dynamodb'
|
|
10
|
+
static peerServicePrecursors = ['tablename']
|
|
11
|
+
static isPayloadReporter = true
|
|
12
12
|
|
|
13
13
|
generateTags (params, operation, response) {
|
|
14
14
|
const tags = {}
|
|
@@ -3,8 +3,8 @@ const log = require('../../../dd-trace/src/log')
|
|
|
3
3
|
const BaseAwsSdkPlugin = require('../base')
|
|
4
4
|
|
|
5
5
|
class EventBridge extends BaseAwsSdkPlugin {
|
|
6
|
-
static
|
|
7
|
-
static
|
|
6
|
+
static id = 'eventbridge'
|
|
7
|
+
static isPayloadReporter = true
|
|
8
8
|
|
|
9
9
|
generateTags (params, operation, response) {
|
|
10
10
|
if (!params?.source) return {}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
const { DsmPathwayCodec, getSizeOrZero } = require('../../../dd-trace/src/datastreams')
|
|
3
3
|
const log = require('../../../dd-trace/src/log')
|
|
4
4
|
const BaseAwsSdkPlugin = require('../base')
|
|
5
|
-
const { storage } = require('../../../datadog-core')
|
|
6
5
|
|
|
7
6
|
class Kinesis extends BaseAwsSdkPlugin {
|
|
8
|
-
static
|
|
9
|
-
static
|
|
10
|
-
static
|
|
7
|
+
static id = 'kinesis'
|
|
8
|
+
static peerServicePrecursors = ['streamname']
|
|
9
|
+
static isPayloadReporter = true
|
|
11
10
|
|
|
12
11
|
constructor (...args) {
|
|
13
12
|
super(...args)
|
|
@@ -16,48 +15,50 @@ class Kinesis extends BaseAwsSdkPlugin {
|
|
|
16
15
|
// in the base class
|
|
17
16
|
this.requestTags = new WeakMap()
|
|
18
17
|
|
|
19
|
-
this.
|
|
20
|
-
const { request, response } =
|
|
21
|
-
const store = storage('legacy').getStore()
|
|
18
|
+
this.addBind('apm:aws:response:start:kinesis', ctx => {
|
|
19
|
+
const { request, response } = ctx
|
|
22
20
|
const plugin = this
|
|
23
21
|
|
|
22
|
+
let store = this._parentMap.get(request)
|
|
23
|
+
|
|
24
24
|
// if we have either of these operations, we want to store the streamName param
|
|
25
25
|
// since it is not typically available during get/put records requests
|
|
26
26
|
if (request.operation === 'getShardIterator' || request.operation === 'listShards') {
|
|
27
|
-
this.storeStreamName(request.params, request.operation, store)
|
|
28
|
-
return
|
|
27
|
+
return this.storeStreamName(request.params, request.operation, store)
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
if (request.operation === 'getRecords') {
|
|
32
31
|
let span
|
|
33
32
|
const responseExtraction = this.responseExtract(request.params, request.operation, response)
|
|
34
33
|
if (responseExtraction && responseExtraction.maybeChildOf) {
|
|
35
|
-
|
|
34
|
+
ctx.needsFinish = true
|
|
36
35
|
const options = {
|
|
37
36
|
childOf: responseExtraction.maybeChildOf,
|
|
38
|
-
|
|
37
|
+
meta: {
|
|
39
38
|
...this.requestTags.get(request),
|
|
40
39
|
'span.kind': 'server'
|
|
41
40
|
},
|
|
42
41
|
integrationName: 'aws-sdk'
|
|
43
42
|
}
|
|
44
|
-
span = plugin.
|
|
45
|
-
|
|
43
|
+
span = plugin.startSpan('aws.response', options, ctx)
|
|
44
|
+
store = ctx.currentStore
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
// get the stream name that should have been stored previously
|
|
49
|
-
const { streamName } =
|
|
48
|
+
const { streamName } = store
|
|
50
49
|
|
|
51
50
|
// extract DSM context after as we might not have a parent-child but may have a DSM context
|
|
52
51
|
this.responseExtractDSMContext(
|
|
53
52
|
request.operation, request.params, response, span || null, { streamName }
|
|
54
53
|
)
|
|
55
54
|
}
|
|
55
|
+
|
|
56
|
+
return store
|
|
56
57
|
})
|
|
57
58
|
|
|
58
|
-
this.addSub('apm:aws:response:finish:kinesis',
|
|
59
|
-
|
|
60
|
-
this.finish(
|
|
59
|
+
this.addSub('apm:aws:response:finish:kinesis', ctx => {
|
|
60
|
+
if (!ctx.needsFinish) return
|
|
61
|
+
this.finish(ctx)
|
|
61
62
|
})
|
|
62
63
|
}
|
|
63
64
|
|
|
@@ -72,11 +73,12 @@ class Kinesis extends BaseAwsSdkPlugin {
|
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
storeStreamName (params, operation, store) {
|
|
75
|
-
if (!operation
|
|
76
|
-
if (
|
|
76
|
+
if (!operation) return store
|
|
77
|
+
if (operation !== 'getShardIterator' && operation !== 'listShards') return store
|
|
78
|
+
if (!params || !params.StreamName) return store
|
|
77
79
|
|
|
78
80
|
const streamName = params.StreamName
|
|
79
|
-
|
|
81
|
+
return { ...store, streamName }
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
responseExtract (params, operation, response) {
|
|
@@ -4,7 +4,7 @@ const log = require('../../../dd-trace/src/log')
|
|
|
4
4
|
const BaseAwsSdkPlugin = require('../base')
|
|
5
5
|
|
|
6
6
|
class Lambda extends BaseAwsSdkPlugin {
|
|
7
|
-
static
|
|
7
|
+
static id = 'lambda'
|
|
8
8
|
|
|
9
9
|
generateTags (params, operation, response) {
|
|
10
10
|
if (!params?.FunctionName) return {}
|
|
@@ -6,9 +6,9 @@ const { generatePointerHash } = require('../util')
|
|
|
6
6
|
const { S3_PTR_KIND, SPAN_POINTER_DIRECTION } = require('../../../dd-trace/src/constants')
|
|
7
7
|
|
|
8
8
|
class S3 extends BaseAwsSdkPlugin {
|
|
9
|
-
static
|
|
10
|
-
static
|
|
11
|
-
static
|
|
9
|
+
static id = 's3'
|
|
10
|
+
static peerServicePrecursors = ['bucketname']
|
|
11
|
+
static isPayloadReporter = true
|
|
12
12
|
|
|
13
13
|
generateTags (params, operation, response) {
|
|
14
14
|
if (!params?.Bucket) return {}
|
|
@@ -4,9 +4,9 @@ const log = require('../../../dd-trace/src/log')
|
|
|
4
4
|
const BaseAwsSdkPlugin = require('../base')
|
|
5
5
|
|
|
6
6
|
class Sns extends BaseAwsSdkPlugin {
|
|
7
|
-
static
|
|
8
|
-
static
|
|
9
|
-
static
|
|
7
|
+
static id = 'sns'
|
|
8
|
+
static peerServicePrecursors = ['topicname']
|
|
9
|
+
static isPayloadReporter = true
|
|
10
10
|
|
|
11
11
|
generateTags (params, operation, response) {
|
|
12
12
|
if (!params) return {}
|