dd-trace 6.24.0 → 6.25.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/ci/init.js +2 -22
- package/ext/exporters.js +0 -1
- package/index.d.ts +105 -5
- package/initialize.mjs +5 -2
- package/lambda.d.ts +39 -0
- package/lambda.js +3 -0
- package/package.json +11 -9
- package/packages/datadog-esbuild/index.js +8 -55
- package/packages/datadog-instrumentations/src/aws-lambda.js +88 -0
- package/packages/datadog-instrumentations/src/cucumber.js +5 -2
- package/packages/datadog-instrumentations/src/elevenlabs/activity.js +114 -0
- package/packages/datadog-instrumentations/src/elevenlabs/audio.js +104 -0
- package/packages/datadog-instrumentations/src/elevenlabs/index.js +288 -0
- package/packages/datadog-instrumentations/src/elevenlabs/session.js +444 -0
- package/packages/datadog-instrumentations/src/graphql.js +20 -17
- package/packages/{datadog-esbuild/src/utils.js → datadog-instrumentations/src/helpers/bundler-esm-exports.js} +282 -40
- package/packages/datadog-instrumentations/src/helpers/bundler-transform.js +573 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-utils.js +104 -0
- package/packages/datadog-instrumentations/src/helpers/hook.js +29 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +3 -7
- package/packages/datadog-instrumentations/src/helpers/lambda-handler.js +189 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +2 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +18 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/async-mutex.js +41 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/elevenlabs.js +25 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +0 -36
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/next.js +40 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/openai-agents-realtime.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/trpc.js +148 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/target-patterns.json +50 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +17 -3
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +59 -2
- package/packages/datadog-instrumentations/src/ioredis.js +101 -3
- package/packages/datadog-instrumentations/src/next.js +19 -6
- package/packages/datadog-instrumentations/src/openai-agents-realtime.js +149 -0
- package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +27 -0
- package/packages/datadog-instrumentations/src/openai-realtime/index.js +17 -6
- package/packages/datadog-instrumentations/src/openai-realtime/server-playback.js +887 -0
- package/packages/datadog-instrumentations/src/openai-realtime/session.js +150 -25
- package/packages/datadog-instrumentations/src/openai-realtime/turns.js +29 -2
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +11 -9
- package/packages/datadog-instrumentations/src/webdriverio.js +12 -12
- package/packages/datadog-plugin-async-mutex/src/index.js +50 -0
- package/packages/datadog-plugin-aws-lambda/src/index.js +106 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +22 -11
- package/packages/datadog-plugin-elevenlabs/src/index.js +69 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +10 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +19 -52
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +4 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +25 -4
- package/packages/datadog-plugin-http/src/client.js +32 -9
- package/packages/datadog-plugin-http2/src/client.js +38 -13
- package/packages/datadog-plugin-next/src/index.js +112 -14
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +5 -3
- package/packages/datadog-plugin-trpc/src/index.js +15 -0
- package/packages/datadog-plugin-trpc/src/procedure.js +48 -0
- package/packages/datadog-plugin-trpc/src/request.js +81 -0
- package/packages/datadog-plugin-undici/src/index.js +22 -7
- package/packages/datadog-turbopack/index.js +4 -28
- package/packages/datadog-turbopack/src/loader.js +14 -452
- package/packages/datadog-webpack/index.js +3 -55
- package/packages/dd-trace/src/aiguard/evaluation.js +62 -1
- package/packages/dd-trace/src/aiguard/sdk.js +8 -2
- package/packages/dd-trace/src/aiguard/tags.js +2 -0
- package/packages/dd-trace/src/appsec/blocking/index.js +4 -0
- package/packages/dd-trace/src/appsec/graphql.js +91 -6
- package/packages/dd-trace/src/appsec/recommended.json +1287 -90
- package/packages/dd-trace/src/before-exit.js +32 -0
- package/packages/dd-trace/src/bootstrap.js +5 -3
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +15 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +12 -34
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +41 -13
- package/packages/dd-trace/src/ci-visibility/exporters/request.js +2 -3
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +1 -2
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +1 -1
- package/packages/dd-trace/src/ci-visibility/telemetry.js +6 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +1 -1
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +9 -134
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache.js +11 -156
- package/packages/dd-trace/src/config/config-types.d.ts +3 -0
- package/packages/dd-trace/src/config/defaults.js +5 -0
- package/packages/dd-trace/src/config/generated-config-types.d.ts +42 -2
- package/packages/dd-trace/src/config/index.js +17 -5
- package/packages/dd-trace/src/config/parsers.js +9 -0
- package/packages/dd-trace/src/config/supported-configurations.json +158 -4
- package/packages/dd-trace/src/constants.js +1 -0
- package/packages/dd-trace/src/debugger/pause-duration-histogram.js +2 -1
- package/packages/dd-trace/src/exporter.js +0 -11
- package/packages/dd-trace/src/exporters/common/request.js +81 -48
- package/packages/dd-trace/src/exporters/common/retry.js +12 -7
- package/packages/dd-trace/src/exporters/common/url.js +1 -1
- package/packages/dd-trace/src/id.js +1 -1
- package/packages/dd-trace/src/lambda/facade.js +74 -0
- package/packages/dd-trace/src/lambda/handler.js +3 -41
- package/packages/dd-trace/src/lambda/index.js +38 -15
- package/packages/dd-trace/src/lambda/runtime/patch.js +19 -3
- package/packages/dd-trace/src/lambda/wrap.js +44 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +2 -0
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +10 -5
- package/packages/dd-trace/src/llmobs/plugins/elevenlabs.js +96 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +19 -6
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +38 -11
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +10 -2
- package/packages/dd-trace/src/llmobs/sdk.js +19 -0
- package/packages/dd-trace/src/llmobs/span_processor.js +9 -0
- package/packages/dd-trace/src/llmobs/tagger.js +22 -0
- package/packages/dd-trace/src/log/channels.js +4 -0
- package/packages/dd-trace/src/log/writer.js +6 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +4 -0
- package/packages/dd-trace/src/openfeature/configuration_source.js +35 -27
- package/packages/dd-trace/src/openfeature/flag-selection.js +152 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +19 -1
- package/packages/dd-trace/src/openfeature/writers/base.js +1 -3
- package/packages/dd-trace/src/opentelemetry/logs/index.js +11 -0
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +7 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +4 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +19 -1
- package/packages/dd-trace/src/opentelemetry/span-ending-hook.js +5 -1
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +6 -1
- package/packages/dd-trace/src/opentelemetry/span.js +2 -2
- package/packages/dd-trace/src/opentelemetry/startup-config.js +174 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +7 -1
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +77 -23
- package/packages/dd-trace/src/opentracing/tracer.js +24 -0
- package/packages/dd-trace/src/otel-thread-ctx.js +28 -31
- package/packages/dd-trace/src/plugin_manager.js +34 -7
- package/packages/dd-trace/src/plugins/ci_plugin.js +41 -10
- package/packages/dd-trace/src/plugins/index.js +6 -0
- package/packages/dd-trace/src/plugins/plugin.js +4 -2
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/ci.js +18 -1
- package/packages/dd-trace/src/plugins/util/git-cache.js +4 -4
- package/packages/dd-trace/src/plugins/util/git.js +263 -82
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +75 -46
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +12 -4
- package/packages/dd-trace/src/plugins/util/status-validator.js +23 -10
- package/packages/dd-trace/src/plugins/util/tags.js +6 -0
- package/packages/dd-trace/src/plugins/util/test.js +64 -39
- package/packages/dd-trace/src/plugins/util/url.js +10 -2
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +2 -2
- package/packages/dd-trace/src/plugins/util/web.js +65 -10
- package/packages/dd-trace/src/profiling/webspan-utils.js +6 -5
- package/packages/dd-trace/src/proxy.js +33 -53
- package/packages/dd-trace/src/span_processor.js +20 -0
- package/packages/dd-trace/src/startup-log.js +8 -6
- package/packages/dd-trace/src/telemetry/metrics.js +2 -1
- package/packages/dd-trace/src/tracer.js +0 -2
- package/packages/dd-trace/src/web-tags-cache.js +8 -9
- package/register.js +2 -1
- package/vendor/dist/@apm-js-collab/code-transformer/LICENSE +489 -0
- package/vendor/dist/@datadog/flagging-core/LICENSE +221 -0
- package/vendor/dist/@datadog/flagging-core/index.js +1 -0
- package/vendor/dist/@datadog/openfeature-node-server/LICENSE +21 -1
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/LICENSE +3 -1
- package/vendor/dist/@datadog/sketches-js/LICENSE +263 -0
- package/vendor/dist/@datadog/source-map/LICENSE +1 -0
- package/vendor/dist/@isaacs/ttlcache/LICENSE +13 -0
- package/vendor/dist/@opentelemetry/core/LICENSE +209 -1
- package/vendor/dist/crypto-randomuuid/LICENSE +3 -0
- package/vendor/dist/escape-string-regexp/LICENSE +13 -0
- package/vendor/dist/esquery/LICENSE +2 -0
- package/vendor/dist/https-proxy-agent/LICENSE +80 -1
- package/vendor/dist/istanbul-lib-coverage/LICENSE +2 -0
- package/vendor/dist/jest-docblock/LICENSE +16 -0
- package/vendor/dist/jsonpath-plus/LICENSE +13 -0
- package/vendor/dist/limiter/LICENSE +2 -0
- package/vendor/dist/lodash.sortby/LICENSE +2 -0
- package/vendor/dist/lru-cache/LICENSE +13 -0
- package/vendor/dist/meriyah/LICENSE +13 -0
- package/vendor/dist/module-details-from-path/LICENSE +2 -0
- package/vendor/dist/mutexify/promise/LICENSE +28 -0
- package/vendor/dist/pprof-format/LICENSE +13 -0
- package/vendor/dist/pprof-format/index.js +1 -1
- package/vendor/dist/protobufjs/LICENSE +219 -0
- package/vendor/dist/protobufjs/minimal/LICENSE +219 -0
- package/vendor/dist/proxy-from-env/LICENSE +13 -0
- package/vendor/dist/retry/LICENSE +2 -0
- package/vendor/dist/rfdc/LICENSE +2 -0
- package/vendor/dist/semifies/LICENSE +3 -1
- package/vendor/dist/shell-quote/LICENSE +3 -1
- package/vendor/dist/source-map/LICENSE +1 -0
- package/vendor/dist/source-map/lib/util/LICENSE +1 -0
- package/vendor/dist/tlhunter-sorted-set/LICENSE +2 -0
- package/vendor/dist/ttl-set/LICENSE +28 -0
- package/ci/diagnose.js +0 -2215
- package/ci/runbook.md +0 -299
- package/ci/test-optimization-validation/approval-artifacts.js +0 -175
- package/ci/test-optimization-validation/approval.js +0 -386
- package/ci/test-optimization-validation/artifact-id.js +0 -18
- package/ci/test-optimization-validation/blocker-category.js +0 -24
- package/ci/test-optimization-validation/bounded-json.js +0 -120
- package/ci/test-optimization-validation/ci-command-candidate.js +0 -77
- package/ci/test-optimization-validation/ci-discovery.js +0 -192
- package/ci/test-optimization-validation/ci-package-scripts.js +0 -169
- package/ci/test-optimization-validation/ci-remediation.js +0 -283
- package/ci/test-optimization-validation/cli.js +0 -954
- package/ci/test-optimization-validation/command-blocker.js +0 -377
- package/ci/test-optimization-validation/command-output-policy.js +0 -188
- package/ci/test-optimization-validation/command-runner.js +0 -649
- package/ci/test-optimization-validation/environment.js +0 -88
- package/ci/test-optimization-validation/executable-approval.js +0 -47
- package/ci/test-optimization-validation/executable.js +0 -244
- package/ci/test-optimization-validation/execution-lock.js +0 -70
- package/ci/test-optimization-validation/framework-adapters/cucumber-validation.json +0 -3
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +0 -767
- package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -99
- package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -175
- package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -513
- package/ci/test-optimization-validation/generated-file-policy.js +0 -63
- package/ci/test-optimization-validation/generated-files.js +0 -425
- package/ci/test-optimization-validation/generated-test-contract.js +0 -284
- package/ci/test-optimization-validation/generated-verifier.js +0 -235
- package/ci/test-optimization-validation/literal-environment.js +0 -56
- package/ci/test-optimization-validation/literal-glob.js +0 -52
- package/ci/test-optimization-validation/manifest-loader.js +0 -116
- package/ci/test-optimization-validation/manifest-scaffold.js +0 -1276
- package/ci/test-optimization-validation/manifest-schema.js +0 -695
- package/ci/test-optimization-validation/offline-fixtures.js +0 -335
- package/ci/test-optimization-validation/offline-output.js +0 -406
- package/ci/test-optimization-validation/package-check.js +0 -97
- package/ci/test-optimization-validation/payload-normalizer.js +0 -72
- package/ci/test-optimization-validation/plan-writer.js +0 -541
- package/ci/test-optimization-validation/preflight-runner.js +0 -186
- package/ci/test-optimization-validation/project-build-artifact.js +0 -31
- package/ci/test-optimization-validation/redaction.js +0 -319
- package/ci/test-optimization-validation/report-writer.js +0 -666
- package/ci/test-optimization-validation/result-semantics.js +0 -103
- package/ci/test-optimization-validation/runner-command.js +0 -264
- package/ci/test-optimization-validation/runner-contract.js +0 -695
- package/ci/test-optimization-validation/safe-files.js +0 -202
- package/ci/test-optimization-validation/scenarios/auto-test-retries.js +0 -171
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -407
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +0 -666
- package/ci/test-optimization-validation/scenarios/early-flake-detection.js +0 -142
- package/ci/test-optimization-validation/scenarios/helpers.js +0 -621
- package/ci/test-optimization-validation/scenarios/test-management.js +0 -219
- package/ci/test-optimization-validation/source-text.js +0 -84
- package/ci/test-optimization-validation/static-diagnosis.js +0 -166
- package/ci/test-optimization-validation/test-output.js +0 -120
- package/ci/test-optimization-validation/validation-blocker.js +0 -21
- package/ci/validate-test-optimization.js +0 -3
- package/packages/datadog-esbuild/src/resolver.js +0 -284
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -156
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -287
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/payload-projection.js +0 -84
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -368
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/writer.js +0 -59
|
@@ -51,19 +51,15 @@ const webTagsCache = require('./web-tags-cache')
|
|
|
51
51
|
* @property {number} endpointIndex
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
|
-
// OTEP-4947 duplicates are last-wins, so
|
|
55
|
-
//
|
|
56
|
-
// record mid-request would still see the interim value (e.g. a bare `GET`) as
|
|
57
|
-
// the endpoint for whatever it was sampling. So a record is built without an
|
|
58
|
-
// endpoint until finalEndpoint (profiling/webspan-utils.js) reports the value
|
|
59
|
-
// settled, and gets one appended when webTagsCache announces that moment.
|
|
54
|
+
// OTEP-4947 duplicates are last-wins, so later endpoint values refine existing
|
|
55
|
+
// records. finalEndpoint excludes bare methods until routing supplies an endpoint.
|
|
60
56
|
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
57
|
+
// Active records are grouped by their web-server tag bag.
|
|
58
|
+
// Every span under one request resolves to that same bag
|
|
63
59
|
// (webTagsCache maps a span to its nearest web-server ancestor's tags) and the
|
|
64
|
-
// endpoint belongs to the request rather than to any one span, so
|
|
65
|
-
//
|
|
66
|
-
//
|
|
60
|
+
// endpoint belongs to the request rather than to any one span, so each change
|
|
61
|
+
// updates the request span's record and each descendant's.
|
|
62
|
+
// Descendants are the reason this cannot just live on the
|
|
67
63
|
// per-span cache entry: the tags:update that carries the route is published for
|
|
68
64
|
// the ancestor, which has no way to enumerate them.
|
|
69
65
|
//
|
|
@@ -73,8 +69,11 @@ const webTagsCache = require('./web-tags-cache')
|
|
|
73
69
|
// a bag, on already-expired spans under manual-GC debug mode — and webTagsCache
|
|
74
70
|
// already depends on it, holding bags the wall profiler dereferences much later.
|
|
75
71
|
//
|
|
76
|
-
//
|
|
72
|
+
// Records rebuilt after finish have no second finish event, so cleanup follows the span's GC lifetime.
|
|
73
|
+
/** @type {WeakMap<ReturnType<DatadogSpanContext['getTags']>, Array<CachedContext>>} */
|
|
77
74
|
const pendingEndpoints = new WeakMap()
|
|
75
|
+
/** @type {FinalizationRegistry<WeakRef<CachedContext>> | undefined} */
|
|
76
|
+
let endpointCleanup
|
|
78
77
|
const NOT_WAITING = -1
|
|
79
78
|
const AWAITING_OWN_ENDPOINT = -2
|
|
80
79
|
|
|
@@ -219,12 +218,15 @@ function getOrBuildContext (span) {
|
|
|
219
218
|
// built before the decision keeps reading as not sampled.
|
|
220
219
|
cached.context = new ThreadContext(traceId, spanId, traceFlagsOf(spanContext), attrs)
|
|
221
220
|
cached.webTags = webTags
|
|
222
|
-
|
|
221
|
+
awaitEndpoint(span, webTags, cached)
|
|
222
|
+
if (spanContext._isFinished) {
|
|
223
|
+
endpointCleanup ??= new FinalizationRegistry(onSpanCollected)
|
|
224
|
+
endpointCleanup.register(span, new WeakRef(cached))
|
|
225
|
+
}
|
|
223
226
|
return cached.context
|
|
224
227
|
}
|
|
225
228
|
|
|
226
|
-
//
|
|
227
|
-
// its request fills it in.
|
|
229
|
+
// Track the request's endpoint until this record finishes or changes ancestry.
|
|
228
230
|
/**
|
|
229
231
|
* @param {DatadogSpan} span
|
|
230
232
|
* @param {CachedContext['webTags']} webTags
|
|
@@ -250,6 +252,12 @@ function awaitEndpoint (span, webTags, cached) {
|
|
|
250
252
|
}
|
|
251
253
|
}
|
|
252
254
|
|
|
255
|
+
/** @param {WeakRef<CachedContext>} reference */
|
|
256
|
+
function onSpanCollected (reference) {
|
|
257
|
+
const cached = reference.deref()
|
|
258
|
+
if (cached !== undefined) removePendingEndpoint(cached)
|
|
259
|
+
}
|
|
260
|
+
|
|
253
261
|
/** @param {CachedContext} cached */
|
|
254
262
|
function removePendingEndpoint (cached) {
|
|
255
263
|
const index = cached.endpointIndex
|
|
@@ -325,9 +333,7 @@ function onSpanFinished (span) {
|
|
|
325
333
|
// would strip trace and endpoint attribution off that work entirely.
|
|
326
334
|
}
|
|
327
335
|
|
|
328
|
-
//
|
|
329
|
-
// still unresolved. `span` is the web-server span, so its tag bag is the key its
|
|
330
|
-
// descendants enlisted under.
|
|
336
|
+
// Update the active records when a request's endpoint becomes available or changes.
|
|
331
337
|
/** @param {DatadogSpan} span */
|
|
332
338
|
function onEndpointResolved (span) {
|
|
333
339
|
if (!started) return
|
|
@@ -337,16 +343,13 @@ function onEndpointResolved (span) {
|
|
|
337
343
|
const waiting = pendingEndpoints.get(webTags)
|
|
338
344
|
if (!ownWaits && waiting === undefined) return
|
|
339
345
|
const endpoint = finalEndpoint(webTags)
|
|
340
|
-
// webTagsCache only announces
|
|
346
|
+
// webTagsCache only announces available endpoints, so this is belt and braces.
|
|
341
347
|
if (endpoint === undefined) return
|
|
342
348
|
if (ownWaits) {
|
|
343
|
-
own.endpointIndex = NOT_WAITING
|
|
344
349
|
appendEndpoint(own.context, endpoint)
|
|
345
350
|
}
|
|
346
351
|
if (waiting === undefined) return
|
|
347
|
-
pendingEndpoints.delete(webTags)
|
|
348
352
|
for (const cached of waiting) {
|
|
349
|
-
cached.endpointIndex = NOT_WAITING
|
|
350
353
|
appendEndpoint(cached.context, endpoint)
|
|
351
354
|
}
|
|
352
355
|
}
|
|
@@ -366,15 +369,9 @@ function onWebTagsResolved (span) {
|
|
|
366
369
|
removePendingEndpoint(cached)
|
|
367
370
|
cached.webTags = webTags
|
|
368
371
|
const endpoint = finalEndpoint(webTags)
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
// there is no way to take the attribute back, and rebuilding the
|
|
373
|
-
// ThreadContext would strand every async-context frame holding this one.
|
|
374
|
-
// The work is still nested in the outer request, which makes that the least
|
|
375
|
-
// wrong of the values available.
|
|
376
|
-
awaitEndpoint(span, webTags, cached)
|
|
377
|
-
} else {
|
|
372
|
+
awaitEndpoint(span, webTags, cached)
|
|
373
|
+
// Keep the outer endpoint until the nearer request supplies a replacement; records are append-only.
|
|
374
|
+
if (endpoint !== undefined) {
|
|
378
375
|
appendEndpoint(cached.context, endpoint)
|
|
379
376
|
}
|
|
380
377
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const { channel } = require('dc-polyfill')
|
|
4
4
|
|
|
5
5
|
const {
|
|
6
|
-
getEnvironmentVariable,
|
|
7
6
|
getValueFromEnvSources,
|
|
8
7
|
isSupportedConfiguration,
|
|
9
8
|
} = require('./config/helper')
|
|
@@ -45,18 +44,15 @@ loadChannel.subscribe(({ name }) => {
|
|
|
45
44
|
|
|
46
45
|
// instrument everything that needs Plugin System V2 instrumentation
|
|
47
46
|
require('../../datadog-instrumentations')
|
|
48
|
-
if (getEnvironmentVariable('AWS_LAMBDA_FUNCTION_NAME') !== undefined) {
|
|
49
|
-
// instrument lambda environment
|
|
50
|
-
require('./lambda')
|
|
51
|
-
}
|
|
52
47
|
|
|
53
48
|
function maybeEnable (Plugin) {
|
|
54
49
|
if (!Plugin || typeof Plugin !== 'function') return
|
|
55
|
-
|
|
50
|
+
const disabled = disabledPlugins.has(Plugin.id)
|
|
51
|
+
if (!pluginClasses[Plugin.id] || disabled) {
|
|
56
52
|
const enabled = getEnabled(Plugin)
|
|
57
53
|
|
|
58
54
|
// TODO: remove the need to load the plugin class in order to disable the plugin
|
|
59
|
-
if (isFalse(enabled) ||
|
|
55
|
+
if (isFalse(enabled) || disabled) {
|
|
60
56
|
log.debug('Plugin "%s" was disabled via configuration option.', Plugin.id)
|
|
61
57
|
|
|
62
58
|
pluginClasses[Plugin.id] = null
|
|
@@ -159,6 +155,10 @@ module.exports = class PluginManager {
|
|
|
159
155
|
for (const name in pluginClasses) {
|
|
160
156
|
this.loadPlugin(name)
|
|
161
157
|
}
|
|
158
|
+
|
|
159
|
+
// Initialization can publish load events that configure plugins immediately; use the current settings.
|
|
160
|
+
const initializeLambda = require('./lambda')
|
|
161
|
+
initializeLambda()
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
// This is basically just for testing. like intrumenter.disable()
|
|
@@ -181,6 +181,7 @@ module.exports = class PluginManager {
|
|
|
181
181
|
#getSharedConfig (name) {
|
|
182
182
|
const {
|
|
183
183
|
logInjection,
|
|
184
|
+
lambda,
|
|
184
185
|
serviceMapping,
|
|
185
186
|
DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP,
|
|
186
187
|
site,
|
|
@@ -209,6 +210,9 @@ module.exports = class PluginManager {
|
|
|
209
210
|
traceWebsocketMessagesSeparateTraces,
|
|
210
211
|
tracing,
|
|
211
212
|
DD_TRACE_RESOURCE_RENAMING_ENABLED,
|
|
213
|
+
DD_APM_FLUSH_DEADLINE_MILLISECONDS,
|
|
214
|
+
DD_API_KEY,
|
|
215
|
+
DD_TRACE_AWS_ADD_SPAN_POINTERS,
|
|
212
216
|
} = /** @type {import('./config/config-base')} */ (this._tracerConfig)
|
|
213
217
|
|
|
214
218
|
const sharedConfig = {
|
|
@@ -267,6 +271,29 @@ module.exports = class PluginManager {
|
|
|
267
271
|
sharedConfig.depth = DD_TRACE_GRAPHQL_DEPTH
|
|
268
272
|
sharedConfig.variables = DD_TRACE_GRAPHQL_VARIABLES
|
|
269
273
|
sharedConfig.errorExtensions = DD_TRACE_GRAPHQL_ERROR_EXTENSIONS
|
|
274
|
+
} else if (name === 'aws-lambda') {
|
|
275
|
+
Object.assign(sharedConfig, {
|
|
276
|
+
addSpanPointers: DD_TRACE_AWS_ADD_SPAN_POINTERS,
|
|
277
|
+
apiKey: DD_API_KEY,
|
|
278
|
+
apiKeyKms: lambda?.DD_KMS_API_KEY,
|
|
279
|
+
apiKeySecretArn: lambda?.DD_API_KEY_SECRET_ARN,
|
|
280
|
+
apmFlushDeadlineMs: DD_APM_FLUSH_DEADLINE_MILLISECONDS,
|
|
281
|
+
captureLambdaPayload: lambda?.DD_CAPTURE_LAMBDA_PAYLOAD,
|
|
282
|
+
captureLambdaPayloadMaxDepth: lambda?.DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH,
|
|
283
|
+
coldStartTraceSkipLib: lambda?.DD_COLD_START_TRACE_SKIP_LIB,
|
|
284
|
+
coldStartTracing: lambda?.DD_COLD_START_TRACING,
|
|
285
|
+
createInferredSpan: lambda?.DD_TRACE_MANAGED_SERVICES,
|
|
286
|
+
dataStreamsEnabled: dsmEnabled,
|
|
287
|
+
decodeAuthorizerContext: lambda?.DD_DECODE_AUTHORIZER_CONTEXT,
|
|
288
|
+
encodeAuthorizerContext: lambda?.DD_ENCODE_AUTHORIZER_CONTEXT,
|
|
289
|
+
enhancedMetrics: lambda?.DD_ENHANCED_METRICS,
|
|
290
|
+
fipsMode: lambda?.DD_LAMBDA_FIPS_MODE,
|
|
291
|
+
logForwarding: lambda?.DD_FLUSH_TO_LOG,
|
|
292
|
+
logInjection,
|
|
293
|
+
mergeXrayTraces: lambda?.DD_MERGE_XRAY_TRACES,
|
|
294
|
+
minColdStartTraceDurationMs: lambda?.DD_MIN_COLD_START_DURATION,
|
|
295
|
+
serviceRepresentationEnabled: lambda?.DD_TRACE_AWS_SERVICE_REPRESENTATION_ENABLED,
|
|
296
|
+
})
|
|
270
297
|
}
|
|
271
298
|
|
|
272
299
|
return sharedConfig
|
|
@@ -24,18 +24,35 @@ const { OS_VERSION, OS_PLATFORM, OS_ARCHITECTURE, RUNTIME_NAME, RUNTIME_VERSION
|
|
|
24
24
|
const {
|
|
25
25
|
CI_PROVIDER_NAME,
|
|
26
26
|
GIT_REPOSITORY_URL,
|
|
27
|
+
GIT_CHECKOUT_ROOT,
|
|
28
|
+
GIT_CHECKOUT_IS_CUSTOM,
|
|
27
29
|
GIT_COMMIT_SHA,
|
|
28
30
|
GIT_BRANCH,
|
|
29
31
|
CI_WORKSPACE_PATH,
|
|
32
|
+
CI_GIT_MERGE_COMMIT_SHA,
|
|
30
33
|
GIT_COMMIT_MESSAGE,
|
|
34
|
+
GIT_COMMIT_AUTHOR_DATE,
|
|
35
|
+
GIT_COMMIT_AUTHOR_NAME,
|
|
36
|
+
GIT_COMMIT_AUTHOR_EMAIL,
|
|
37
|
+
GIT_COMMIT_COMMITTER_DATE,
|
|
38
|
+
GIT_COMMIT_COMMITTER_NAME,
|
|
39
|
+
GIT_COMMIT_COMMITTER_EMAIL,
|
|
31
40
|
GIT_TAG,
|
|
32
41
|
GIT_PULL_REQUEST_BASE_BRANCH_SHA,
|
|
33
42
|
GIT_COMMIT_HEAD_SHA,
|
|
34
43
|
GIT_PULL_REQUEST_BASE_BRANCH,
|
|
35
44
|
GIT_COMMIT_HEAD_MESSAGE,
|
|
36
45
|
} = require('./util/tags')
|
|
46
|
+
const REPOSITORY_METADATA_KEYS = [
|
|
47
|
+
GIT_REPOSITORY_URL, GIT_COMMIT_SHA, GIT_BRANCH, GIT_TAG, GIT_COMMIT_MESSAGE,
|
|
48
|
+
GIT_COMMIT_AUTHOR_DATE, GIT_COMMIT_AUTHOR_NAME, GIT_COMMIT_AUTHOR_EMAIL,
|
|
49
|
+
GIT_COMMIT_COMMITTER_DATE, GIT_COMMIT_COMMITTER_NAME, GIT_COMMIT_COMMITTER_EMAIL,
|
|
50
|
+
GIT_CHECKOUT_ROOT, GIT_CHECKOUT_IS_CUSTOM, CI_WORKSPACE_PATH, CI_GIT_MERGE_COMMIT_SHA,
|
|
51
|
+
]
|
|
52
|
+
|
|
37
53
|
const Plugin = require('./plugin')
|
|
38
54
|
const { getRepositoryRoot } = require('./util/git')
|
|
55
|
+
const { getUserProviderGitMetadata } = require('./util/user-provided-git')
|
|
39
56
|
const {
|
|
40
57
|
getTestEnvironmentMetadata,
|
|
41
58
|
getTestLevelsMetadataTags,
|
|
@@ -420,16 +437,21 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
420
437
|
})
|
|
421
438
|
|
|
422
439
|
this.addSub(`ci:${this.constructor.id}:modified-files`, ({ onDone }) => {
|
|
440
|
+
const isCustomCheckout = this.testEnvironmentMetadata[GIT_CHECKOUT_IS_CUSTOM] === 'true'
|
|
441
|
+
const diffMetadata = isCustomCheckout ? getUserProviderGitMetadata() : this.testEnvironmentMetadata
|
|
423
442
|
const {
|
|
424
443
|
[GIT_PULL_REQUEST_BASE_BRANCH]: pullRequestBaseBranch,
|
|
425
444
|
[GIT_PULL_REQUEST_BASE_BRANCH_SHA]: pullRequestBaseBranchSha,
|
|
426
445
|
[GIT_COMMIT_HEAD_SHA]: commitHeadSha,
|
|
427
|
-
} =
|
|
446
|
+
} = diffMetadata
|
|
447
|
+
const targetCommit = commitHeadSha ||
|
|
448
|
+
(isCustomCheckout ? this.testEnvironmentMetadata[GIT_COMMIT_SHA] : undefined)
|
|
428
449
|
|
|
429
|
-
const baseBranchSha = pullRequestBaseBranchSha ||
|
|
450
|
+
const baseBranchSha = pullRequestBaseBranchSha ||
|
|
451
|
+
getPullRequestBaseBranch(pullRequestBaseBranch, this.repositoryRoot)
|
|
430
452
|
|
|
431
453
|
if (baseBranchSha) {
|
|
432
|
-
const diff = getPullRequestDiff(baseBranchSha,
|
|
454
|
+
const diff = getPullRequestDiff(baseBranchSha, targetCommit, this.repositoryRoot)
|
|
433
455
|
const modifiedFiles = getModifiedFilesFromDiff(diff)
|
|
434
456
|
|
|
435
457
|
if (modifiedFiles) {
|
|
@@ -602,6 +624,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
602
624
|
if (!repositoryRoot || repositoryRoot === this.repositoryRoot) return
|
|
603
625
|
|
|
604
626
|
this.repositoryRoot = repositoryRoot
|
|
627
|
+
if (this.testConfiguration) this.testConfiguration.gitRoot = repositoryRoot
|
|
605
628
|
if (codeOwnersEntries === undefined) {
|
|
606
629
|
this.codeOwnersEntries = getCodeOwnersFileEntries(this.repositoryRoot)
|
|
607
630
|
}
|
|
@@ -640,11 +663,14 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
640
663
|
if (span.name === `${this.constructor.id}.test` || span.name === `${this.constructor.id}.test_suite`) {
|
|
641
664
|
Object.assign(span.meta, getSessionItrSkippingEnabledTags(this.testSessionSpan))
|
|
642
665
|
}
|
|
643
|
-
//
|
|
644
|
-
for (const key
|
|
666
|
+
// Replace worker repository metadata, including fields omitted by the coordinator.
|
|
667
|
+
for (const key of REPOSITORY_METADATA_KEYS) {
|
|
668
|
+
delete span.meta[key]
|
|
669
|
+
}
|
|
670
|
+
for (const key of Object.keys(this.testEnvironmentMetadata)) {
|
|
645
671
|
// CAREFUL: this bypasses the metadata/metrics distinction
|
|
646
672
|
// Be careful not to pass numbers in `meta`
|
|
647
|
-
if (key.startsWith('git.')) {
|
|
673
|
+
if (key.startsWith('git.') || key === CI_WORKSPACE_PATH || key === CI_GIT_MERGE_COMMIT_SHA) {
|
|
648
674
|
span.meta[key] = this.testEnvironmentMetadata[key]
|
|
649
675
|
}
|
|
650
676
|
}
|
|
@@ -811,7 +837,8 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
811
837
|
[RUNTIME_VERSION]: runtimeVersion,
|
|
812
838
|
[GIT_BRANCH]: branch,
|
|
813
839
|
[CI_PROVIDER_NAME]: ciProviderName,
|
|
814
|
-
[
|
|
840
|
+
[GIT_CHECKOUT_ROOT]: gitRoot,
|
|
841
|
+
[GIT_CHECKOUT_IS_CUSTOM]: isCustomCheckout,
|
|
815
842
|
[GIT_COMMIT_MESSAGE]: commitMessage,
|
|
816
843
|
[GIT_TAG]: tag,
|
|
817
844
|
[GIT_PULL_REQUEST_BASE_BRANCH_SHA]: pullRequestBaseSha,
|
|
@@ -819,7 +846,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
819
846
|
[GIT_COMMIT_HEAD_MESSAGE]: commitHeadMessage,
|
|
820
847
|
} = this.testEnvironmentMetadata
|
|
821
848
|
|
|
822
|
-
this.repositoryRoot =
|
|
849
|
+
this.repositoryRoot = gitRoot ||
|
|
823
850
|
(shouldDeferRepositoryRoot ? process.cwd() : getRepositoryRoot() || process.cwd())
|
|
824
851
|
|
|
825
852
|
this.codeOwnersEntries = shouldDeferCodeOwnersEntries ? null : getCodeOwnersFileEntries(this.repositoryRoot)
|
|
@@ -829,6 +856,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
829
856
|
this.testConfiguration = {
|
|
830
857
|
repositoryUrl,
|
|
831
858
|
sha,
|
|
859
|
+
gitRoot: this.repositoryRoot,
|
|
832
860
|
osVersion,
|
|
833
861
|
osPlatform,
|
|
834
862
|
osArchitecture,
|
|
@@ -839,8 +867,11 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
839
867
|
commitMessage,
|
|
840
868
|
tag,
|
|
841
869
|
pullRequestBaseSha,
|
|
842
|
-
|
|
843
|
-
|
|
870
|
+
// Only an explicit PR head can override the selected commit in a custom checkout.
|
|
871
|
+
commitHeadSha: isCustomCheckout === 'true'
|
|
872
|
+
? getUserProviderGitMetadata()[GIT_COMMIT_HEAD_SHA]
|
|
873
|
+
: commitHeadSha,
|
|
874
|
+
commitHeadMessage: isCustomCheckout === 'true' ? undefined : commitHeadMessage,
|
|
844
875
|
}
|
|
845
876
|
}
|
|
846
877
|
|
|
@@ -15,10 +15,12 @@ const plugins = {
|
|
|
15
15
|
get '@supabase/postgrest-js' () { return require('../../../datadog-plugin-supabase/src') },
|
|
16
16
|
get '@supabase/realtime-js' () { return require('../../../datadog-plugin-supabase/src') },
|
|
17
17
|
get '@supabase/storage-js' () { return require('../../../datadog-plugin-supabase/src') },
|
|
18
|
+
get '@trpc/server' () { return require('../../../datadog-plugin-trpc/src') },
|
|
18
19
|
get 'durable-functions' () { return require('../../../datadog-plugin-azure-durable-functions/src') },
|
|
19
20
|
get '@azure/service-bus' () { return require('../../../datadog-plugin-azure-service-bus/src') },
|
|
20
21
|
get '@cucumber/cucumber' () { return require('../../../datadog-plugin-cucumber/src') },
|
|
21
22
|
get '@playwright/test' () { return require('../../../datadog-plugin-playwright/src') },
|
|
23
|
+
get '@elevenlabs/elevenlabs-js' () { return require('../../../datadog-plugin-elevenlabs/src') },
|
|
22
24
|
get '@elastic/elasticsearch' () { return require('../../../datadog-plugin-elasticsearch/src') },
|
|
23
25
|
get '@elastic/transport' () { return require('../../../datadog-plugin-elasticsearch/src') },
|
|
24
26
|
get '@google-cloud/pubsub' () { return require('../../../datadog-plugin-google-cloud-pubsub/src') },
|
|
@@ -47,11 +49,14 @@ const plugins = {
|
|
|
47
49
|
get '@wdio/local-runner' () { return require('../../../datadog-plugin-mocha/src') },
|
|
48
50
|
get '@langchain/langgraph' () { return require('../../../datadog-plugin-langgraph/src') },
|
|
49
51
|
get '@openai/agents' () { return require('../../../datadog-plugin-openai-agents/src') },
|
|
52
|
+
get '@openai/agents-realtime' () { return require('../../../datadog-plugin-openai/src') },
|
|
50
53
|
get aerospike () { return require('../../../datadog-plugin-aerospike/src') },
|
|
51
54
|
get ai () { return require('../../../datadog-plugin-ai/src') },
|
|
52
55
|
get amqp10 () { return require('../../../datadog-plugin-amqp10/src') },
|
|
53
56
|
get amqplib () { return require('../../../datadog-plugin-amqplib/src') },
|
|
57
|
+
get 'async-mutex' () { return require('../../../datadog-plugin-async-mutex/src') },
|
|
54
58
|
get avsc () { return require('../../../datadog-plugin-avsc/src') },
|
|
59
|
+
get 'aws-lambda' () { return require('../../../datadog-plugin-aws-lambda/src') },
|
|
55
60
|
get 'aws-sdk' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
56
61
|
get 'browser-bunyan' () { return require('../../../datadog-plugin-browser-bunyan/src') },
|
|
57
62
|
get bullmq () { return require('../../../datadog-plugin-bullmq/src') },
|
|
@@ -66,6 +71,7 @@ const plugins = {
|
|
|
66
71
|
get 'dd-trace-api' () { return require('../../../datadog-plugin-dd-trace-api/src') },
|
|
67
72
|
get elasticsearch () { return require('../../../datadog-plugin-elasticsearch/src') },
|
|
68
73
|
get electron () { return require('../../../datadog-plugin-electron/src') },
|
|
74
|
+
get elevenlabs () { return require('../../../datadog-plugin-elevenlabs/src') },
|
|
69
75
|
get express () { return require('../../../datadog-plugin-express/src') },
|
|
70
76
|
get fastify () { return require('../../../datadog-plugin-fastify/src') },
|
|
71
77
|
get 'find-my-way' () { return require('../../../datadog-plugin-find-my-way/src') },
|
|
@@ -109,8 +109,9 @@ module.exports = class Plugin {
|
|
|
109
109
|
/**
|
|
110
110
|
* Subscribe to a diagnostic channel with automatic error handling and enable/disable lifecycle.
|
|
111
111
|
*
|
|
112
|
+
* @template T
|
|
112
113
|
* @param {string} channelName Diagnostic channel name.
|
|
113
|
-
* @param {(message:
|
|
114
|
+
* @param {(message: T, name: string) => unknown} handler Handler invoked on messages.
|
|
114
115
|
*/
|
|
115
116
|
addSub (channelName, handler) {
|
|
116
117
|
const wrappedHandler = (message, name) => {
|
|
@@ -128,8 +129,9 @@ module.exports = class Plugin {
|
|
|
128
129
|
/**
|
|
129
130
|
* Bind the tracer store to a diagnostic channel with a transform function.
|
|
130
131
|
*
|
|
132
|
+
* @template T
|
|
131
133
|
* @param {string} channelName Diagnostic channel name.
|
|
132
|
-
* @param {(data:
|
|
134
|
+
* @param {(data: T) => object} transform Transform to compute the bound store.
|
|
133
135
|
*/
|
|
134
136
|
addBind (channelName, transform) {
|
|
135
137
|
this._bindings.push(new StoreBinding(channelName, transform))
|
|
@@ -203,7 +203,7 @@ class TracingPlugin extends Plugin {
|
|
|
203
203
|
* @param {import('../tracer')} [options.tracer] - The tracer.
|
|
204
204
|
* @param {object} [options.config] - The config for the span.
|
|
205
205
|
*
|
|
206
|
-
* @param {boolean | object} enterOrCtx -
|
|
206
|
+
* @param {boolean | { parentStore?: object, currentStore?: object }} enterOrCtx - Enter the span or bind a context.
|
|
207
207
|
*/
|
|
208
208
|
startSpan (name, options = {}, enterOrCtx = true) {
|
|
209
209
|
// TODO: modularize this code to a helper function
|
|
@@ -23,6 +23,7 @@ const {
|
|
|
23
23
|
CI_PIPELINE_URL,
|
|
24
24
|
CI_PROVIDER_NAME,
|
|
25
25
|
CI_WORKSPACE_PATH,
|
|
26
|
+
CI_GIT_MERGE_COMMIT_SHA,
|
|
26
27
|
CI_JOB_URL,
|
|
27
28
|
CI_JOB_NAME,
|
|
28
29
|
CI_STAGE_NAME,
|
|
@@ -78,7 +79,7 @@ function normalizeRef (ref) {
|
|
|
78
79
|
if (!ref) {
|
|
79
80
|
return ref
|
|
80
81
|
}
|
|
81
|
-
return ref.replaceAll(/origin\/|refs\/heads\/|tags\//g, '')
|
|
82
|
+
return ref.replaceAll(/origin\/|refs\/heads\/|refs\/tags\/|tags\//g, '')
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
function resolveTilde (filePath) {
|
|
@@ -373,6 +374,7 @@ module.exports = {
|
|
|
373
374
|
CI_MERGE_REQUEST_IID,
|
|
374
375
|
CI_MERGE_REQUEST_TARGET_BRANCH_SHA,
|
|
375
376
|
CI_MERGE_REQUEST_DIFF_BASE_SHA,
|
|
377
|
+
CI_MERGE_REQUEST_EVENT_TYPE,
|
|
376
378
|
} = env
|
|
377
379
|
|
|
378
380
|
const { name, email } = parseEmailAndName(CI_COMMIT_AUTHOR)
|
|
@@ -408,6 +410,10 @@ module.exports = {
|
|
|
408
410
|
[GIT_PULL_REQUEST_BASE_BRANCH_SHA]: CI_MERGE_REQUEST_DIFF_BASE_SHA,
|
|
409
411
|
[GIT_PULL_REQUEST_BASE_BRANCH_HEAD_SHA]: CI_MERGE_REQUEST_TARGET_BRANCH_SHA,
|
|
410
412
|
}
|
|
413
|
+
if (CI_MERGE_REQUEST_IID &&
|
|
414
|
+
(CI_MERGE_REQUEST_EVENT_TYPE === 'merged_result' || CI_MERGE_REQUEST_EVENT_TYPE === 'merge_train')) {
|
|
415
|
+
tags[CI_GIT_MERGE_COMMIT_SHA] = CI_COMMIT_SHA
|
|
416
|
+
}
|
|
411
417
|
}
|
|
412
418
|
|
|
413
419
|
if (env.CIRCLECI) {
|
|
@@ -504,6 +510,9 @@ module.exports = {
|
|
|
504
510
|
}),
|
|
505
511
|
[CI_JOB_ID]: GITHUB_JOB_ID ?? GITHUB_JOB,
|
|
506
512
|
}
|
|
513
|
+
if (/^refs\/pull\/\d+\/merge$/.test(GITHUB_REF || '')) {
|
|
514
|
+
tags[CI_GIT_MERGE_COMMIT_SHA] = GITHUB_SHA
|
|
515
|
+
}
|
|
507
516
|
if (GITHUB_BASE_REF) { // `pull_request` or `pull_request_target` event
|
|
508
517
|
tags[GIT_PULL_REQUEST_BASE_BRANCH] = GITHUB_BASE_REF
|
|
509
518
|
try {
|
|
@@ -583,6 +592,7 @@ module.exports = {
|
|
|
583
592
|
SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI,
|
|
584
593
|
BUILD_REPOSITORY_URI,
|
|
585
594
|
BUILD_SOURCEVERSION,
|
|
595
|
+
BUILD_REASON,
|
|
586
596
|
BUILD_REQUESTEDFORID,
|
|
587
597
|
BUILD_REQUESTEDFOREMAIL,
|
|
588
598
|
BUILD_SOURCEVERSIONMESSAGE,
|
|
@@ -614,6 +624,9 @@ module.exports = {
|
|
|
614
624
|
[GIT_PULL_REQUEST_BASE_BRANCH]: SYSTEM_PULLREQUEST_TARGETBRANCH,
|
|
615
625
|
[CI_JOB_ID]: SYSTEM_JOBID,
|
|
616
626
|
}
|
|
627
|
+
if (BUILD_REASON === 'PullRequest' && /^refs\/pull\/\d+\/merge$/.test(BUILD_SOURCEBRANCH || '')) {
|
|
628
|
+
tags[CI_GIT_MERGE_COMMIT_SHA] = BUILD_SOURCEVERSION
|
|
629
|
+
}
|
|
617
630
|
|
|
618
631
|
if (SYSTEM_TEAMFOUNDATIONSERVERURI && SYSTEM_TEAMPROJECTID && BUILD_BUILDID) {
|
|
619
632
|
const baseUrl =
|
|
@@ -772,6 +785,7 @@ module.exports = {
|
|
|
772
785
|
TRAVIS_COMMIT_MESSAGE,
|
|
773
786
|
TRAVIS_PULL_REQUEST,
|
|
774
787
|
TRAVIS_PULL_REQUEST_SHA,
|
|
788
|
+
TRAVIS_EVENT_TYPE,
|
|
775
789
|
} = env
|
|
776
790
|
|
|
777
791
|
tags = {
|
|
@@ -791,6 +805,9 @@ module.exports = {
|
|
|
791
805
|
[GIT_PULL_REQUEST_BASE_BRANCH]: TRAVIS_BRANCH,
|
|
792
806
|
[PR_NUMBER]: TRAVIS_PULL_REQUEST,
|
|
793
807
|
}
|
|
808
|
+
if (TRAVIS_EVENT_TYPE === 'pull_request' && /^\d+$/.test(TRAVIS_PULL_REQUEST || '')) {
|
|
809
|
+
tags[CI_GIT_MERGE_COMMIT_SHA] = TRAVIS_COMMIT
|
|
810
|
+
}
|
|
794
811
|
}
|
|
795
812
|
|
|
796
813
|
if (env.BUDDY) {
|
|
@@ -41,9 +41,9 @@ function ensureCacheDir () {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function getCacheKey (cmd, flags) {
|
|
45
|
-
//
|
|
46
|
-
const commandString =
|
|
44
|
+
function getCacheKey (cmd, flags, cwd = process.cwd()) {
|
|
45
|
+
// Commands in independent checkouts must not share cached output.
|
|
46
|
+
const commandString = JSON.stringify([path.resolve(cwd), cmd, flags])
|
|
47
47
|
return crypto.createHash('sha256').update(commandString).digest('hex')
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -85,7 +85,7 @@ function cachedExec (cmd, flags, options) {
|
|
|
85
85
|
if (!ensureCacheDir()) {
|
|
86
86
|
return cp.execFileSync(cmd, flags, options)
|
|
87
87
|
}
|
|
88
|
-
const cacheKey = getCacheKey(cmd, flags)
|
|
88
|
+
const cacheKey = getCacheKey(cmd, flags, options.cwd)
|
|
89
89
|
const cachedResult = getCache(cacheKey)
|
|
90
90
|
if (cachedResult !== undefined) {
|
|
91
91
|
if (cachedResult.startsWith('__GIT_COMMAND_FAILED__')) {
|