Skip to main content Link Search Menu Expand Document (external link)

Domain.ts overview

Since v1.0.0


Exports Grouped by Category


schemas

Counter

Signature

declare const Counter: Schema.Struct<{
  _tag: Schema.Literal<["Counter"]>
  name: typeof Schema.String
  description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
  tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
  state: Schema.Schema<{ readonly count: number | bigint }, { readonly count: string | number }, never>
}>

Source

Since v1.0.0

ExternalSpan

Signature

declare const ExternalSpan: Schema.Struct<{
  _tag: Schema.Literal<["ExternalSpan"]>
  spanId: typeof Schema.String
  traceId: typeof Schema.String
  sampled: typeof Schema.Boolean
}>

Source

Since v1.0.0

ExternalSpan (interface)

Signature

export interface ExternalSpan extends Schema.Schema.Type<typeof ExternalSpan> {}

Source

Since v1.0.0

ExternalSpanFrom (interface)

Signature

export interface ExternalSpanFrom extends Schema.Schema.Encoded<typeof ExternalSpan> {}

Source

Since v1.0.0

Frequency

Signature

declare const Frequency: Schema.Struct<{
  _tag: Schema.Literal<["Frequency"]>
  name: typeof Schema.String
  description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
  tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
  state: Schema.Schema<
    { readonly occurrences: { readonly [x: string]: number } },
    { readonly occurrences: { readonly [x: string]: number } },
    never
  >
}>

Source

Since v1.0.0

Gauge

Signature

declare const Gauge: Schema.Struct<{
  _tag: Schema.Literal<["Gauge"]>
  name: typeof Schema.String
  description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
  tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
  state: Schema.Schema<{ readonly value: number | bigint }, { readonly value: string | number }, never>
}>

Source

Since v1.0.0

Histogram

Signature

declare const Histogram: Schema.Struct<{
  _tag: Schema.Literal<["Histogram"]>
  name: typeof Schema.String
  description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
  tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
  state: Schema.Schema<
    {
      readonly count: number
      readonly buckets: ReadonlyArray<readonly [number, number]>
      readonly min: number
      readonly max: number
      readonly sum: number
    },
    {
      readonly count: number
      readonly buckets: ReadonlyArray<readonly [number | null, number]>
      readonly min: number
      readonly max: number
      readonly sum: number
    },
    never
  >
}>

Source

Since v1.0.0

Metric

Signature

declare const Metric: Schema.Union<
  [
    Schema.Struct<{
      _tag: Schema.Literal<["Counter"]>
      name: typeof Schema.String
      description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
      tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
      state: Schema.Schema<{ readonly count: number | bigint }, { readonly count: string | number }, never>
    }>,
    Schema.Struct<{
      _tag: Schema.Literal<["Frequency"]>
      name: typeof Schema.String
      description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
      tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
      state: Schema.Schema<
        { readonly occurrences: { readonly [x: string]: number } },
        { readonly occurrences: { readonly [x: string]: number } },
        never
      >
    }>,
    Schema.Struct<{
      _tag: Schema.Literal<["Gauge"]>
      name: typeof Schema.String
      description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
      tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
      state: Schema.Schema<{ readonly value: number | bigint }, { readonly value: string | number }, never>
    }>,
    Schema.Struct<{
      _tag: Schema.Literal<["Histogram"]>
      name: typeof Schema.String
      description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
      tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
      state: Schema.Schema<
        {
          readonly count: number
          readonly buckets: ReadonlyArray<readonly [number, number]>
          readonly min: number
          readonly max: number
          readonly sum: number
        },
        {
          readonly count: number
          readonly buckets: ReadonlyArray<readonly [number | null, number]>
          readonly min: number
          readonly max: number
          readonly sum: number
        },
        never
      >
    }>,
    Schema.Struct<{
      _tag: Schema.Literal<["Summary"]>
      name: typeof Schema.String
      description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
      tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
      state: Schema.Schema<
        {
          readonly error: number
          readonly count: number
          readonly min: number
          readonly max: number
          readonly sum: number
          readonly quantiles: ReadonlyArray<readonly [number, Option<number>]>
        },
        {
          readonly error: number
          readonly count: number
          readonly min: number
          readonly max: number
          readonly sum: number
          readonly quantiles: ReadonlyArray<
            readonly [number, { readonly _tag: "None" } | { readonly value: number; readonly _tag: "Some" }]
          >
        },
        never
      >
    }>
  ]
