@aws/durable-execution-sdk-js-otel 0.1.1 → 1.1.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 +523 -175
- package/dist/execution-plugin.mjs +539 -0
- package/dist/execution-plugin.mjs.map +1 -0
- package/dist/global-id-generator.mjs +648 -0
- package/dist/global-id-generator.mjs.map +1 -0
- package/dist/index.mjs +8 -537
- package/dist/index.mjs.map +1 -1
- package/dist/invocation-plugin.mjs +661 -0
- package/dist/invocation-plugin.mjs.map +1 -0
- package/dist/otel-execution.mjs +15 -0
- package/dist/otel-execution.mjs.map +1 -0
- package/dist/otel-invocation.mjs +16 -0
- package/dist/otel-invocation.mjs.map +1 -0
- package/dist-cjs/execution-plugin.js +541 -0
- package/dist-cjs/execution-plugin.js.map +1 -0
- package/dist-cjs/global-id-generator.js +664 -0
- package/dist-cjs/global-id-generator.js.map +1 -0
- package/dist-cjs/index.js +19 -540
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/invocation-plugin.js +663 -0
- package/dist-cjs/invocation-plugin.js.map +1 -0
- package/dist-cjs/otel-execution.js +17 -0
- package/dist-cjs/otel-execution.js.map +1 -0
- package/dist-cjs/otel-invocation.js +18 -0
- package/dist-cjs/otel-invocation.js.map +1 -0
- package/dist-types/context-extractors.d.ts +70 -2
- package/dist-types/context-extractors.d.ts.map +1 -1
- package/dist-types/deterministic-id-generator.d.ts +56 -31
- package/dist-types/deterministic-id-generator.d.ts.map +1 -1
- package/dist-types/execution-plugin-provider.d.ts +7 -0
- package/dist-types/execution-plugin-provider.d.ts.map +1 -0
- package/dist-types/execution-plugin.d.ts +78 -0
- package/dist-types/execution-plugin.d.ts.map +1 -0
- package/dist-types/execution-trace-context.d.ts +131 -0
- package/dist-types/execution-trace-context.d.ts.map +1 -0
- package/dist-types/global-id-generator.d.ts +12 -0
- package/dist-types/global-id-generator.d.ts.map +1 -0
- package/dist-types/global-sampler.d.ts +25 -0
- package/dist-types/global-sampler.d.ts.map +1 -0
- package/dist-types/index.d.ts +6 -3
- package/dist-types/index.d.ts.map +1 -1
- package/dist-types/invocation-plugin-provider.d.ts +7 -0
- package/dist-types/invocation-plugin-provider.d.ts.map +1 -0
- package/dist-types/invocation-plugin.d.ts +89 -0
- package/dist-types/invocation-plugin.d.ts.map +1 -0
- package/dist-types/otel-plugin-config.d.ts +66 -0
- package/dist-types/otel-plugin-config.d.ts.map +1 -0
- package/dist-types/otel-plugin-provider.d.ts +21 -0
- package/dist-types/otel-plugin-provider.d.ts.map +1 -0
- package/package.json +26 -15
- package/dist-types/plugin.d.ts +0 -46
- package/dist-types/plugin.d.ts.map +0 -1
- package/dist-types/tsconfig.build.tsbuildinfo +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { DurableInstrumentationPlugin, InvocationInfo, InvocationEndInfo, OperationInfo, OperationEndInfo, AttemptInfo, AttemptEndInfo, OperationChangeInfo } from "@aws/durable-execution-sdk-js";
|
|
2
|
+
import type { DurableExecutionInvocationOutput } from "@aws/durable-execution-sdk-js";
|
|
3
|
+
import type { OtelPluginConfig } from "./otel-plugin-config";
|
|
4
|
+
/**
|
|
5
|
+
* OpenTelemetry instrumentation plugin for durable executions.
|
|
6
|
+
*
|
|
7
|
+
* Implements the DurableInstrumentationPlugin interface to emit distributed
|
|
8
|
+
* traces that correlate across multiple Lambda invocations of a single
|
|
9
|
+
* durable execution.
|
|
10
|
+
*/
|
|
11
|
+
export declare class InvocationOtelPlugin implements DurableInstrumentationPlugin {
|
|
12
|
+
private tracerProvider;
|
|
13
|
+
private tracer;
|
|
14
|
+
private idGenerator;
|
|
15
|
+
private readonly contextExtractor;
|
|
16
|
+
private readonly instrumentationName;
|
|
17
|
+
private readonly usesGlobalProvider;
|
|
18
|
+
private globalIdGeneratorInstalled;
|
|
19
|
+
private durableSampler;
|
|
20
|
+
private tracingEnabled;
|
|
21
|
+
private readonly workflowSpanName;
|
|
22
|
+
private readonly enrichLogger;
|
|
23
|
+
private spanMap;
|
|
24
|
+
private spanStack;
|
|
25
|
+
private invocationSpan;
|
|
26
|
+
private workflowSpan;
|
|
27
|
+
private executionAncestor;
|
|
28
|
+
private executionStartTimestamp;
|
|
29
|
+
private executionArn;
|
|
30
|
+
private executionTraceId;
|
|
31
|
+
private executionTraceFlags;
|
|
32
|
+
private executionSamplingDecision;
|
|
33
|
+
constructor(config?: OtelPluginConfig);
|
|
34
|
+
onInvocationStart(info: InvocationInfo): Promise<void>;
|
|
35
|
+
wrapInvocation(_info: InvocationInfo, fn: () => Promise<DurableExecutionInvocationOutput>): Promise<DurableExecutionInvocationOutput>;
|
|
36
|
+
onInvocationEnd(info: InvocationEndInfo): Promise<void>;
|
|
37
|
+
private ensureGlobalIdGeneratorInstalled;
|
|
38
|
+
private resetInvocationState;
|
|
39
|
+
private startSpan;
|
|
40
|
+
/**
|
|
41
|
+
* The parent context for the Invocation span: the active ambient span when it
|
|
42
|
+
* is on the execution trace, otherwise the execution ancestor so the
|
|
43
|
+
* Invocation span stays within the same trace.
|
|
44
|
+
*/
|
|
45
|
+
private invocationParentContext;
|
|
46
|
+
/**
|
|
47
|
+
* A link to the initial logical operation span, whose span ID is
|
|
48
|
+
* deterministic on (executionArn, operationId) and lives on the execution
|
|
49
|
+
* trace. A continuation or replay segment carries this link so the segments
|
|
50
|
+
* of one logical operation stay correlated across invocations.
|
|
51
|
+
*
|
|
52
|
+
* Because the initial operation span's ID is reproducible, this restores the
|
|
53
|
+
* cross-invocation link that was previously dropped as "fabricated" — it now
|
|
54
|
+
* targets a genuinely exported span (open operation spans are ended on
|
|
55
|
+
* non-terminal invocations; see onInvocationEnd).
|
|
56
|
+
*/
|
|
57
|
+
private initialOperationLink;
|
|
58
|
+
onOperationStart(info: OperationInfo): Promise<void>;
|
|
59
|
+
wrapChildContextFn(info: OperationInfo, fn: () => unknown): unknown;
|
|
60
|
+
onOperationEnd(info: OperationEndInfo): Promise<void>;
|
|
61
|
+
onOperationAttemptStart(info: AttemptInfo): Promise<void>;
|
|
62
|
+
wrapOperationAttemptFn(info: AttemptInfo, fn: () => unknown): unknown;
|
|
63
|
+
onOperationAttemptEnd(info: AttemptEndInfo): Promise<void>;
|
|
64
|
+
onOperationChange(_info: OperationChangeInfo): Promise<void>;
|
|
65
|
+
enrichLogContext(): Record<string, string | number | boolean> | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Link(s) to the execution-scoped Workflow span. Operation and attempt spans
|
|
68
|
+
* carry this link so they correlate to the one Workflow span for the durable
|
|
69
|
+
* execution while remaining parented to the invocation/operation hierarchy.
|
|
70
|
+
* The invocation span itself does NOT carry this link. Returns an empty array
|
|
71
|
+
* if the Workflow span was not created.
|
|
72
|
+
*/
|
|
73
|
+
private workflowLinks;
|
|
74
|
+
/**
|
|
75
|
+
* Links for a continuation or replay operation span: a link back to the
|
|
76
|
+
* initial logical operation span (deterministic on the execution trace)
|
|
77
|
+
* FIRST, then the Workflow link, so the links are ordered
|
|
78
|
+
* `[operation, Workflow]`. Restores the cross-invocation operation
|
|
79
|
+
* correlation that was previously dropped as "fabricated" — the initial span
|
|
80
|
+
* ID is reproducible and the span is genuinely exported. The order matters:
|
|
81
|
+
* the conformance contract resolves `links[0]` to the operation span (which
|
|
82
|
+
* carries `durable.operation.id`) and `links[1]` to the Workflow span (which
|
|
83
|
+
* carries `durable.execution.arn`).
|
|
84
|
+
*/
|
|
85
|
+
private replayLinks;
|
|
86
|
+
private attemptLinks;
|
|
87
|
+
private attemptSpanKey;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=invocation-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocation-plugin.d.ts","sourceRoot":"","sources":["../src/invocation-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,mBAAmB,EACpB,MAAM,+BAA+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OAAO,CAAC,gCAAgC;IAyBxC,OAAO,CAAC,oBAAoB;IAc5B,OAAO,CAAC,SAAS;IAWjB;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAyB/B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,oBAAoB;IAatB,gBAAgB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IA6G1D,kBAAkB,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,OAAO,GAAG,OAAO;IAY7D,cAAc,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IA6IrD,uBAAuB,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA0C/D,sBAAsB,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,OAAO,GAAG,OAAO;IAc/D,qBAAqB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B1D,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlE,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,SAAS;IAgBzE;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IAMrB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,cAAc;CAGvB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { TracerProvider } from "@opentelemetry/api";
|
|
2
|
+
import type { IdGenerator } from "@opentelemetry/sdk-trace-node";
|
|
3
|
+
import type { ContextExtractor } from "./context-extractors";
|
|
4
|
+
/**
|
|
5
|
+
* Creates the plugin's deterministic ID generator, optionally chained to an
|
|
6
|
+
* application-supplied fallback generator.
|
|
7
|
+
*/
|
|
8
|
+
export type IdGeneratorFactory = (fallbackIdGenerator?: IdGenerator) => IdGenerator;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a caller-owned TracerProvider with a deterministic ID generator
|
|
11
|
+
* installed during provider construction.
|
|
12
|
+
*/
|
|
13
|
+
export type TracerProviderFactory = (createIdGenerator: IdGeneratorFactory) => TracerProvider;
|
|
14
|
+
/**
|
|
15
|
+
* Shared configuration options for both ExecutionOtelPlugin and InvocationOtelPlugin.
|
|
16
|
+
*
|
|
17
|
+
* All fields are optional. When no provider factory is supplied, the plugin
|
|
18
|
+
* uses the globally registered TracerProvider.
|
|
19
|
+
*/
|
|
20
|
+
export interface OtelPluginConfig {
|
|
21
|
+
/**
|
|
22
|
+
* Factory for an application-owned TracerProvider. The plugin supplies a
|
|
23
|
+
* function that creates its deterministic ID generator, optionally chained
|
|
24
|
+
* to the application's normal ID generator as a fallback.
|
|
25
|
+
*
|
|
26
|
+
* When omitted, the globally registered provider is used. The application
|
|
27
|
+
* owns initialization, instrumentation, exporters, and shutdown for providers
|
|
28
|
+
* returned by this factory.
|
|
29
|
+
*/
|
|
30
|
+
tracerProviderFactory?: TracerProviderFactory;
|
|
31
|
+
/**
|
|
32
|
+
* Context extractor function used to extract upstream trace context
|
|
33
|
+
* from the invocation environment. Defaults to `xRayContextExtractor`.
|
|
34
|
+
* A custom extractor must return the durable execution's own trace context:
|
|
35
|
+
* a valid trace ID (and, for a remote parent, a valid parent span ID) anchors
|
|
36
|
+
* the execution trace across replays, so returning stale or per-invocation
|
|
37
|
+
* context would displace the correct execution trace.
|
|
38
|
+
*/
|
|
39
|
+
contextExtractor?: ContextExtractor;
|
|
40
|
+
/**
|
|
41
|
+
* Instrumentation scope name used when creating tracers.
|
|
42
|
+
* Defaults to `"aws-durable-execution-sdk-js"`.
|
|
43
|
+
*/
|
|
44
|
+
instrumentationName?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Custom name for the root Workflow span.
|
|
47
|
+
* Defaults to `"Workflow"`.
|
|
48
|
+
*/
|
|
49
|
+
workflowSpanName?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Whether `enrichLogContext()` contributes the active OTel trace context
|
|
52
|
+
* (`traceId`, `spanId`, `otelTraceSampled`) to each durable log record.
|
|
53
|
+
*
|
|
54
|
+
* When `true` (default), every log line emitted through the durable logger is
|
|
55
|
+
* stamped with the current span context for log/trace correlation. Set to
|
|
56
|
+
* `false` to disable the extra fields (e.g. to avoid duplicating context that
|
|
57
|
+
* a separate log-instrumentation layer already injects, or to keep log output
|
|
58
|
+
* minimal). Mirrors Python's `enrich_logger` and Java's `enableMdc`.
|
|
59
|
+
*/
|
|
60
|
+
enrichLogger?: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated Use `OtelPluginConfig` instead.
|
|
64
|
+
*/
|
|
65
|
+
export type ExecutionOtelPluginConfig = OtelPluginConfig;
|
|
66
|
+
//# sourceMappingURL=otel-plugin-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otel-plugin-config.d.ts","sourceRoot":"","sources":["../src/otel-plugin-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,mBAAmB,CAAC,EAAE,WAAW,KAC9B,WAAW,CAAC;AAEjB;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAClC,iBAAiB,EAAE,kBAAkB,KAClC,cAAc,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;OAQG;IACH,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAE9C;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAEpC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TracerProvider } from "@opentelemetry/api";
|
|
2
|
+
import { DeterministicIdGenerator } from "./deterministic-id-generator";
|
|
3
|
+
import type { OtelPluginConfig } from "./otel-plugin-config";
|
|
4
|
+
export interface ProviderResult {
|
|
5
|
+
/** The configured TracerProvider. */
|
|
6
|
+
tracerProvider: TracerProvider;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the provider came from OpenTelemetry's global registration.
|
|
9
|
+
*
|
|
10
|
+
* An explicit factory may return the same object that is globally registered,
|
|
11
|
+
* but it still has application-owned initialization and span behavior.
|
|
12
|
+
*/
|
|
13
|
+
usesGlobalProvider: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolves an application-owned provider factory or the globally registered
|
|
17
|
+
* provider. Exporters, sampling, resources, propagators, instrumentation, and
|
|
18
|
+
* provider shutdown remain application or ADOT responsibilities.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createTracerProvider(config: OtelPluginConfig | undefined, idGenerator: DeterministicIdGenerator): ProviderResult;
|
|
21
|
+
//# sourceMappingURL=otel-plugin-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otel-plugin-provider.d.ts","sourceRoot":"","sources":["../src/otel-plugin-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,cAAc;IAC7B,qCAAqC;IACrC,cAAc,EAAE,cAAc,CAAC;IAC/B;;;;;OAKG;IACH,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,gBAAgB,GAAG,SAAS,EACpC,WAAW,EAAE,wBAAwB,GACpC,cAAc,CAiBhB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws/durable-execution-sdk-js-otel",
|
|
3
3
|
"description": "OpenTelemetry instrumentation plugin for AWS Durable Execution SDK",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -22,15 +22,26 @@
|
|
|
22
22
|
"build:cjs": "rollup --config rollup.config.mjs --environment MODE:cjs",
|
|
23
23
|
"build:types": "tsc --project tsconfig.build.json --outDir dist-types",
|
|
24
24
|
"prepublishOnly": "npm run build && npm run test",
|
|
25
|
-
"lint": "
|
|
26
|
-
"prebuild": "
|
|
27
|
-
"test": "
|
|
25
|
+
"lint": "biome check src --diagnostic-level=error",
|
|
26
|
+
"prebuild": "rm -rf dist dist-cjs dist-types",
|
|
27
|
+
"test": "jest --config jest.config.mjs --collectCoverage --collectCoverageFrom=src/**/*.{ts,js}",
|
|
28
|
+
"lint:fix": "biome check --write src"
|
|
28
29
|
},
|
|
29
30
|
"exports": {
|
|
30
31
|
".": {
|
|
31
32
|
"types": "./dist-types/index.d.ts",
|
|
32
33
|
"import": "./dist/index.mjs",
|
|
33
34
|
"require": "./dist-cjs/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./otel-execution": {
|
|
37
|
+
"types": "./dist-types/execution-plugin-provider.d.ts",
|
|
38
|
+
"import": "./dist/otel-execution.mjs",
|
|
39
|
+
"require": "./dist-cjs/otel-execution.js"
|
|
40
|
+
},
|
|
41
|
+
"./otel-invocation": {
|
|
42
|
+
"types": "./dist-types/invocation-plugin-provider.d.ts",
|
|
43
|
+
"import": "./dist/otel-invocation.mjs",
|
|
44
|
+
"require": "./dist-cjs/otel-invocation.js"
|
|
34
45
|
}
|
|
35
46
|
},
|
|
36
47
|
"files": [
|
|
@@ -39,22 +50,22 @@
|
|
|
39
50
|
"dist-types"
|
|
40
51
|
],
|
|
41
52
|
"devDependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"eslint": "^9.29.0",
|
|
45
|
-
"eslint-config-prettier": "^10.1.5",
|
|
46
|
-
"eslint-plugin-jest": "^29.0.1",
|
|
53
|
+
"@biomejs/biome": "2.5.11",
|
|
54
|
+
"@opentelemetry/core": "^2.0.0",
|
|
47
55
|
"fast-check": "^3.23.2",
|
|
48
|
-
"jest": "^30.
|
|
49
|
-
"typescript": "^
|
|
50
|
-
"typescript-eslint": "^8.34.1"
|
|
56
|
+
"jest": "^30.5.1",
|
|
57
|
+
"typescript": "^6.0.3"
|
|
51
58
|
},
|
|
52
59
|
"peerDependencies": {
|
|
53
|
-
"@aws/durable-execution-sdk-js": ">=2.
|
|
60
|
+
"@aws/durable-execution-sdk-js": ">=2.4.0",
|
|
54
61
|
"@opentelemetry/api": "^1.0.0",
|
|
55
|
-
"@opentelemetry/
|
|
56
|
-
"@opentelemetry/instrumentation-aws-sdk": "^0.74.0",
|
|
62
|
+
"@opentelemetry/core": "^2.0.0",
|
|
57
63
|
"@opentelemetry/sdk-trace-node": "^2.6.1"
|
|
58
64
|
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"@aws/durable-execution-sdk-js": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
59
70
|
"private": false
|
|
60
71
|
}
|
package/dist-types/plugin.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { DurableInstrumentationPlugin, InvocationInfo, InvocationEndInfo, OperationInfo, OperationEndInfo, AttemptInfo, AttemptEndInfo, OperationChangeInfo } from "@aws/durable-execution-sdk-js";
|
|
2
|
-
import type { DurableExecutionInvocationOutput } from "@aws/durable-execution-sdk-js";
|
|
3
|
-
import type { TracerProvider } from "@opentelemetry/api";
|
|
4
|
-
import type { ContextExtractor } from "./context-extractors";
|
|
5
|
-
/**
|
|
6
|
-
* Configuration options for the OtelPlugin.
|
|
7
|
-
*/
|
|
8
|
-
export interface OtelPluginConfig {
|
|
9
|
-
/** Custom TracerProvider. If omitted, the plugin creates one internally. */
|
|
10
|
-
tracerProvider?: TracerProvider;
|
|
11
|
-
/** Context extractor function. Defaults to xRayContextExtractor. */
|
|
12
|
-
contextExtractor?: ContextExtractor;
|
|
13
|
-
/** Instrumentation scope name. Defaults to "aws-durable-execution-sdk-js". */
|
|
14
|
-
instrumentationName?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* OpenTelemetry instrumentation plugin for durable executions.
|
|
18
|
-
*
|
|
19
|
-
* Implements the DurableInstrumentationPlugin interface to emit distributed
|
|
20
|
-
* traces that correlate across multiple Lambda invocations of a single
|
|
21
|
-
* durable execution.
|
|
22
|
-
*/
|
|
23
|
-
export declare class OtelPlugin implements DurableInstrumentationPlugin {
|
|
24
|
-
private readonly tracerProvider;
|
|
25
|
-
private readonly tracer;
|
|
26
|
-
private readonly idGenerator;
|
|
27
|
-
private readonly contextExtractor;
|
|
28
|
-
private spanMap;
|
|
29
|
-
private spanStack;
|
|
30
|
-
private invocationSpan;
|
|
31
|
-
private executionArn;
|
|
32
|
-
private attemptSpan;
|
|
33
|
-
constructor(config?: OtelPluginConfig);
|
|
34
|
-
onInvocationStart(info: InvocationInfo): Promise<void>;
|
|
35
|
-
wrapInvocation(_info: InvocationInfo, fn: () => Promise<DurableExecutionInvocationOutput>): Promise<DurableExecutionInvocationOutput>;
|
|
36
|
-
onInvocationEnd(_info: InvocationEndInfo): Promise<void>;
|
|
37
|
-
onOperationStart(info: OperationInfo): Promise<void>;
|
|
38
|
-
wrapChildContextFn(info: OperationInfo, fn: () => unknown): unknown;
|
|
39
|
-
onOperationEnd(info: OperationEndInfo): Promise<void>;
|
|
40
|
-
onOperationAttemptStart(info: AttemptInfo): Promise<void>;
|
|
41
|
-
wrapOperationAttemptFn(_info: AttemptInfo, fn: () => unknown): unknown;
|
|
42
|
-
onOperationAttemptEnd(info: AttemptEndInfo): Promise<void>;
|
|
43
|
-
onOperationChange(_info: OperationChangeInfo): Promise<void>;
|
|
44
|
-
enrichLogContext(): Record<string, string | number | boolean> | undefined;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,mBAAmB,EACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,oBAAoB,CAAC;AAUvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,8EAA8E;IAC9E,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAID;;;;;;GAMG;AACH,qBAAa,UAAW,YAAW,4BAA4B;IAC7D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA2B;IACvD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;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