@rocketflare/houston-otel 0.1.0 → 0.1.1

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/houston.d.ts CHANGED
@@ -3,7 +3,7 @@ import { type Attributes, type AttributeValue, type SeverityName, type SpanData,
3
3
  /** `telemetry.sdk.name` and the instrumentation scope name. */
4
4
  export declare const SDK_NAME = "@rocketflare/houston-otel";
5
5
  /** `telemetry.sdk.version`; kept equal to package.json's version by a test. */
6
- export declare const SDK_VERSION = "0.1.0";
6
+ export declare const SDK_VERSION = "0.1.1";
7
7
  /** What `createHouston` needs. `houstonOptionsFromEnv` builds it from a Worker's env. */
8
8
  export interface HoustonOptions {
9
9
  /** houston's origin, e.g. `https://houston.example.com`; `/v1/logs` and `/v1/traces` are appended. */
package/dist/houston.js CHANGED
@@ -7,7 +7,7 @@ import { logsRequest, SEVERITY_NUMBER, tracesRequest, } from './otlp.js';
7
7
  /** `telemetry.sdk.name` and the instrumentation scope name. */
8
8
  export const SDK_NAME = '@rocketflare/houston-otel';
9
9
  /** `telemetry.sdk.version`; kept equal to package.json's version by a test. */
10
- export const SDK_VERSION = '0.1.0';
10
+ export const SDK_VERSION = '0.1.1';
11
11
  const DEFAULTS = { maxBatchSize: 500, maxQueueSize: 5_000, timeoutMs: 10_000 };
12
12
  const ZERO_TRACE = '0'.repeat(32);
13
13
  const ZERO_SPAN = '0'.repeat(16);
@@ -106,23 +106,27 @@ export function withStep(houston, name, fn, options = {}) {
106
106
  export function tracedStep(houston, step, options = {}) {
107
107
  if (!houston.enabled)
108
108
  return step;
109
- const original = step.do;
109
+ const call = (name, ...rest) => step.do(name, ...rest);
110
110
  const traced = (name, ...rest) => {
111
111
  const at = rest.length - 1;
112
112
  const fn = rest[at];
113
113
  if (typeof fn !== 'function')
114
- return original.call(step, name, ...rest);
114
+ return call(name, ...rest);
115
115
  const args = [...rest];
116
116
  args[at] = () => withStep(houston, name, () => fn(), options);
117
- return original.call(step, name, ...args);
117
+ return call(name, ...args);
118
118
  };
119
- // methods bound to the real step: a runtime object may keep private state a proxy receiver can't reach
119
+ // Methods are called on the real step as `step[key](...)`, never through `.call`/`.bind`: the runtime's
120
+ // WorkflowStep is an RPC stub, which treats `do.call` as a remote method named `call`. It may also keep private
121
+ // state a proxy receiver can't reach.
120
122
  return new Proxy(step, {
121
123
  get(target, key) {
122
124
  if (key === 'do')
123
125
  return traced;
124
126
  const value = Reflect.get(target, key);
125
- return typeof value === 'function' ? value.bind(target) : value;
127
+ return typeof value === 'function'
128
+ ? (...args) => target[key](...args)
129
+ : value;
126
130
  },
127
131
  });
128
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocketflare/houston-otel",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Logs, request spans, SQL spans and gen_ai spans from Cloudflare Workers to houston over OTLP/HTTP JSON, batched in waitUntil, with no runtime dependencies",
5
5
  "license": "MIT",
6
6
  "type": "module",