>

Source

Since v1.0.0

Metric (type alias)

Signature

type Metric = Schema.Schema.Type<typeof Metric>

Source

Since v1.0.0

MetricFrom (type alias)

Signature

type MetricFrom = Schema.Schema.Encoded<typeof Metric>

Source

Since v1.0.0

MetricLabel

Signature

declare const MetricLabel: Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>

Source

Since v1.0.0

MetricsRequest

Signature

declare const MetricsRequest: Schema.Struct<{ _tag: Schema.Literal<["MetricsRequest"]> }>

Source

Since v1.0.0

MetricsSnapshot

Signature

declare const MetricsSnapshot: Schema.Struct<{
  _tag: Schema.Literal<["MetricsSnapshot"]>
  metrics: Schema.Array$<
    Schema.Union<
      [
        Schema.Struct<{
          _tag: Schema.Literal<["Counter"]>
          name: typeof Schema.String
          description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
          tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
          state: Schema.Schema<{ readonly count: number | bigint }, { readonly count: string | number }, never>
        }>,
        Schema.Struct<{
          _tag: Schema.Literal<["Frequency"]>
          name: typeof Schema.String
          description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
          tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
          state: Schema.Schema<
            { readonly occurrences: { readonly [x: string]: number } },
            { readonly occurrences: { readonly [x: string]: number } },
            never
          >
        }>,
        Schema.Struct<{
          _tag: Schema.Literal<["Gauge"]>
          name: typeof Schema.String
          description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
          tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
          state: Schema.Schema<{ readonly value: number | bigint }, { readonly value: string | number }, never>
        }>,
        Schema.Struct<{
          _tag: Schema.Literal<["Histogram"]>
          name: typeof Schema.String
          description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
          tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
          state: Schema.Schema<
            {
              readonly count: number
              readonly buckets: ReadonlyArray<readonly [number, number]>
              readonly min: number
              readonly max: number
              readonly sum: number
            },
            {
              readonly count: number
              readonly buckets: ReadonlyArray<readonly [number | null, number]>
              readonly min: number
              readonly max: number
              readonly sum: number
            },
            never
          >
        }>,
        Schema.Struct<{
          _tag: Schema.Literal<["Summary"]>
          name: typeof Schema.String
          description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
          tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
          state: Schema.Schema<
            {
              readonly error: number
              readonly count: number
              readonly min: number
              readonly max: number
              readonly sum: number
              readonly quantiles: ReadonlyArray<readonly [number, Option<number>]>
            },
            {
              readonly error: number
              readonly count: number
              readonly min: number
              readonly max: number
              readonly sum: number
              readonly quantiles: ReadonlyArray<
                readonly [number, { readonly _tag: "None" } | { readonly value: number; readonly _tag: "Some" }]
              >
            },
            never
          >
        }>
      ]
    >
  >
}>

Source

Since v1.0.0

MetricsSnapshot (type alias)

Signature

type MetricsSnapshot = Schema.Schema.Type<typeof MetricsSnapshot>

Source

Since v1.0.0

MetricsSnapshotFrom (type alias)

Signature

type MetricsSnapshotFrom = Schema.Schema.Encoded<typeof MetricsSnapshot>

Source

Since v1.0.0

ParentSpan

Signature

declare const ParentSpan: Schema.Union<
  [
    Schema.Schema<Span, SpanFrom, never>,
    Schema.Struct<{
      _tag: Schema.Literal<["ExternalSpan"]>
      spanId: typeof Schema.String
      traceId: typeof Schema.String
      sampled: typeof Schema.Boolean
    }>
  ]
>

Source

Since v1.0.0

ParentSpan (type alias)

Signature

type ParentSpan = Span | ExternalSpan

Source

Since v1.0.0

