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
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
const DatabasePlugin = require('../../dd-trace/src/plugins/database')
|
|
3
3
|
class PrismaClientPlugin extends DatabasePlugin {
|
|
4
|
-
static
|
|
5
|
-
static
|
|
6
|
-
static
|
|
7
|
-
static
|
|
8
|
-
return 'tracing:apm:prisma:client'
|
|
9
|
-
}
|
|
4
|
+
static id = 'prisma'
|
|
5
|
+
static operation = 'client'
|
|
6
|
+
static system = 'prisma'
|
|
7
|
+
static prefix = 'tracing:apm:prisma:client'
|
|
10
8
|
|
|
11
9
|
bindStart (ctx) {
|
|
12
10
|
const service = this.serviceName({ pluginConfig: this.config })
|
|
@@ -23,9 +23,9 @@ const databaseDriverMapper = {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
class PrismaEngine extends DatabasePlugin {
|
|
26
|
-
static
|
|
27
|
-
static
|
|
28
|
-
static
|
|
26
|
+
static id = 'prisma'
|
|
27
|
+
static operation = 'engine'
|
|
28
|
+
static system = 'prisma'
|
|
29
29
|
|
|
30
30
|
start (ctx) {
|
|
31
31
|
const { engineSpan, allEngineSpans, childOf, dbConfig } = ctx
|
|
@@ -6,7 +6,7 @@ const PrismaClientPlugin = require('./client')
|
|
|
6
6
|
const PrismaEnginePlugin = require('./engine')
|
|
7
7
|
|
|
8
8
|
class PrismaPlugin extends CompositePlugin {
|
|
9
|
-
static
|
|
9
|
+
static id = 'prisma'
|
|
10
10
|
static get plugins () {
|
|
11
11
|
return {
|
|
12
12
|
client: PrismaClientPlugin,
|
|
@@ -4,13 +4,9 @@ const SchemaPlugin = require('../../dd-trace/src/plugins/schema')
|
|
|
4
4
|
const SchemaExtractor = require('./schema_iterator')
|
|
5
5
|
|
|
6
6
|
class ProtobufjsPlugin extends SchemaPlugin {
|
|
7
|
-
static
|
|
8
|
-
return 'protobufjs'
|
|
9
|
-
}
|
|
7
|
+
static id = 'protobufjs'
|
|
10
8
|
|
|
11
|
-
static
|
|
12
|
-
return SchemaExtractor
|
|
13
|
-
}
|
|
9
|
+
static schemaExtractor = SchemaExtractor
|
|
14
10
|
}
|
|
15
11
|
|
|
16
12
|
module.exports = ProtobufjsPlugin
|
|
@@ -5,8 +5,8 @@ const CachePlugin = require('../../dd-trace/src/plugins/cache')
|
|
|
5
5
|
const urlFilter = require('../../dd-trace/src/plugins/util/urlfilter')
|
|
6
6
|
|
|
7
7
|
class RedisPlugin extends CachePlugin {
|
|
8
|
-
static
|
|
9
|
-
static
|
|
8
|
+
static id = 'redis'
|
|
9
|
+
static system = 'redis'
|
|
10
10
|
|
|
11
11
|
constructor (...args) {
|
|
12
12
|
super(...args)
|
|
@@ -4,9 +4,7 @@ const RouterPlugin = require('../../datadog-plugin-router/src')
|
|
|
4
4
|
const web = require('../../dd-trace/src/plugins/util/web')
|
|
5
5
|
|
|
6
6
|
class RestifyPlugin extends RouterPlugin {
|
|
7
|
-
static
|
|
8
|
-
return 'restify'
|
|
9
|
-
}
|
|
7
|
+
static id = 'restify'
|
|
10
8
|
|
|
11
9
|
constructor (...args) {
|
|
12
10
|
super(...args)
|
|
@@ -4,7 +4,7 @@ const ConsumerPlugin = require('../../dd-trace/src/plugins/consumer')
|
|
|
4
4
|
const { getAmqpMessageSize } = require('../../dd-trace/src/datastreams')
|
|
5
5
|
|
|
6
6
|
class RheaConsumerPlugin extends ConsumerPlugin {
|
|
7
|
-
static
|
|
7
|
+
static id = 'rhea'
|
|
8
8
|
|
|
9
9
|
constructor (...args) {
|
|
10
10
|
super(...args)
|
|
@@ -5,7 +5,7 @@ const ConsumerPlugin = require('./consumer')
|
|
|
5
5
|
const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
6
6
|
|
|
7
7
|
class RheaPlugin extends CompositePlugin {
|
|
8
|
-
static
|
|
8
|
+
static id = 'rhea'
|
|
9
9
|
static get plugins () {
|
|
10
10
|
return {
|
|
11
11
|
producer: ProducerPlugin,
|
|
@@ -5,8 +5,8 @@ const ProducerPlugin = require('../../dd-trace/src/plugins/producer')
|
|
|
5
5
|
const { getAmqpMessageSize, DsmPathwayCodec } = require('../../dd-trace/src/datastreams')
|
|
6
6
|
|
|
7
7
|
class RheaProducerPlugin extends ProducerPlugin {
|
|
8
|
-
static
|
|
9
|
-
static
|
|
8
|
+
static id = 'rhea'
|
|
9
|
+
static operation = 'send'
|
|
10
10
|
|
|
11
11
|
constructor (...args) {
|
|
12
12
|
super(...args)
|
|
@@ -7,9 +7,7 @@ const { storage } = require('../../datadog-core')
|
|
|
7
7
|
const { COMPONENT } = require('../../dd-trace/src/constants')
|
|
8
8
|
|
|
9
9
|
class RouterPlugin extends WebPlugin {
|
|
10
|
-
static
|
|
11
|
-
return 'router'
|
|
12
|
-
}
|
|
10
|
+
static id = 'router'
|
|
13
11
|
|
|
14
12
|
constructor (...args) {
|
|
15
13
|
super(...args)
|
|
@@ -4,9 +4,9 @@ const { CLIENT_PORT_KEY } = require('../../dd-trace/src/constants')
|
|
|
4
4
|
const DatabasePlugin = require('../../dd-trace/src/plugins/database')
|
|
5
5
|
|
|
6
6
|
class TediousPlugin extends DatabasePlugin {
|
|
7
|
-
static
|
|
8
|
-
static
|
|
9
|
-
static
|
|
7
|
+
static id = 'tedious'
|
|
8
|
+
static operation = 'request' // TODO: change to match other database plugins
|
|
9
|
+
static system = 'mssql'
|
|
10
10
|
|
|
11
11
|
bindStart (ctx) {
|
|
12
12
|
const service = this.serviceName({ pluginConfig: this.config, system: this.system })
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
const FetchPlugin = require('../../datadog-plugin-fetch/src/index.js')
|
|
4
4
|
|
|
5
5
|
class UndiciPlugin extends FetchPlugin {
|
|
6
|
-
static
|
|
7
|
-
static
|
|
8
|
-
return 'tracing:apm:undici:fetch'
|
|
9
|
-
}
|
|
6
|
+
static id = 'undici'
|
|
7
|
+
static prefix = 'tracing:apm:undici:fetch'
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
module.exports = UndiciPlugin
|
|
@@ -47,9 +47,7 @@ const { DD_MAJOR } = require('../../../version')
|
|
|
47
47
|
const MILLISECONDS_TO_SUBTRACT_FROM_FAILED_TEST_DURATION = 5
|
|
48
48
|
|
|
49
49
|
class VitestPlugin extends CiPlugin {
|
|
50
|
-
static
|
|
51
|
-
return 'vitest'
|
|
52
|
-
}
|
|
50
|
+
static id = 'vitest'
|
|
53
51
|
|
|
54
52
|
constructor (...args) {
|
|
55
53
|
super(...args)
|
|
@@ -4,9 +4,7 @@ const Plugin = require('../../dd-trace/src/plugins/plugin')
|
|
|
4
4
|
const web = require('../../dd-trace/src/plugins/util/web')
|
|
5
5
|
|
|
6
6
|
class WebPlugin extends Plugin {
|
|
7
|
-
static
|
|
8
|
-
return 'web'
|
|
9
|
-
}
|
|
7
|
+
static id = 'web'
|
|
10
8
|
|
|
11
9
|
configure (config) {
|
|
12
10
|
return super.configure(web.normalizeConfig(config))
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const LogPlugin = require('../../dd-trace/src/plugins/log_plugin')
|
|
4
4
|
|
|
5
|
-
class WinstonPlugin extends
|
|
6
|
-
static
|
|
7
|
-
return 'winston'
|
|
8
|
-
}
|
|
5
|
+
class WinstonPlugin extends LogPlugin {
|
|
6
|
+
static id = 'winston'
|
|
9
7
|
}
|
|
10
8
|
module.exports = WinstonPlugin
|
|
@@ -5,6 +5,7 @@ const dc = require('dc-polyfill')
|
|
|
5
5
|
// TODO: use TBD naming convention
|
|
6
6
|
module.exports = {
|
|
7
7
|
apolloChannel: dc.tracingChannel('datadog:apollo:request'),
|
|
8
|
+
apolloHttpServerChannel: dc.tracingChannel('datadog:apollo:httpserver'),
|
|
8
9
|
apolloServerCoreChannel: dc.tracingChannel('datadog:apollo-server-core:request'),
|
|
9
10
|
bodyParser: dc.channel('datadog:body-parser:read:finish'),
|
|
10
11
|
childProcessExecutionTracingChannel: dc.tracingChannel('datadog:child_process:execution'),
|
|
@@ -14,6 +14,7 @@ const web = require('../plugins/util/web')
|
|
|
14
14
|
const {
|
|
15
15
|
startGraphqlResolve,
|
|
16
16
|
graphqlMiddlewareChannel,
|
|
17
|
+
apolloHttpServerChannel,
|
|
17
18
|
apolloChannel,
|
|
18
19
|
apolloServerCoreChannel
|
|
19
20
|
} = require('./channels')
|
|
@@ -55,7 +56,6 @@ function enterInApolloMiddleware (data) {
|
|
|
55
56
|
if (!req) return
|
|
56
57
|
|
|
57
58
|
graphqlRequestData.set(req, {
|
|
58
|
-
inApolloMiddleware: true,
|
|
59
59
|
blocked: false
|
|
60
60
|
})
|
|
61
61
|
}
|
|
@@ -70,17 +70,13 @@ function enterInApolloServerCoreRequest () {
|
|
|
70
70
|
})
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
function exitFromApolloMiddleware (data) {
|
|
74
|
-
const req = data?.req || storage('legacy').getStore()?.req
|
|
75
|
-
const requestData = graphqlRequestData.get(req)
|
|
76
|
-
if (requestData) requestData.inApolloMiddleware = false
|
|
77
|
-
}
|
|
78
|
-
|
|
79
73
|
function enterInApolloRequest () {
|
|
80
74
|
const req = storage('legacy').getStore()?.req
|
|
81
75
|
|
|
82
76
|
const requestData = graphqlRequestData.get(req)
|
|
83
|
-
if (requestData
|
|
77
|
+
if (requestData) {
|
|
78
|
+
// Set isInGraphqlRequest=true since this function only runs for GraphQL requests
|
|
79
|
+
// This works for both Apollo v4 (middleware) and v5 (HTTP server) contexts
|
|
84
80
|
requestData.isInGraphqlRequest = true
|
|
85
81
|
addSpecificEndpoint(req.method, req.originalUrl || req.url, specificBlockingTypes.GRAPHQL)
|
|
86
82
|
}
|
|
@@ -118,8 +114,7 @@ function beforeWriteApolloGraphqlResponse ({ abortController, abortData }) {
|
|
|
118
114
|
|
|
119
115
|
function enableApollo () {
|
|
120
116
|
graphqlMiddlewareChannel.subscribe({
|
|
121
|
-
start: enterInApolloMiddleware
|
|
122
|
-
end: exitFromApolloMiddleware
|
|
117
|
+
start: enterInApolloMiddleware
|
|
123
118
|
})
|
|
124
119
|
|
|
125
120
|
apolloServerCoreChannel.subscribe({
|
|
@@ -131,12 +126,15 @@ function enableApollo () {
|
|
|
131
126
|
start: enterInApolloRequest,
|
|
132
127
|
asyncEnd: beforeWriteApolloGraphqlResponse
|
|
133
128
|
})
|
|
129
|
+
|
|
130
|
+
apolloHttpServerChannel.subscribe({
|
|
131
|
+
start: enterInApolloMiddleware
|
|
132
|
+
})
|
|
134
133
|
}
|
|
135
134
|
|
|
136
135
|
function disableApollo () {
|
|
137
136
|
graphqlMiddlewareChannel.unsubscribe({
|
|
138
|
-
start: enterInApolloMiddleware
|
|
139
|
-
end: exitFromApolloMiddleware
|
|
137
|
+
start: enterInApolloMiddleware
|
|
140
138
|
})
|
|
141
139
|
|
|
142
140
|
apolloServerCoreChannel.unsubscribe({
|
|
@@ -148,6 +146,10 @@ function disableApollo () {
|
|
|
148
146
|
start: enterInApolloRequest,
|
|
149
147
|
asyncEnd: beforeWriteApolloGraphqlResponse
|
|
150
148
|
})
|
|
149
|
+
|
|
150
|
+
apolloHttpServerChannel.unsubscribe({
|
|
151
|
+
start: enterInApolloMiddleware
|
|
152
|
+
})
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
function enableGraphql () {
|
|
@@ -16,7 +16,10 @@ class SqlInjectionAnalyzer extends StoredInjectionAnalyzer {
|
|
|
16
16
|
onConfigure () {
|
|
17
17
|
this.addSub('apm:mysql:query:start', ({ sql }) => this.analyze(sql, undefined, 'MYSQL'))
|
|
18
18
|
this.addSub('datadog:mysql2:outerquery:start', ({ sql }) => this.analyze(sql, undefined, 'MYSQL'))
|
|
19
|
-
this.addSub(
|
|
19
|
+
this.addSub(
|
|
20
|
+
'apm:pg:query:start',
|
|
21
|
+
({ originalText, query }) => this.analyze(originalText || query.text, undefined, 'POSTGRES')
|
|
22
|
+
)
|
|
20
23
|
|
|
21
24
|
this.addBind(
|
|
22
25
|
'datadog:sequelize:query:start',
|
|
@@ -24,17 +27,22 @@ class SqlInjectionAnalyzer extends StoredInjectionAnalyzer {
|
|
|
24
27
|
)
|
|
25
28
|
this.addSub('datadog:sequelize:query:finish', () => this.returnToParentStore())
|
|
26
29
|
|
|
27
|
-
this.
|
|
30
|
+
this.addBind('datadog:pg:pool:query:start', ({ query }) => this.getStoreAndAnalyze(query.text, 'POSTGRES'))
|
|
28
31
|
this.addSub('datadog:pg:pool:query:finish', () => this.returnToParentStore())
|
|
29
32
|
|
|
30
33
|
this.addSub('datadog:mysql:pool:query:start', ({ sql }) => this.setStoreAndAnalyze(sql, 'MYSQL'))
|
|
31
34
|
this.addSub('datadog:mysql:pool:query:finish', () => this.returnToParentStore())
|
|
32
35
|
|
|
33
|
-
this.
|
|
36
|
+
this.addBind('datadog:knex:raw:start', (context) => {
|
|
37
|
+
const { sql, dialect: knexDialect } = context
|
|
34
38
|
const dialect = this.normalizeKnexDialect(knexDialect)
|
|
35
|
-
this.
|
|
39
|
+
const currentStore = this.getStoreAndAnalyze(sql, dialect)
|
|
40
|
+
context.currentStore = currentStore
|
|
41
|
+
return currentStore
|
|
36
42
|
})
|
|
37
|
-
|
|
43
|
+
|
|
44
|
+
this.addBind('datadog:knex:raw:subscribes', ({ currentStore }) => currentStore)
|
|
45
|
+
this.addBind('datadog:knex:raw:finish', ({ currentStore }) => currentStore?.sqlParentStore)
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
setStoreAndAnalyze (query, dialect) {
|
|
@@ -54,8 +62,7 @@ class SqlInjectionAnalyzer extends StoredInjectionAnalyzer {
|
|
|
54
62
|
}
|
|
55
63
|
}
|
|
56
64
|
|
|
57
|
-
returnToParentStore () {
|
|
58
|
-
const store = storage('legacy').getStore()
|
|
65
|
+
returnToParentStore (store = storage('legacy').getStore()) {
|
|
59
66
|
if (store && store.sqlParentStore) {
|
|
60
67
|
storage('legacy').enterWith(store.sqlParentStore)
|
|
61
68
|
}
|
|
@@ -139,12 +139,12 @@ class TaintTrackingPlugin extends SourceIastPlugin {
|
|
|
139
139
|
addDatabaseSubscriptions () {
|
|
140
140
|
this.addSub(
|
|
141
141
|
{ channelName: 'datadog:sequelize:query:finish', tag: SQL_ROW_VALUE },
|
|
142
|
-
({ result }) => this._taintDatabaseResult(result, 'sequelize')
|
|
142
|
+
({ result }) => this._taintDatabaseResult(result, 'sequelize', getIastContext(storage('legacy').getStore()))
|
|
143
143
|
)
|
|
144
144
|
|
|
145
145
|
this.addSub(
|
|
146
146
|
{ channelName: 'apm:pg:query:finish', tag: SQL_ROW_VALUE },
|
|
147
|
-
({ result }) => this._taintDatabaseResult(result, 'pg')
|
|
147
|
+
({ result, currentStore }) => this._taintDatabaseResult(result, 'pg', getIastContext(currentStore))
|
|
148
148
|
)
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -180,7 +180,7 @@ class TaintTrackingPlugin extends SourceIastPlugin {
|
|
|
180
180
|
{ channelName: 'apm:graphql:resolve:start', tag: HTTP_REQUEST_BODY },
|
|
181
181
|
(data) => {
|
|
182
182
|
const iastContext = getIastContext(storage('legacy').getStore())
|
|
183
|
-
const source = data.
|
|
183
|
+
const source = data.rootCtx?.source
|
|
184
184
|
const ranges = source && getRanges(iastContext, source)
|
|
185
185
|
if (ranges?.length) {
|
|
186
186
|
this._taintTrackingHandler(ranges[0].iinfo.type, data.args, null, iastContext)
|
|
@@ -263,7 +263,7 @@ class TaintTrackingPlugin extends SourceIastPlugin {
|
|
|
263
263
|
this.taintUrl(req, iastContext)
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
_taintDatabaseResult (result, dbOrigin, iastContext
|
|
266
|
+
_taintDatabaseResult (result, dbOrigin, iastContext, name) {
|
|
267
267
|
if (!iastContext) return result
|
|
268
268
|
|
|
269
269
|
if (this._rowsToTaint === 0) return result
|