@osfactory/otel-hook 0.7.0 → 0.8.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 CHANGED
@@ -121,7 +121,7 @@ provider payload — the result is an identity **conflict**: attribution is decl
121
121
  and nothing is exported, rather than one assertion silently winning.
122
122
 
123
123
  No environment variable sets identity. The `OTEL_HOOK_*` variables and the
124
- standard `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_*HEADERS`,
124
+ standard `OTEL_EXPORTER_OTLP_*ENDPOINT`, `OTEL_EXPORTER_OTLP_*HEADERS`,
125
125
  `OTEL_SERVICE_NAME`, and `OTEL_RESOURCE_ATTRIBUTES` configure the exporter,
126
126
  privacy, detection, and logging only. (A launcher may still put an exported
127
127
  *session key* on the resource — see [Externally supplied session
@@ -669,6 +669,46 @@ Precedence, lowest to highest: `defaults` → `file` → `environment` →
669
669
  layer is rejected rather than partially applied, and the CLI then falls back to
670
670
  `DEFAULT_CONFIG` with a diagnostic rather than exiting.
671
671
 
672
+ ### Exporter endpoints
673
+
674
+ Where each signal is posted, highest precedence first. The first source that is
675
+ set (and not blank) wins:
676
+
677
+ | Signal | Source | Value is |
678
+ | --- | --- | --- |
679
+ | traces | `--endpoint` | full traces URL |
680
+ | traces | `OTEL_HOOK_EXPORTER_ENDPOINT` | full traces URL |
681
+ | traces | `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | full traces URL, used as-is |
682
+ | traces | `OTEL_EXPORTER_OTLP_ENDPOINT` | base URL; `/v1/traces` is appended |
683
+ | traces | `exporter.endpoint` in a config file | full traces URL |
684
+ | logs | `--logs-endpoint` | full logs URL |
685
+ | logs | `OTEL_HOOK_LOGS_ENDPOINT` | full logs URL |
686
+ | logs | `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` | full logs URL, used as-is |
687
+ | logs | `OTEL_EXPORTER_OTLP_ENDPOINT` | base URL; `/v1/logs` is appended (see below) |
688
+ | logs | `exporter.logs.endpoint` in a config file | full logs URL |
689
+ | logs | derived from the resolved traces endpoint | `/v1/traces` swapped for `/v1/logs`, or `/v1/logs` appended |
690
+
691
+ `OTEL_EXPORTER_OTLP_ENDPOINT` follows the OpenTelemetry exporter
692
+ specification: it is a **base** URL, and the signal path is appended to it.
693
+ Trailing slashes are dropped first, so `https://collector.example/otlp/` posts
694
+ traces to `https://collector.example/otlp/v1/traces`. The per-signal
695
+ `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` and `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` are
696
+ full URLs and are used exactly as given.
697
+
698
+ **Compatibility rule.** Releases before this one read `OTEL_EXPORTER_OTLP_ENDPOINT`
699
+ as the full traces URL. A value that already ends in `/v1/traces` (ignoring
700
+ trailing slashes) is therefore still used as-is for traces, and its logs URL is the
701
+ same with `/v1/logs` in place of `/v1/traces`. A full traces URL with any *other*
702
+ path (say `https://collector.example/ingest/traces`) is now a base URL and gets
703
+ `/v1/traces` appended: move such a value to `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`
704
+ or `OTEL_HOOK_EXPORTER_ENDPOINT`.
705
+
706
+ `OTEL_EXPORTER_OTLP_ENDPOINT` sets the logs URL directly only when the traces URL
707
+ came from `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`. In every other case logs are
708
+ derived from whatever traces URL won, which gives the same result for the base
709
+ URL and keeps `--endpoint` and `OTEL_HOOK_EXPORTER_ENDPOINT` carrying both
710
+ signals, as they always have.
711
+
672
712
  ### The logs signal
673
713
 
674
714
  `exporter.logs` is its own sub-object, merged per leaf like everything else, so a
@@ -677,7 +717,7 @@ file may enable the signal while the environment sets only the endpoint:
677
717
  | Field | Default | Flag | Variable |
678
718
  | --- | --- | --- | --- |
679
719
  | `enabled` | `false` | `--logs` / `--no-logs` | `OTEL_HOOK_LOGS_ENABLED` |
680
- | `endpoint` | derived from `endpoint` | `--logs-endpoint` | `OTEL_HOOK_LOGS_ENDPOINT`, then `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` |
720
+ | `endpoint` | derived from `endpoint` | `--logs-endpoint` | `OTEL_HOOK_LOGS_ENDPOINT`, then `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`, then `OTEL_EXPORTER_OTLP_ENDPOINT` (see [Exporter endpoints](#exporter-endpoints)) |
681
721
  | `includeContent` | `false` | `--logs-content` | `OTEL_HOOK_LOGS_INCLUDE_CONTENT` |
682
722
  | `maxBatchSize` | `128` | — | — |
683
723
 
@@ -750,6 +790,29 @@ The provider's own session id is never discarded: it is always exported as
750
790
  only the exported `session.id` attribute; trace and span ids, state, and
751
791
  attribution remain derived from the provider's identity.
752
792
 
793
+ ### Use with a harness (HAR 2.0)
794
+
795
+ A harness that launches coding agents describes each run with the Factory
796
+ Commits telemetry profile on `OTEL_RESOURCE_ATTRIBUTES` (`session.id`,
797
+ `factory.work_unit.id`, `factory.slot.id`, `vcs.*`, and local-only
798
+ `factory.local.*`). otel-hook needs nothing else to export those runs: the
799
+ standard variables are enough, including for direct export to a backend such as
800
+ Langfuse, which takes OTLP/HTTP traces at `/api/public/otel/v1/traces` with Basic
801
+ auth:
802
+
803
+ ```bash
804
+ export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://langfuse.example.com/api/public/otel/v1/traces"
805
+ export OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Basic%20$(printf '%s' "$LANGFUSE_PUBLIC_KEY:$LANGFUSE_SECRET_KEY" | base64 -w0)"
806
+ export OTEL_RESOURCE_ATTRIBUTES="session.id=run-2041,factory.work_unit.id=wu-42,factory.slot.id=3"
807
+ ```
808
+
809
+ - Use the `TRACES_` variables, not the generic ones: Langfuse ingests traces
810
+ only, and the logs signal (off by default) should not be pointed at it.
811
+ - The credential is in an environment variable, never a `--header` flag, so it
812
+ does not show up in `ps`.
813
+ - Langfuse filters on span attributes, which is why `factory.*` and `vcs.*` are
814
+ [copied onto every span](#on-records-too); `factory.local.*` is not.
815
+
753
816
  ### Resource attributes
754
817
 
755
818
  `exporter.resourceAttributes` adds custom attributes to the OTLP Resource every
@@ -809,6 +872,26 @@ invocation that made the observation rather than the one that drained the spool.
809
872
  Custom attributes are re-checked on the way out, so a hand-edited spool file
810
873
  cannot inject one the live path would have refused.
811
874
 
875
+ #### On records, too
876
+
877
+ Some backends index only span and log record attributes, so a value that exists
878
+ only on the Resource cannot be filtered on there. Primitive resource attributes in
879
+ these namespaces are therefore also copied onto every span and log record:
880
+
881
+ - `har.*` — sent by earlier launchers;
882
+ - `factory.*` — the [Factory Commits telemetry
883
+ profile](https://github.com/os-factory/factory-commits/blob/main/profiles/telemetry.md)
884
+ (`factory.work_unit.id`, `factory.slot.id`, …), **except `factory.local.*`**,
885
+ which the profile defines as local-only: it stays on the Resource and is never
886
+ copied onto a record;
887
+ - `vcs.*` — OpenTelemetry VCS attributes. An event's own resolved target worktree
888
+ ([ADR 0008](docs/adr/0008-per-event-worktree-target.md)) still wins for the keys it sets, such as
889
+ `vcs.ref.head.name`.
890
+
891
+ `session.id` is not copied as-is: it is the externally supplied session key
892
+ described above, resolved (and trimmed) on its own. Other attributes, such as
893
+ `deployment.environment`, stay on the Resource only.
894
+
812
895
  Diagnostics report resource attribute **names** only — `doctor --json` shows
813
896
  `exporter.resource_attribute_names`. A name is already on the wire in every
814
897
  exported resource; a value is not disclosed anywhere a name would do.
package/dist/cli.js CHANGED
@@ -1154,6 +1154,29 @@ var errorInfoFromThrown = (thrown, input) => {
1154
1154
  });
1155
1155
  };
1156
1156
 
1157
+ // src/config/otlp-endpoint.ts
1158
+ var OTLP_ENDPOINT_VARIABLES = Object.freeze({
1159
+ generic: "OTEL_EXPORTER_OTLP_ENDPOINT",
1160
+ traces: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT",
1161
+ logs: "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT"
1162
+ });
1163
+ var OTLP_TRACES_PATH = "/v1/traces";
1164
+ var OTLP_LOGS_PATH = "/v1/logs";
1165
+ var withoutTrailingSlashes = (value) => {
1166
+ let end = value.length;
1167
+ while (end > 0 && value.charCodeAt(end - 1) === 47) {
1168
+ end -= 1;
1169
+ }
1170
+ return value.slice(0, end);
1171
+ };
1172
+ var otlpSignalEndpointFromBase = (base, signal) => {
1173
+ const trimmed = withoutTrailingSlashes(base);
1174
+ if (trimmed.endsWith(OTLP_TRACES_PATH)) {
1175
+ return signal === "traces" ? trimmed : `${trimmed.slice(0, trimmed.length - OTLP_TRACES_PATH.length)}${OTLP_LOGS_PATH}`;
1176
+ }
1177
+ return `${trimmed}${signal === "traces" ? OTLP_TRACES_PATH : OTLP_LOGS_PATH}`;
1178
+ };
1179
+
1157
1180
  // src/config/otlp-headers.ts
1158
1181
  var MAX_OTLP_HEADERS = 32;
1159
1182
  var OTLP_HEADER_VARIABLES = Object.freeze({
@@ -1278,7 +1301,13 @@ var describeOtlpHeaderNames = (...sources) => unionOtlpHeaderNames(...sources.ma
1278
1301
  // src/config/environment.ts
1279
1302
  var ENVIRONMENT_VARIABLES = Object.freeze({
1280
1303
  exporterEnabled: "OTEL_HOOK_ENABLED",
1304
+ /** Full traces URL; otel-hook's own variable, above the standard ones. */
1281
1305
  exporterEndpoint: "OTEL_HOOK_EXPORTER_ENDPOINT",
1306
+ /**
1307
+ * Standard base URL: `/v1/traces` and `/v1/logs` are appended per signal. A
1308
+ * value already ending in `/v1/traces` is the legacy full traces URL and is
1309
+ * used as-is (see `otlpSignalEndpointFromBase`).
1310
+ */
1282
1311
  otlpEndpoint: "OTEL_EXPORTER_OTLP_ENDPOINT",
1283
1312
  exporterProtocol: "OTEL_HOOK_EXPORTER_PROTOCOL",
1284
1313
  exporterTimeoutMillis: "OTEL_HOOK_EXPORTER_TIMEOUT_MS",
@@ -1352,7 +1381,10 @@ var parseEnvironmentConfig = (env) => {
1352
1381
  return trimmed === "" ? void 0 : trimmed;
1353
1382
  };
1354
1383
  const exporterEnabled = readBoolean(ENVIRONMENT_VARIABLES.exporterEnabled);
1355
- const endpoint = readString(ENVIRONMENT_VARIABLES.exporterEndpoint) ?? readString(ENVIRONMENT_VARIABLES.otlpEndpoint);
1384
+ const hookEndpoint = readString(ENVIRONMENT_VARIABLES.exporterEndpoint);
1385
+ const otlpTracesEndpoint = readString(OTLP_ENDPOINT_VARIABLES.traces);
1386
+ const otlpBaseEndpoint = readString(ENVIRONMENT_VARIABLES.otlpEndpoint);
1387
+ const endpoint = hookEndpoint ?? otlpTracesEndpoint ?? (otlpBaseEndpoint === void 0 ? void 0 : otlpSignalEndpointFromBase(otlpBaseEndpoint, "traces"));
1356
1388
  const timeoutMillis = readInteger(ENVIRONMENT_VARIABLES.exporterTimeoutMillis);
1357
1389
  const resourceRaw = readString(ENVIRONMENT_VARIABLES.resourceAttributes);
1358
1390
  const resource = resourceRaw === void 0 ? void 0 : parseResourceAttributesValue(resourceRaw);
@@ -1438,7 +1470,7 @@ var parseEnvironmentConfig = (env) => {
1438
1470
  const maxEventsPerInvocation = readInteger(ENVIRONMENT_VARIABLES.maxEventsPerInvocation);
1439
1471
  const logsEnabled = readBoolean(ENVIRONMENT_VARIABLES.logsEnabled);
1440
1472
  const logsIncludeContent = readBoolean(ENVIRONMENT_VARIABLES.logsIncludeContent);
1441
- const logsEndpoint = readString(ENVIRONMENT_VARIABLES.logsEndpoint) ?? readString(ENVIRONMENT_VARIABLES.otlpLogsEndpoint);
1473
+ const logsEndpoint = readString(ENVIRONMENT_VARIABLES.logsEndpoint) ?? readString(ENVIRONMENT_VARIABLES.otlpLogsEndpoint) ?? (hookEndpoint === void 0 && otlpTracesEndpoint !== void 0 && otlpBaseEndpoint !== void 0 ? otlpSignalEndpointFromBase(otlpBaseEndpoint, "logs") : void 0);
1442
1474
  const logs = {
1443
1475
  ...logsEnabled === void 0 ? {} : { enabled: logsEnabled },
1444
1476
  ...logsEndpoint === void 0 ? {} : { endpoint: logsEndpoint },
@@ -7735,27 +7767,8 @@ var createFileDurableSpool = (options) => createSpoolQueue({
7735
7767
 
7736
7768
  // src/telemetry/otlp-log-sink.ts
7737
7769
  import { TraceFlags as TraceFlags3 } from "@opentelemetry/api";
7738
-
7739
- // node_modules/@opentelemetry/core/build/esm/common/time.js
7740
- var NANOSECOND_DIGITS = 9;
7741
- var NANOSECOND_DIGITS_IN_MILLIS = 6;
7742
- var MILLISECONDS_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS_IN_MILLIS);
7743
- var SECOND_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS);
7744
- function millisToHrTime(epochMillis) {
7745
- const epochSeconds = epochMillis / 1e3;
7746
- const seconds = Math.trunc(epochSeconds);
7747
- const nanos = Math.round(epochMillis % 1e3 * MILLISECONDS_TO_NANOSECONDS);
7748
- return [seconds, nanos];
7749
- }
7750
-
7751
- // node_modules/@opentelemetry/core/build/esm/ExportResult.js
7752
- var ExportResultCode;
7753
- (function(ExportResultCode2) {
7754
- ExportResultCode2[ExportResultCode2["SUCCESS"] = 0] = "SUCCESS";
7755
- ExportResultCode2[ExportResultCode2["FAILED"] = 1] = "FAILED";
7756
- })(ExportResultCode || (ExportResultCode = {}));
7757
-
7758
- // src/telemetry/otlp-log-sink.ts
7770
+ import { ExportResultCode } from "@opentelemetry/core";
7771
+ import { millisToHrTime as millisToHrTime3 } from "@opentelemetry/core";
7759
7772
  import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-proto";
7760
7773
 
7761
7774
  // src/telemetry/exporter-resource.ts
@@ -7794,8 +7807,8 @@ var replayResource = (attributes, policy) => {
7794
7807
  };
7795
7808
 
7796
7809
  // src/telemetry/log-records.ts
7797
- import { TraceFlags as TraceFlags2 } from "@opentelemetry/api";
7798
- import { SeverityNumber } from "@opentelemetry/api-logs";
7810
+ import { SeverityNumber, TraceFlags as TraceFlags2 } from "@opentelemetry/api";
7811
+ import { millisToHrTime as millisToHrTime2 } from "@opentelemetry/core";
7799
7812
  import {
7800
7813
  ATTR_ERROR_TYPE as ATTR_ERROR_TYPE2,
7801
7814
  ATTR_GEN_AI_OPERATION_NAME as ATTR_GEN_AI_OPERATION_NAME2,
@@ -7849,10 +7862,13 @@ var targetAttributes = (event3) => {
7849
7862
  };
7850
7863
  var usageTemporalityAttributes = (usage) => usage === void 0 ? {} : { [ATTR_OTELHOOK_USAGE_TEMPORALITY]: usage.temporality };
7851
7864
  var isPrimitiveAttribute = (value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean";
7852
- var passthroughHarAttributes = (resource) => {
7865
+ var PASSTHROUGH_RESOURCE_PREFIXES = Object.freeze(["har.", "factory.", "vcs."]);
7866
+ var LOCAL_ONLY_RESOURCE_PREFIX = "factory.local.";
7867
+ var isPassthroughKey = (key) => PASSTHROUGH_RESOURCE_PREFIXES.some((prefix) => key.startsWith(prefix)) && !key.startsWith(LOCAL_ONLY_RESOURCE_PREFIX) && key !== "factory.local";
7868
+ var passthroughResourceAttributes = (resource) => {
7853
7869
  const attributes = {};
7854
7870
  for (const [key, value] of Object.entries(resource.attributes)) {
7855
- if (key.startsWith("har.") && isPrimitiveAttribute(value)) {
7871
+ if (isPassthroughKey(key) && isPrimitiveAttribute(value)) {
7856
7872
  attributes[key] = value;
7857
7873
  }
7858
7874
  }
@@ -7886,7 +7902,7 @@ var exportIdentityAttributes = (event3, resource, ids) => {
7886
7902
  ...event3.provenance.providerVersion === void 0 ? {} : { [ATTR_OTELHOOK_PROVIDER_VERSION]: event3.provenance.providerVersion },
7887
7903
  [ATTR_OTELHOOK_WORKSPACE_ID]: event3.workspace.workspaceId,
7888
7904
  ...event3.subagentId === void 0 ? {} : { [ATTR_OTELHOOK_SUBAGENT_ID]: event3.subagentId },
7889
- ...passthroughHarAttributes(resource),
7905
+ ...passthroughResourceAttributes(resource),
7890
7906
  ...hexTraceAttributes(ids)
7891
7907
  };
7892
7908
  };
@@ -7894,6 +7910,7 @@ var exportIdentityAttributes = (event3, resource, ids) => {
7894
7910
  // src/telemetry/semconv.ts
7895
7911
  import { createHash as createHash3 } from "crypto";
7896
7912
  import { SpanKind, SpanStatusCode, TraceFlags } from "@opentelemetry/api";
7913
+ import { millisToHrTime } from "@opentelemetry/core";
7897
7914
  import {
7898
7915
  ATTR_ERROR_TYPE,
7899
7916
  ATTR_GEN_AI_OPERATION_NAME,
@@ -7910,7 +7927,7 @@ import {
7910
7927
  } from "@opentelemetry/semantic-conventions/incubating";
7911
7928
 
7912
7929
  // src/version.ts
7913
- var VERSION = "0.7.0";
7930
+ var VERSION = "0.8.0";
7914
7931
 
7915
7932
  // src/telemetry/semconv.ts
7916
7933
  var SCOPE_NAME = "@osfactory/otel-hook";
@@ -8057,12 +8074,12 @@ var pickTarget = (attributes) => {
8057
8074
  }
8058
8075
  return picked;
8059
8076
  };
8060
- var withoutTarget = (attributes) => {
8077
+ var withoutTarget = (attributes, resource) => {
8061
8078
  const rest = { ...attributes };
8062
8079
  for (const key of TARGET_KEYS) {
8063
8080
  delete rest[key];
8064
8081
  }
8065
- return rest;
8082
+ return { ...rest, ...pickTarget(passthroughResourceAttributes(resource)) };
8066
8083
  };
8067
8084
  var rankOf = (candidate) => {
8068
8085
  const source = candidate[ATTR_OTELHOOK_TARGET_SOURCE];
@@ -8167,7 +8184,7 @@ var buildLifecycleSpan = (plan, resource, scope) => {
8167
8184
  name = "session";
8168
8185
  kind = SpanKind.INTERNAL;
8169
8186
  attributes = {
8170
- ...withoutTarget(attributes),
8187
+ ...withoutTarget(attributes, resource),
8171
8188
  ...strongestTarget([pickTarget(resolved.recovered), start === void 0 ? {} : targetAttributes(start)]),
8172
8189
  ...start?.agentName === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_NAME]: start.agentName },
8173
8190
  ...start?.agentVersion === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_VERSION]: start.agentVersion },
@@ -8208,7 +8225,7 @@ var buildLifecycleSpan = (plan, resource, scope) => {
8208
8225
  kind = SpanKind.CLIENT;
8209
8226
  attributes = {
8210
8227
  // Target keys are re-chosen below as one unit, never mixed across edges.
8211
- ...withoutTarget(attributes),
8228
+ ...withoutTarget(attributes, resource),
8212
8229
  [ATTR_GEN_AI_TOOL_NAME]: toolName,
8213
8230
  [ATTR_GEN_AI_TOOL_CALL_ID]: start?.toolCallId ?? end?.toolCallId ?? group.ref.scopeKey,
8214
8231
  ...start?.toolKind === void 0 ? {} : { [ATTR_OTELHOOK_TOOL_KIND]: start.toolKind },
@@ -8694,14 +8711,14 @@ var contentAttributes = (fact, body) => ({
8694
8711
  });
8695
8712
  var buildRecord = (input) => {
8696
8713
  const severityNumber = severityFor(input.event);
8697
- const hrTime2 = millisToHrTime(input.event.occurredAt);
8714
+ const hrTime = millisToHrTime2(input.event.occurredAt);
8698
8715
  return {
8699
- hrTime: hrTime2,
8716
+ hrTime,
8700
8717
  // A hook observes an event that already happened, and this mapping is pure —
8701
8718
  // there is no clock here to read a real observation time from. Reporting the
8702
8719
  // occurrence time for both is the honest answer: it says "this is when it
8703
8720
  // happened" twice rather than inventing a second, wrong timestamp.
8704
- hrTimeObserved: hrTime2,
8721
+ hrTimeObserved: hrTime,
8705
8722
  spanContext: input.spanContext,
8706
8723
  severityNumber,
8707
8724
  severityText: SEVERITY_TEXT[severityNumber] ?? "INFO",
@@ -8791,15 +8808,6 @@ var canonicalEventsToLogRecords = (events, options) => {
8791
8808
  };
8792
8809
 
8793
8810
  // src/telemetry/otlp-log-sink.ts
8794
- var OTLP_TRACES_PATH = "/v1/traces";
8795
- var OTLP_LOGS_PATH = "/v1/logs";
8796
- var withoutTrailingSlashes = (value) => {
8797
- let end = value.length;
8798
- while (end > 0 && value.charCodeAt(end - 1) === 47) {
8799
- end -= 1;
8800
- }
8801
- return value.slice(0, end);
8802
- };
8803
8811
  var resolveLogsEndpoint = (exporter) => {
8804
8812
  if (exporter.logs.endpoint !== void 0) {
8805
8813
  return { endpoint: exporter.logs.endpoint, derived: false };
@@ -8853,8 +8861,8 @@ var deserializeRecord = (serialized, resource, scope) => {
8853
8861
  isRemote: false
8854
8862
  };
8855
8863
  return {
8856
- hrTime: millisToHrTime(serialized.timeMillis),
8857
- hrTimeObserved: millisToHrTime(serialized.observedTimeMillis),
8864
+ hrTime: millisToHrTime3(serialized.timeMillis),
8865
+ hrTimeObserved: millisToHrTime3(serialized.observedTimeMillis),
8858
8866
  ...spanContext === void 0 ? {} : { spanContext },
8859
8867
  severityNumber: serialized.severityNumber,
8860
8868
  ...serialized.severityText === void 0 ? {} : { severityText: serialized.severityText },
@@ -9069,6 +9077,7 @@ var createOtlpLogSink = (options) => {
9069
9077
  };
9070
9078
 
9071
9079
  // src/telemetry/otlp-sink.ts
9080
+ import { ExportResultCode as ExportResultCode2 } from "@opentelemetry/core";
9072
9081
  import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
9073
9082
  var chunk2 = (items, size) => {
9074
9083
  if (size <= 0 || items.length <= size) {
@@ -9156,7 +9165,7 @@ var createOtlpTraceSink = (options) => {
9156
9165
  const batchResource = replayResource(batch.resourceAttributes, options.exporter);
9157
9166
  const spans = batch.spans.map((span) => deserializeSpan(span, batchResource, batch.instrumentationScope));
9158
9167
  const result = await exportSpans(spans);
9159
- return result.code === ExportResultCode.SUCCESS;
9168
+ return result.code === ExportResultCode2.SUCCESS;
9160
9169
  };
9161
9170
  const resolveCorrelations = async (events) => {
9162
9171
  if (options.correlate === void 0) {
@@ -9188,9 +9197,9 @@ var createOtlpTraceSink = (options) => {
9188
9197
  try {
9189
9198
  result = await exportSpans(batch);
9190
9199
  } catch (thrown) {
9191
- result = { code: ExportResultCode.FAILED, error: thrown instanceof Error ? thrown : new Error("export threw") };
9200
+ result = { code: ExportResultCode2.FAILED, error: thrown instanceof Error ? thrown : new Error("export threw") };
9192
9201
  }
9193
- if (result.code === ExportResultCode.SUCCESS) {
9202
+ if (result.code === ExportResultCode2.SUCCESS) {
9194
9203
  accepted += batch.length;
9195
9204
  health.recordSuccess(batch.length, options.clock.now());
9196
9205
  continue;