ParentSpanFrom (type alias)

Signature

type ParentSpanFrom = SpanFrom | ExternalSpanFrom

Source

Since v1.0.0

Ping

Signature

declare const Ping: Schema.Struct<{ _tag: Schema.Literal<["Ping"]> }>

Source

Since v1.0.0

Pong

Signature

declare const Pong: Schema.Struct<{ _tag: Schema.Literal<["Pong"]> }>

Source

Since v1.0.0

Request

Signature

declare const Request: Schema.Union<
  [
    Schema.Struct<{ _tag: Schema.Literal<["Ping"]> }>,
    Schema.Schema<Span, SpanFrom, never>,
    Schema.Schema<
      SpanEvent,
      {
        readonly _tag: "SpanEvent"
        readonly spanId: string
        readonly traceId: string
        readonly name: string
        readonly attributes: { readonly [x: string]: unknown }
        readonly startTime: string
      },
      never
    >,
    Schema.Struct<{
      _tag: Schema.Literal<["MetricsSnapshot"]>
      metrics: Schema.Array$<
        Schema.Union<
          [
            Schema.Struct<{
              _tag: Schema.Literal<["Counter"]>
              name: typeof Schema.String
              description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
              tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
              state: Schema.Schema<{ readonly count: number | bigint }, { readonly count: string | number }, never>
            }>,
            Schema.Struct<{
              _tag: Schema.Literal<["Frequency"]>
              name: typeof Schema.String
              description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
              tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
              state: Schema.Schema<
                { readonly occurrences: { readonly [x: string]: number } },
                { readonly occurrences: { readonly [x: string]: number } },
                never
              >
            }>,
            Schema.Struct<{
              _tag: Schema.Literal<["Gauge"]>
              name: typeof Schema.String
              description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
              tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
              state: Schema.Schema<{ readonly value: number | bigint }, { readonly value: string | number }, never>
            }>,
            Schema.Struct<{
              _tag: Schema.Literal<["Histogram"]>
              name: typeof Schema.String
              description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
              tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
              state: Schema.Schema<
                {
                  readonly count: number
                  readonly buckets: ReadonlyArray<readonly [number, number]>
                  readonly min: number
                  readonly max: number
                  readonly sum: number
                },
                {
                  readonly count: number
                  readonly buckets: ReadonlyArray<readonly [number | null, number]>
                  readonly min: number
                  readonly max: number
                  readonly sum: number
                },
                never
              >
            }>,
            Schema.Struct<{
              _tag: Schema.Literal<["Summary"]>
              name: typeof Schema.String
              description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
              tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
              state: Schema.Schema<
                {
                  readonly error: number
                  readonly count: number
                  readonly min: number
                  readonly max: number
                  readonly sum: number
                  readonly quantiles: ReadonlyArray<readonly [number, Option<number>]>
                },
                {
                  readonly error: number
                  readonly count: number
                  readonly min: number
                  readonly max: number
                  readonly sum: number
                  readonly quantiles: ReadonlyArray<
                    readonly [number, { readonly _tag: "None" } | { readonly value: number; readonly _tag: "Some" }]
                  >
                },
                never
              >
            }>
          ]
        >
      >
    }>
  ]
>

Source

Since v1.0.0

Request (type alias)

Signature

type Request = Schema.Schema.Type<typeof Request>

Source

Since v1.0.0

Request (namespace)

Source

Since v1.0.0

WithoutPing (type alias)

Signature

type WithoutPing = Exclude<Request, { readonly _tag: "Ping" }>

Source

Since v1.0.0

Response

Signature

declare const Response: Schema.Union<
  [Schema.Struct<{ _tag: Schema.Literal<["Pong"]> }>, Schema.Struct<{ _tag: Schema.Literal<["MetricsRequest"]> }>]
>

Source

Since v1.0.0

Response (type alias)

Signature

type Response = Schema.Schema.Type<typeof Response>

Source

Since v1.0.0

Response (namespace)

Source

Since v1.0.0

WithoutPong (type alias)

Signature

type WithoutPong = Exclude<Response, { readonly _tag: "Pong" }>

