22 lines
733 B
TypeScript
22 lines
733 B
TypeScript
import z from "zod";
|
|
|
|
/**
|
|
* Telemetry-instrument declarations. The host pre-registers each named
|
|
* counter/histogram/gauge so plugin code can emit without first
|
|
* round-tripping through a registration call.
|
|
*/
|
|
const instrumentSchema = z.object({
|
|
name: z.string().min(1),
|
|
labels: z.array(z.string().min(1)).readonly().optional(),
|
|
});
|
|
|
|
export const telemetrySchema = z.object({
|
|
metricPrefix: z.string().min(1).optional(),
|
|
spanPrefix: z.string().min(1).optional(),
|
|
counters: z.array(instrumentSchema).readonly().optional(),
|
|
histograms: z.array(instrumentSchema).readonly().optional(),
|
|
gauges: z.array(instrumentSchema).readonly().optional(),
|
|
});
|
|
|
|
export type Telemetry = z.infer<typeof telemetrySchema>;
|