Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/components/actors/actor-inspector-context.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 27 additions & 31 deletions frontend/src/components/actors/actor-traces.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Unsubscribe } from "nanoevents";
import type { UpgradeWebSocketArgs } from "@/actor/router-websocket-endpoints";
import type { AnyActorInstance, RivetMessageEvent } from "@/mod";
import type { ToClient } from "@/schemas/actor-inspector/mod";
import { encodeReadRangeWire } from "@rivetkit/traces";
import { encodeReadRangeWire } from "@rivetkit/traces/encoding";
import {
CURRENT_VERSION as INSPECTOR_CURRENT_VERSION,
TO_CLIENT_VERSIONED as toClient,
Expand Down
2 changes: 2 additions & 0 deletions rivetkit-typescript/packages/rivetkit/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"@/*": ["./src/*"],
"@rivetkit/workflow-engine": ["../workflow-engine/src/index.ts"],
"@rivetkit/traces": ["../traces/src/index.ts"],
"@rivetkit/traces/encoding": ["../traces/src/encoding.ts"],
"@rivetkit/traces/otlp": ["../traces/src/otlp-entry.ts"],
// Used for test fixtures
"rivetkit": ["./src/mod.ts"],
"rivetkit/utils": ["./src/utils.ts"]
Expand Down
4 changes: 4 additions & 0 deletions rivetkit-typescript/packages/rivetkit/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import defaultConfig from "../../../tsup.base.ts";
export default defineConfig({
...defaultConfig,
outDir: "dist/tsup/",
esbuildOptions(options) {
options.external = options.external ?? [];
options.external.push("@rivetkit/traces", "@rivetkit/traces/encoding", "@rivetkit/traces/otlp");
},
define: {
"globalThis.CUSTOM_RIVETKIT_DEVTOOLS_URL": process.env
.CUSTOM_RIVETKIT_DEVTOOLS_URL
Expand Down
22 changes: 16 additions & 6 deletions rivetkit-typescript/packages/traces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,32 @@
"default": "./dist/tsup/index.cjs"
}
},
"./reader": {
"./encoding": {
"import": {
"types": "./dist/tsup/reader.d.ts",
"default": "./dist/tsup/reader.js"
"types": "./dist/tsup/encoding.d.ts",
"default": "./dist/tsup/encoding.js"
},
"require": {
"types": "./dist/tsup/reader.d.cts",
"default": "./dist/tsup/reader.cjs"
"types": "./dist/tsup/encoding.d.cts",
"default": "./dist/tsup/encoding.cjs"
}
},
"./otlp": {
"import": {
"types": "./dist/tsup/otlp-entry.d.ts",
"default": "./dist/tsup/otlp-entry.js"
},
"require": {
"types": "./dist/tsup/otlp-entry.d.cts",
"default": "./dist/tsup/otlp-entry.cjs"
}
}
},
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"build": "pnpm run compile:bare && tsup src/index.ts src/reader.ts",
"build": "pnpm run compile:bare && tsup src/index.ts src/index.browser.ts src/encoding.ts src/otlp-entry.ts",
"compile:bare": "tsx scripts/compile-bare.ts compile schemas/v1.bare -o dist/schemas/v1.ts",
"check-types": "pnpm run compile:bare && tsc --noEmit",
"test": "pnpm run compile:bare && vitest run"
Expand Down
18 changes: 18 additions & 0 deletions rivetkit-typescript/packages/traces/src/encoding.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {
CURRENT_VERSION,
READ_RANGE_VERSIONED,
type ReadRangeWire,
} from "../schemas/versioned.js";

export type { ReadRangeWire };

export function encodeReadRangeWire(wire: ReadRangeWire): Uint8Array {
return READ_RANGE_VERSIONED.serializeWithEmbeddedVersion(
wire,
CURRENT_VERSION,
);
}

export function decodeReadRangeWire(bytes: Uint8Array): ReadRangeWire {
return READ_RANGE_VERSIONED.deserializeWithEmbeddedVersion(bytes);
}
5 changes: 0 additions & 5 deletions rivetkit-typescript/packages/traces/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
export {
createTraces,
} from "./traces.js";
export {
decodeReadRangeWire,
encodeReadRangeWire,
readRangeWireToOtlp,
} from "./read-range.js";
export type {
EndSpanOptions,
EventOptions,
Expand Down
18 changes: 18 additions & 0 deletions rivetkit-typescript/packages/traces/src/otlp-entry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export { readRangeWireToOtlp } from "./read-range.js";
export {
anyValueFromCborBytes,
anyValueFromJs,
base64FromBytes,
hexFromBytes,
type OtlpAnyValue,
type OtlpExportTraceServiceRequestJson,
type OtlpInstrumentationScope,
type OtlpKeyValue,
type OtlpResource,
type OtlpResourceSpans,
type OtlpScopeSpans,
type OtlpSpan,
type OtlpSpanEvent,
type OtlpSpanLink,
type OtlpSpanStatus,
} from "./otlp.js";
13 changes: 0 additions & 13 deletions rivetkit-typescript/packages/traces/src/read-range.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { decode as decodeCbor } from "cbor-x";
import {
CURRENT_VERSION,
READ_RANGE_VERSIONED,
type Attributes,
type Chunk,
type ReadRangeWire,
Expand Down Expand Up @@ -87,17 +85,6 @@ function spanKey(spanId: Uint8Array | SpanId): string {
return hexFromBytes(normalizeBytes(spanId));
}

export function encodeReadRangeWire(wire: ReadRangeWire): Uint8Array {
return READ_RANGE_VERSIONED.serializeWithEmbeddedVersion(
wire,
CURRENT_VERSION,
);
}

export function decodeReadRangeWire(bytes: Uint8Array): ReadRangeWire {
return READ_RANGE_VERSIONED.deserializeWithEmbeddedVersion(bytes);
}

export function readRangeWireToOtlp(
wire: ReadRangeWire,
resource?: OtlpResource,
Expand Down
5 changes: 0 additions & 5 deletions rivetkit-typescript/packages/traces/src/reader.ts

This file was deleted.

Loading