Source

Since v1.0.0

Span

Signature

declare const Span: Schema.Schema<Span, SpanFrom, never>

Source

Since v1.0.0

Span (interface)

Signature

export interface Span {
  readonly _tag: "Span"
  readonly spanId: string
  readonly traceId: string
  readonly name: string
  readonly sampled: boolean
  readonly attributes: ReadonlyMap<string, unknown>
  readonly parent: Option<ParentSpan>
  readonly status:
    | {
        readonly _tag: "Started"
        readonly startTime: bigint
      }
    | {
        readonly _tag: "Ended"
        readonly startTime: bigint
        readonly endTime: bigint
      }
}

Source

Since v1.0.0

SpanEvent

Signature

declare const SpanEvent: Schema.Schema<
  SpanEvent,
  {
    readonly _tag: "SpanEvent"
    readonly spanId: string
    readonly traceId: string
    readonly name: string
    readonly attributes: { readonly [x: string]: unknown }
    readonly startTime: string
  },
  never
>

Source

Since v1.0.0

SpanEvent (interface)

Signature

export interface SpanEvent {
  readonly _tag: "SpanEvent"
  readonly spanId: string
  readonly traceId: string
  readonly name: string
  readonly attributes: { readonly [x: string]: unknown }
  readonly startTime: bigint
}

Source

Since v1.0.0

SpanFrom (interface)

Signature

export interface SpanFrom {
  readonly _tag: "Span"
  readonly spanId: string
  readonly traceId: string
  readonly name: string
  readonly sampled: boolean
  readonly attributes: ReadonlyArray<readonly [string, unknown]>
  readonly parent: Schema.OptionEncoded<ParentSpanFrom>
  readonly status:
    | {
        readonly _tag: "Started"
        readonly startTime: string
      }
    | {
        readonly _tag: "Ended"
        readonly startTime: string
        readonly endTime: string
      }
}

Source

Since v1.0.0

SpanStatus

Signature

declare const SpanStatus: Schema.Union<
  [
    Schema.Struct<{ _tag: Schema.Literal<["Started"]>; startTime: typeof Schema.BigInt }>,
    Schema.Struct<{ _tag: Schema.Literal<["Ended"]>; startTime: typeof Schema.BigInt; endTime: typeof Schema.BigInt }>
  ]
>

Source

Since v1.0.0

SpanStatusEnded

Signature

declare const SpanStatusEnded: Schema.Struct<{
  _tag: Schema.Literal<["Ended"]>
  startTime: typeof Schema.BigInt
  endTime: typeof Schema.BigInt
}>

Source

Since v1.0.0

SpanStatusStarted

Signature

declare const SpanStatusStarted: Schema.Struct<{ _tag: Schema.Literal<["Started"]>; startTime: typeof Schema.BigInt }>

Source

Since v1.0.0

Summary

Signature

declare const Summary: Schema.Struct<{
  _tag: Schema.Literal<["Summary"]>
  name: typeof Schema.String
  description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
  tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
  state: Schema.Schema<
    {
      readonly error: number
      readonly count: number
      readonly min: number
      readonly max: number
      readonly sum: number
      readonly quantiles: ReadonlyArray<readonly [number, Option<number>]>
    },
    {
      readonly error: number
      readonly count: number
      readonly min: number
      readonly max: number
      readonly sum: number
      readonly quantiles: ReadonlyArray<
        readonly [number, { readonly _tag: "None" } | { readonly value: number; readonly _tag: "Some" }]
      >
    },
    never
  >
}>

Source

Since v1.0.0

metric

Signature

declare const metric: <Tag extends string, S, IS, R>(
  tag: Tag,
  state: Schema.Schema<S, IS, R>
) => Schema.Struct<{
  _tag: Schema.Literal<[Tag]>
  name: typeof Schema.String
  description: Schema.optionalWith<typeof Schema.String, { as: "Option" }>
  tags: Schema.Array$<Schema.Struct<{ key: typeof Schema.String; value: typeof Schema.String }>>
  state: Schema.Schema<S, IS, R>
}>

Source

Since v1.0.0