-
Notifications
You must be signed in to change notification settings - Fork 156
refactor(rivetkit): make traces server only lib #4051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| // Browser stub for @rivetkit/traces | ||
| // This file is used as the browser entry point to prevent Node.js-specific code from being bundled | ||
|
|
||
| import type { | ||
| OtlpAnyValue, | ||
| OtlpExportTraceServiceRequestJson, | ||
| OtlpInstrumentationScope, | ||
| OtlpKeyValue, | ||
| OtlpResource, | ||
| OtlpResourceSpans, | ||
| OtlpScopeSpans, | ||
| OtlpSpan, | ||
| OtlpSpanEvent, | ||
| OtlpSpanLink, | ||
| OtlpSpanStatus, | ||
| } from "./otlp.js"; | ||
| import type { | ||
| EndSpanOptions, | ||
| EventOptions, | ||
| ReadRangeOptions, | ||
| ReadRangeResult, | ||
| ReadRangeWire, | ||
| SpanHandle, | ||
| SpanStatusInput, | ||
| StartSpanOptions, | ||
| Traces, | ||
| TracesDriver, | ||
| TracesOptions, | ||
| UpdateSpanOptions, | ||
| } from "./types.js"; | ||
|
|
||
| function notSupported(name: string): never { | ||
| throw new Error( | ||
| `@rivetkit/traces: ${name} is not supported in the browser. Traces are only available on the server.`, | ||
| ); | ||
| } | ||
|
|
||
| export function createTraces( | ||
| _options: TracesOptions<OtlpResource>, | ||
| ): Traces<OtlpExportTraceServiceRequestJson> { | ||
| notSupported("createTraces"); | ||
| } | ||
|
|
||
| export function encodeReadRangeWire(_wire: ReadRangeWire): Uint8Array { | ||
| notSupported("encodeReadRangeWire"); | ||
| } | ||
|
|
||
| export function decodeReadRangeWire(_bytes: Uint8Array): ReadRangeWire { | ||
| notSupported("decodeReadRangeWire"); | ||
| } | ||
|
|
||
| export function readRangeWireToOtlp( | ||
| _wire: ReadRangeWire, | ||
| _resource?: OtlpResource, | ||
| ): { otlp: OtlpExportTraceServiceRequestJson; clamped: boolean } { | ||
| notSupported("readRangeWireToOtlp"); | ||
| } | ||
|
|
||
| // Re-export types (these are safe for browsers) | ||
| export type { | ||
| EndSpanOptions, | ||
| EventOptions, | ||
| ReadRangeOptions, | ||
| ReadRangeResult, | ||
| ReadRangeWire, | ||
| SpanHandle, | ||
| SpanStatusInput, | ||
| StartSpanOptions, | ||
| Traces, | ||
| TracesDriver, | ||
| TracesOptions, | ||
| UpdateSpanOptions, | ||
| OtlpAnyValue, | ||
| OtlpExportTraceServiceRequestJson, | ||
| OtlpInstrumentationScope, | ||
| OtlpKeyValue, | ||
| OtlpResource, | ||
| OtlpResourceSpans, | ||
| OtlpScopeSpans, | ||
| OtlpSpan, | ||
| OtlpSpanEvent, | ||
| OtlpSpanLink, | ||
| OtlpSpanStatus, | ||
| }; | ||
|
Comment on lines
+1
to
+84
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This new file likely has formatting issues throughout. Since it's a completely new file, it should be formatted according to Biome's rules. Run 'biome format --write' on this file to ensure proper formatting. Spotted by Graphite Agent (based on CI logs) |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The custom URL dependency '@rivetkit/fdb-tuple': 'https://pkg.pr.new/rivet-dev/fdb-tuple/@rivetkit/fdb-tuple@32f95e2' is causing TypeScript compilation errors during CI. Consider using a standard npm package, a GitHub URL (github:rivet-dev/fdb-tuple#commit-hash), or adding a resolution in the root package.json to help resolve this URL correctly.
Spotted by Graphite Agent (based on CI logs)

Is this helpful? React 👍 or 👎 to let us know.