autotel-cloudflare 16.0.1 → 18.0.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/dist/actors.js CHANGED
@@ -815,10 +815,11 @@ function instrumentActor(actorClass, config) {
815
815
  capturePersistEvents: true
816
816
  };
817
817
  return wrap(actorClass, { construct(target, [state, env]) {
818
- const actorOptions = readProperty(typeof config === "function" ? config(env, {
818
+ const resolvedConfig = typeof config === "function" ? config(env, {
819
819
  id: state.id.toString(),
820
820
  name: state.id.name
821
- }) : config, "actors");
821
+ }) : config;
822
+ const actorOptions = readProperty(resolvedConfig, "actors");
822
823
  const options = {
823
824
  ...defaultOptions,
824
825
  ...actorOptions
@@ -827,7 +828,8 @@ function instrumentActor(actorClass, config) {
827
828
  id: state.id.toString(),
828
829
  name: state.id.name
829
830
  };
830
- const context$1 = setConfig(initialiser(env, trigger));
831
+ const telemetryConfig = initialiser(env, trigger);
832
+ const context$1 = setConfig(telemetryConfig);
831
833
  return instrumentActorInstance(context.with(context$1, () => {
832
834
  return new target(state, env);
833
835
  }), state, env, actorClass, options);
@@ -886,7 +888,8 @@ function getTracer() {
886
888
  function tracedHandler(actorClass, config) {
887
889
  const initialiser = createInitialiser(config);
888
890
  return { async fetch(request, env, _ctx) {
889
- const configContext = setConfig(initialiser(env, { type: "http" }));
891
+ const telemetryConfig = initialiser(env, { type: "http" });
892
+ const configContext = setConfig(telemetryConfig);
890
893
  const parentContext = propagation.extract(configContext, request.headers);
891
894
  const tracer = getTracer();
892
895
  const url = new URL(request.url);
@@ -990,7 +993,8 @@ function tracedHandler(actorClass, config) {
990
993
  function wrapHandler(originalHandler, config) {
991
994
  const initialiser = createInitialiser(config);
992
995
  return { async fetch(request, env, ctx) {
993
- const configContext = setConfig(initialiser(env, { type: "http" }));
996
+ const telemetryConfig = initialiser(env, { type: "http" });
997
+ const configContext = setConfig(telemetryConfig);
994
998
  const parentContext = propagation.extract(configContext, request.headers);
995
999
  const tracer = getTracer();
996
1000
  const url = new URL(request.url);
package/dist/agents.js CHANGED
@@ -183,7 +183,6 @@ function getDefaultAttributes(event) {
183
183
  setIfPresent(attrs, "agent.mcp.url", event.payload.url);
184
184
  setIfPresent(attrs, "agent.mcp.state", event.payload.state);
185
185
  setIfPresent(attrs, "agent.mcp.capability", event.payload.capability);
186
- break;
187
186
  }
188
187
  for (const [key, value] of Object.entries(event.payload)) setIfPresent(attrs, `agent.payload.${key}`, value);
189
188
  return attrs;
@@ -685,7 +685,8 @@ function instrumentD1(d1, databaseName) {
685
685
  if (prop === "prepare" && method) return new Proxy(method, { apply: (fnTarget, _thisArg, args) => {
686
686
  const [query] = trapArgs(args);
687
687
  const tracer = workerTracer("autotel-edge");
688
- return wrap(fnTarget.apply(target, args), { get(target, prop) {
688
+ const prepared = fnTarget.apply(target, args);
689
+ return wrap(prepared, { get(target, prop) {
689
690
  const value = member(target, prop);
690
691
  const method = asFunction(value);
691
692
  if (method && (prop === "first" || prop === "run" || prop === "all" || prop === "raw")) return new Proxy(method, { apply: (fnTarget, _thisArg, args) => {
package/dist/bindings.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as instrumentKV, c as instrumentImages, d as instrumentHyperdrive, f as instrumentVectorize, i as instrumentD1, l as instrumentAnalyticsEngine, n as instrumentRateLimiter, o as instrumentR2, p as instrumentAI, r as instrumentBindings, s as instrumentServiceBinding, t as instrumentBrowserRendering, u as instrumentQueueProducer } from "./bindings-BzekkOXx.js";
1
+ import { a as instrumentKV, c as instrumentImages, d as instrumentHyperdrive, f as instrumentVectorize, i as instrumentD1, l as instrumentAnalyticsEngine, n as instrumentRateLimiter, o as instrumentR2, p as instrumentAI, r as instrumentBindings, s as instrumentServiceBinding, t as instrumentBrowserRendering, u as instrumentQueueProducer } from "./bindings-BK2AmtNc.js";
2
2
 
3
3
  export { instrumentAI, instrumentAnalyticsEngine, instrumentBindings, instrumentBrowserRendering, instrumentD1, instrumentHyperdrive, instrumentImages, instrumentKV, instrumentQueueProducer, instrumentR2, instrumentRateLimiter, instrumentServiceBinding, instrumentVectorize };
@@ -156,7 +156,8 @@ function instrumentDO(doClass, config) {
156
156
  id: state.id.toString(),
157
157
  name: state.id.name
158
158
  };
159
- const context$2 = setConfig(initialiser(env, trigger));
159
+ const doConfig = initialiser(env, trigger);
160
+ const context$2 = setConfig(doConfig);
160
161
  return instrumentDOInstance(context.with(context$2, () => {
161
162
  return new target(state, env);
162
163
  }), state, env, doClass);
@@ -368,10 +369,11 @@ function instrumentWorkflow(workflowClass, workflowName, config) {
368
369
  const initialiser = createInitialiser(config);
369
370
  return wrap(workflowClass, { construct(target, args) {
370
371
  const env = args[args.length - 1] || {};
371
- const context$1 = setConfig(initialiser(env, {
372
+ const workflowConfig = initialiser(env, {
372
373
  type: "workflow",
373
374
  name: workflowName
374
- }));
375
+ });
376
+ const context$1 = setConfig(workflowConfig);
375
377
  return instrumentWorkflowInstance(context.with(context$1, () => {
376
378
  return new target(...args);
377
379
  }), workflowName, workflowClass);
package/dist/handlers.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as instrumentDO, t as instrumentWorkflow } from "./handlers-avm65CVU.js";
1
+ import { n as instrumentDO, t as instrumentWorkflow } from "./handlers-4X_6aEtg.js";
2
2
 
3
3
  export { instrumentDO, instrumentWorkflow };
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ import { a as getWorkflowLogger, i as getRequestLogger, n as getActorLogger, r a
3
3
  import { n as isNativeTracingAvailable, t as getNativeTracerFromCtx } from "./native-tracing-D0EyAtsF.js";
4
4
  import { a as unwrap, o as wrap, r as proxyExecutionContext, t as toException } from "./exception-D3xOCdBW.js";
5
5
  import { t as workerTracer } from "./tracer-z8zwRBVS.js";
6
- import { a as instrumentKV, c as instrumentImages, d as instrumentHyperdrive, f as instrumentVectorize, i as instrumentD1, l as instrumentAnalyticsEngine, n as instrumentRateLimiter, o as instrumentR2, p as instrumentAI, r as instrumentBindings, s as instrumentServiceBinding, t as instrumentBrowserRendering, u as instrumentQueueProducer } from "./bindings-BzekkOXx.js";
7
- import { n as instrumentDO, t as instrumentWorkflow } from "./handlers-avm65CVU.js";
6
+ import { a as instrumentKV, c as instrumentImages, d as instrumentHyperdrive, f as instrumentVectorize, i as instrumentD1, l as instrumentAnalyticsEngine, n as instrumentRateLimiter, o as instrumentR2, p as instrumentAI, r as instrumentBindings, s as instrumentServiceBinding, t as instrumentBrowserRendering, u as instrumentQueueProducer } from "./bindings-BK2AmtNc.js";
7
+ import { n as instrumentDO, t as instrumentWorkflow } from "./handlers-4X_6aEtg.js";
8
8
  import { WorkerTracer, WorkerTracerProvider, createInitialiser, ensureGlobalContextManager, getActiveConfig, getServiceForPath, setConfig, shouldInstrumentPath, withNativeTracer } from "autotel-edge";
9
9
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
10
10
  import { resourceFromAttributes } from "@opentelemetry/resources";
@@ -526,7 +526,8 @@ let warnedMissingNative = false;
526
526
  function resolveNativeTracer(config, ctx, trigger) {
527
527
  const mode = config.nativeTracing ?? "auto";
528
528
  if (mode === "off") return null;
529
- const nativeTracer = getNativeTracerFromCtx(ctx, (trigger instanceof Request ? trigger.headers.get("cf-ray") : null) ?? crypto.randomUUID());
529
+ const correlationId = (trigger instanceof Request ? trigger.headers.get("cf-ray") : null) ?? crypto.randomUUID();
530
+ const nativeTracer = getNativeTracerFromCtx(ctx, correlationId);
530
531
  if (!nativeTracer && mode === "on" && !warnedMissingNative) {
531
532
  warnedMissingNative = true;
532
533
  console.warn("[autotel-cloudflare] nativeTracing is 'on' but Cloudflare native tracing was not detected. Enable observability.traces in your Wrangler config (and use a recent compatibility_date). Falling back to the autotel OTLP exporter.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel-cloudflare",
3
- "version": "16.0.1",
3
+ "version": "18.0.0",
4
4
  "description": "The #1 OpenTelemetry package for Cloudflare Workers - complete bindings coverage, native CF OTel integration, advanced sampling",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -82,7 +82,7 @@
82
82
  "peerDependencies": {
83
83
  "@cloudflare/workers-types": "^5.20260728.1",
84
84
  "autotel-edge": "5.1.1",
85
- "autotel-genai": "0.13.1"
85
+ "autotel-genai": "0.15.0"
86
86
  },
87
87
  "peerDependenciesMeta": {
88
88
  "autotel-edge": {
@@ -97,7 +97,7 @@
97
97
  "@opentelemetry/context-async-hooks": "^2.11.0",
98
98
  "@types/node": "^26.1.2",
99
99
  "autotel-edge": "5.1.1",
100
- "autotel-genai": "0.13.1",
100
+ "autotel-genai": "0.15.0",
101
101
  "rimraf": "^6.1.3",
102
102
  "tsdown": "^0.22.14",
103
103
  "typescript": "^6.0.3",