Skip to content

Commit a316801

Browse files
committed
fix(traces): separate entrypoints
1 parent 432fcd6 commit a316801

File tree

11 files changed

+86
-62
lines changed

11 files changed

+86
-62
lines changed

frontend/src/components/actors/actor-inspector-context.tsx

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/components/actors/actor-traces.tsx

Lines changed: 27 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rivetkit-typescript/packages/rivetkit/src/inspector/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Unsubscribe } from "nanoevents";
33
import type { UpgradeWebSocketArgs } from "@/actor/router-websocket-endpoints";
44
import type { AnyActorInstance, RivetMessageEvent } from "@/mod";
55
import type { ToClient } from "@/schemas/actor-inspector/mod";
6-
import { encodeReadRangeWire } from "@rivetkit/traces";
6+
import { encodeReadRangeWire } from "@rivetkit/traces/encoding";
77
import {
88
CURRENT_VERSION as INSPECTOR_CURRENT_VERSION,
99
TO_CLIENT_VERSIONED as toClient,

rivetkit-typescript/packages/rivetkit/tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"@/*": ["./src/*"],
88
"@rivetkit/workflow-engine": ["../workflow-engine/src/index.ts"],
99
"@rivetkit/traces": ["../traces/src/index.ts"],
10+
"@rivetkit/traces/encoding": ["../traces/src/encoding.ts"],
11+
"@rivetkit/traces/otlp": ["../traces/src/otlp-entry.ts"],
1012
// Used for test fixtures
1113
"rivetkit": ["./src/mod.ts"],
1214
"rivetkit/utils": ["./src/utils.ts"]

rivetkit-typescript/packages/traces/package.json

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,32 @@
2121
"default": "./dist/tsup/index.cjs"
2222
}
2323
},
24-
"./reader": {
24+
"./encoding": {
2525
"import": {
26-
"types": "./dist/tsup/reader.d.ts",
27-
"default": "./dist/tsup/reader.js"
26+
"types": "./dist/tsup/encoding.d.ts",
27+
"default": "./dist/tsup/encoding.js"
2828
},
2929
"require": {
30-
"types": "./dist/tsup/reader.d.cts",
31-
"default": "./dist/tsup/reader.cjs"
30+
"types": "./dist/tsup/encoding.d.cts",
31+
"default": "./dist/tsup/encoding.cjs"
32+
}
33+
},
34+
"./otlp": {
35+
"import": {
36+
"types": "./dist/tsup/otlp-entry.d.ts",
37+
"default": "./dist/tsup/otlp-entry.js"
38+
},
39+
"require": {
40+
"types": "./dist/tsup/otlp-entry.d.cts",
41+
"default": "./dist/tsup/otlp-entry.cjs"
3242
}
3343
}
3444
},
3545
"engines": {
3646
"node": ">=18.0.0"
3747
},
3848
"scripts": {
39-
"build": "pnpm run compile:bare && tsup src/index.ts src/reader.ts",
49+
"build": "pnpm run compile:bare && tsup src/index.ts src/encoding.ts src/otlp-entry.ts",
4050
"compile:bare": "tsx scripts/compile-bare.ts compile schemas/v1.bare -o dist/schemas/v1.ts",
4151
"check-types": "pnpm run compile:bare && tsc --noEmit",
4252
"test": "pnpm run compile:bare && vitest run"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import {
2+
CURRENT_VERSION,
3+
READ_RANGE_VERSIONED,
4+
type ReadRangeWire,
5+
} from "../schemas/versioned.js";
6+
7+
export type { ReadRangeWire };
8+
9+
export function encodeReadRangeWire(wire: ReadRangeWire): Uint8Array {
10+
return READ_RANGE_VERSIONED.serializeWithEmbeddedVersion(
11+
wire,
12+
CURRENT_VERSION,
13+
);
14+
}
15+
16+
export function decodeReadRangeWire(bytes: Uint8Array): ReadRangeWire {
17+
return READ_RANGE_VERSIONED.deserializeWithEmbeddedVersion(bytes);
18+
}

rivetkit-typescript/packages/traces/src/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
export {
22
createTraces,
33
} from "./traces.js";
4-
export {
5-
decodeReadRangeWire,
6-
encodeReadRangeWire,
7-
readRangeWireToOtlp,
8-
} from "./read-range.js";
94
export type {
105
EndSpanOptions,
116
EventOptions,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export { readRangeWireToOtlp } from "./read-range.js";
2+
export {
3+
anyValueFromCborBytes,
4+
anyValueFromJs,
5+
base64FromBytes,
6+
hexFromBytes,
7+
type OtlpAnyValue,
8+
type OtlpExportTraceServiceRequestJson,
9+
type OtlpInstrumentationScope,
10+
type OtlpKeyValue,
11+
type OtlpResource,
12+
type OtlpResourceSpans,
13+
type OtlpScopeSpans,
14+
type OtlpSpan,
15+
type OtlpSpanEvent,
16+
type OtlpSpanLink,
17+
type OtlpSpanStatus,
18+
} from "./otlp.js";

rivetkit-typescript/packages/traces/src/read-range.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { decode as decodeCbor } from "cbor-x";
22
import {
3-
CURRENT_VERSION,
4-
READ_RANGE_VERSIONED,
53
type Attributes,
64
type Chunk,
75
type ReadRangeWire,
@@ -87,17 +85,6 @@ function spanKey(spanId: Uint8Array | SpanId): string {
8785
return hexFromBytes(normalizeBytes(spanId));
8886
}
8987

90-
export function encodeReadRangeWire(wire: ReadRangeWire): Uint8Array {
91-
return READ_RANGE_VERSIONED.serializeWithEmbeddedVersion(
92-
wire,
93-
CURRENT_VERSION,
94-
);
95-
}
96-
97-
export function decodeReadRangeWire(bytes: Uint8Array): ReadRangeWire {
98-
return READ_RANGE_VERSIONED.deserializeWithEmbeddedVersion(bytes);
99-
}
100-
10188
export function readRangeWireToOtlp(
10289
wire: ReadRangeWire,
10390
resource?: OtlpResource,

0 commit comments

Comments
 (0)