DevToolsSchema
Defines the experimental wire schema used by the Effect devtools protocol.
The module contains the serialized message shapes exchanged between devtools clients and servers: span snapshots, span events, metric snapshots, heartbeats, and request/response unions. Use these schemas at protocol boundaries to encode, decode, or validate custom transports that need to interoperate with the built-in unstable devtools client and server.
Other
Schemas
Schema for a counter metric snapshot, including the count and whether updates are incremental.
Signature
declare const Counter: Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly count: Union<readonly [Number, BigInt]>;
readonly incremental: Boolean;
}>;
readonly type: tag<"Counter">;
}>;Type of a devtools counter metric snapshot.
Details
The state contains the current count and whether the counter reports incremental updates.
Signature
type Counter = Schema.Schema.Type<typeof Counter>;ExternalSpan
Schema for an external parent span context containing span id, trace id, and sampling flag.
Signature
declare const ExternalSpan: Codec<ExternalSpan, ExternalSpan, never, never>;ExternalSpan interface
Serialized parent span context for a span created outside the current devtools span tree.
Signature
interface ExternalSpan {
readonly _tag: "ExternalSpan";
readonly sampled: boolean;
readonly spanId: string;
readonly traceId: string;
}Schema for a devtools frequency metric snapshot.
Details
The metric state records occurrence counts by string key.
Signature
declare const Frequency: Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly occurrences: $ReadonlyMap<String, Natural>;
}>;
readonly type: tag<"Frequency">;
}>;Type of a devtools frequency metric snapshot.
Details
The state maps observed string values to occurrence counts.
Signature
type Frequency = Schema.Schema.Type<typeof Frequency>;Schema for a devtools gauge metric snapshot.
Details
The metric state contains the current numeric or bigint value.
Signature
declare const Gauge: Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly value: Union<readonly [Number, BigInt]>;
}>;
readonly type: tag<"Gauge">;
}>;Type of a devtools gauge metric snapshot.
Details
The state contains the current numeric or bigint value.
Signature
type Gauge = Schema.Schema.Type<typeof Gauge>;Schema for a devtools histogram metric snapshot.
Details
The metric state includes bucket counts plus the total count, minimum, maximum, and sum.
Signature
declare const Histogram: Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly buckets: $Array<Tuple<readonly [Number, Natural]>>;
readonly count: Natural;
readonly max: Number;
readonly min: Number;
readonly sum: Number;
}>;
readonly type: tag<"Histogram">;
}>;Type of a devtools histogram metric snapshot.
Details
The state includes bucket counts plus the total count, minimum, maximum, and sum.
Signature
type Histogram = Schema.Schema.Type<typeof Histogram>;Schema for any devtools metric snapshot.
Details
Accepted metric kinds are counters, frequencies, gauges, histograms, and summaries.
Signature
declare const Metric: Union<
readonly [
Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly count: Union<readonly [Number, BigInt]>;
readonly incremental: Boolean;
}>;
readonly type: tag<"Counter">;
}>,
Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly occurrences: $ReadonlyMap<String, Natural>;
}>;
readonly type: tag<"Frequency">;
}>,
Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly value: Union<readonly [Number, BigInt]>;
}>;
readonly type: tag<"Gauge">;
}>,
Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly buckets: $Array<Tuple<readonly [Number, Natural]>>;
readonly count: Natural;
readonly max: Number;
readonly min: Number;
readonly sum: Number;
}>;
readonly type: tag<"Histogram">;
}>,
Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly count: Natural;
readonly max: Number;
readonly min: Number;
readonly quantiles: $Array<Tuple<readonly [Finite, UndefinedOr<Number>]>>;
readonly sum: Number;
}>;
readonly type: tag<"Summary">;
}>,
]
>;Type of any devtools metric snapshot.
Details
The union covers counters, frequencies, gauges, histograms, and summaries.
Signature
type Metric = Schema.Schema.Type<typeof Metric>;MetricLabel
Schema for a metric label key/value pair in a devtools metrics snapshot.
Signature
declare const MetricLabel: Struct<{
readonly key: String;
readonly value: String;
}>;MetricLabel type
Type of a metric label key/value pair in a devtools metrics snapshot.
Signature
type MetricLabel = Schema.Schema.Type<typeof MetricLabel>;MetricsRequest
Schema for a devtools request asking the client to send a metrics snapshot.
Signature
declare const MetricsRequest: Struct<{
readonly _tag: tag<"MetricsRequest">;
}>;MetricsRequest type
Type of a devtools request asking the client to send a metrics snapshot.
Signature
type MetricsRequest = Schema.Schema.Type<typeof MetricsRequest>;MetricsSnapshot
Schema for a devtools protocol message containing the current metric snapshots.
Signature
declare const MetricsSnapshot: Struct<{
readonly _tag: tag<"MetricsSnapshot">;
readonly metrics: $Array<Union<readonly [Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly count: Union<readonly [..., ...]>;
readonly incremental: Boolean;
}>;
readonly type: tag<"Counter">;
}>, Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly occurrences: $ReadonlyMap<String, Natural>;
}>;
readonly type: tag<"Frequency">;
}>, Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly value: Union<readonly [..., ...]>;
}>;
readonly type: tag<"Gauge">;
}>, Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly buckets: $Array<Tuple<...>>;
readonly count: Natural;
readonly max: Number;
readonly min: Number;
readonly sum: Number;
}>;
readonly type: tag<"Histogram">;
}>, Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly count: Natural;
readonly max: Number;
readonly min: Number;
readonly quantiles: $Array<Tuple<...>>;
readonly sum: Number;
}>;
readonly type: tag<"Summary">;
}>]>>;
}>MetricsSnapshot type
Type of a devtools protocol message containing the current metric snapshots.
Signature
type MetricsSnapshot = Schema.Schema.Type<typeof MetricsSnapshot>;ParentSpan
Schema for a span parent, either a full devtools Span payload or an ExternalSpan context.
Signature
declare const ParentSpan: Union<
readonly [Codec<Span, Span, never, never>, Codec<ExternalSpan, ExternalSpan, never, never>]
>;ParentSpan type
Type of a span parent, represented either by a devtools Span payload or an ExternalSpan context.
Signature
type ParentSpan = Span | ExternalSpan;Schema for the devtools heartbeat request sent by the client.
Signature
declare const Ping: Struct<{
readonly _tag: tag<"Ping">;
}>;Type of the devtools heartbeat request sent by the client.
Signature
type Ping = Schema.Schema.Type<typeof Ping>;Schema for the devtools heartbeat response.
Signature
declare const Pong: Struct<{
readonly _tag: tag<"Pong">;
}>;Type of the devtools heartbeat response.
Signature
type Pong = Schema.Schema.Type<typeof Pong>;Schema for devtools protocol requests accepted by the server.
Details
Requests include heartbeat pings, spans, span events, and metric snapshots.
Signature
declare const Request: Union<readonly [Struct<{
readonly _tag: tag<"Ping">;
}>, Codec<Span, Span, never, never>, Struct<{
readonly _tag: tag<"SpanEvent">;
readonly attributes: UndefinedOr<$Record<String, Any>>;
readonly name: String;
readonly spanId: String;
readonly startTime: BigInt;
readonly traceId: String;
}>, Struct<{
readonly _tag: tag<"MetricsSnapshot">;
readonly metrics: $Array<Union<readonly [Struct<{
readonly attributes: UndefinedOr<$Record<..., ...>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly count: ...;
readonly incremental: ...;
}>;
readonly type: tag<"Counter">;
}>, Struct<{
readonly attributes: UndefinedOr<$Record<..., ...>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly occurrences: ...;
}>;
readonly type: tag<"Frequency">;
}>, Struct<{
readonly attributes: UndefinedOr<$Record<..., ...>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly value: ...;
}>;
readonly type: tag<"Gauge">;
}>, Struct<{
readonly attributes: UndefinedOr<$Record<..., ...>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly buckets: ...;
readonly count: ...;
readonly max: ...;
readonly min: ...;
readonly sum: ...;
}>;
readonly type: tag<"Histogram">;
}>, Struct<{
readonly attributes: UndefinedOr<$Record<..., ...>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly count: ...;
readonly max: ...;
readonly min: ...;
readonly quantiles: ...;
readonly sum: ...;
}>;
readonly type: tag<"Summary">;
}>]>>;
}>]>Type of devtools protocol requests accepted by the server.
Details
Requests include heartbeat pings, spans, span events, and metric snapshots.
Signature
type Request = Schema.Schema.Type<typeof Request>;Schema for devtools protocol responses sent by the server.
Details
Responses include heartbeat pongs and requests for metric snapshots.
Signature
declare const Response: Union<
readonly [
Struct<{
readonly _tag: tag<"Pong">;
}>,
Struct<{
readonly _tag: tag<"MetricsRequest">;
}>,
]
>;Type of devtools protocol responses sent by the server.
Details
Responses include heartbeat pongs and requests for metric snapshots.
Signature
type Response = Schema.Schema.Type<typeof Response>;Schema for an Effect span telemetry payload sent to devtools.
Signature
declare const Span: Codec<Span, Span, never, never>;Telemetry payload for an Effect span sent to devtools, including identity, attributes, status, sampling flag, and optional parent span.
Signature
interface Span {
readonly _tag: "Span";
readonly attributes: ReadonlyMap<string, unknown>;
readonly name: string;
readonly parent: Option<ParentSpan>;
readonly sampled: boolean;
readonly spanId: string;
readonly status:
| {
readonly _tag: "Started";
readonly startTime: bigint;
}
| {
readonly _tag: "Ended";
readonly endTime: bigint;
readonly exit: Exit<unknown, unknown>;
readonly startTime: bigint;
};
readonly traceId: string;
}Schema for a named event emitted by a span, including trace id, span id, start time, and optional attributes.
Signature
declare const SpanEvent: Struct<{
readonly _tag: tag<"SpanEvent">;
readonly attributes: UndefinedOr<$Record<String, Any>>;
readonly name: String;
readonly spanId: String;
readonly startTime: BigInt;
readonly traceId: String;
}>;Type of a named event emitted by a span and sent to devtools.
Signature
type SpanEvent = Schema.Schema.Type<typeof SpanEvent>;SpanStatus
Schema for devtools span status, either started or ended.
Signature
declare const SpanStatus: Union<
readonly [
Struct<{
readonly _tag: tag<"Started">;
readonly startTime: BigInt;
}>,
Struct<{
readonly _tag: tag<"Ended">;
readonly endTime: BigInt;
readonly exit: decodeTo<
Exit<Unknown, Unknown, Unknown>,
Exit<Void, Defect, Defect>,
never,
never
>;
readonly startTime: BigInt;
}>,
]
>;SpanStatus type
Type of a devtools span status, either started or ended.
Signature
type SpanStatus = Schema.Schema.Type<typeof SpanStatus>;SpanStatusEnded
Schema for a span status representing an ended span, including start time, end time, and encoded exit status. Encoding drops success values with Exit.asVoid.
Signature
declare const SpanStatusEnded: Struct<{
readonly _tag: tag<"Ended">;
readonly endTime: BigInt;
readonly exit: decodeTo<
Exit<Unknown, Unknown, Unknown>,
Exit<Void, Defect, Defect>,
never,
never
>;
readonly startTime: BigInt;
}>;SpanStatusEnded type
Type of a span status representing an ended span with start time, end time, and exit status.
Signature
type SpanStatusEnded = Schema.Schema.Type<typeof SpanStatusEnded>;SpanStatusStarted
Schema for a span status representing a span that has started but not yet ended.
Signature
declare const SpanStatusStarted: Struct<{
readonly _tag: tag<"Started">;
readonly startTime: BigInt;
}>;SpanStatusStarted type
Type of a span status representing a span that has started but not yet ended.
Signature
type SpanStatusStarted = Schema.Schema.Type<typeof SpanStatusStarted>;Schema for a devtools summary metric snapshot.
Details
The metric state contains quantile values plus the total count, minimum, maximum, and sum.
Signature
declare const Summary: Struct<{
readonly attributes: UndefinedOr<$Record<String, String>>;
readonly description: UndefinedOr<String>;
readonly id: String;
state: Struct<{
readonly count: Natural;
readonly max: Number;
readonly min: Number;
readonly quantiles: $Array<Tuple<readonly [Finite, UndefinedOr<Number>]>>;
readonly sum: Number;
}>;
readonly type: tag<"Summary">;
}>;Type of a devtools summary metric snapshot.
Details
The state contains quantile values plus the total count, minimum, maximum, and sum.
Signature
type Summary = Schema.Schema.Type<typeof Summary>;
Namespace containing helper types for devtools protocol requests.