componentized

Types

use record instrumentation-scope

from wasi:otel/types@0.2.0-rc.2

Describes the instrumentation scope that produced telemetry.

  • name: string

    Name of the instrumentation scope.

  • version: option<string>

    The library version.

  • schema-url: option<string>

    Schema URL used by this library. https://opentelemetry.io/docs/specs/otel/schemas/#schema-url

  • attributes: list<key-value>

    Specifies the instrumentation scope attributes to associate with emitted telemetry.

use record resource

from wasi:otel/types@0.2.0-rc.2

An immutable representation of the entity producing telemetry as attributes.

  • attributes: list<key-value>

    Attributes that identify the resource.

  • schema-url: option<string>

    The schema URL to be recorded in the emitted resource.

use type value

from wasi:otel/types@0.2.0-rc.2

The value part of attribute key-value pairs.

This corresponds with the AnyValue type defined in the attribute spec. Because WIT doesn't support recursive types, the data needs to be serialized. JSON is used as the encoding format.

Byte arrays require special encoding since JSON cannot distinguish them from number arrays. They are base64-encoded with a prefix that follows the Data URI RFC 2397 convention: data:application/octet-stream;base64,<BASE64_ENCODED_BYTES>

  • string

use record key-value

from wasi:otel/types@0.2.0-rc.2

A key-value pair describing an attribute.

  • key: key

    The attribute name.

  • value: value

    The attribute value.

use type span-id

from wasi:otel/tracing@0.2.0-rc.2

The id of this span-context.

8 bytes encoded as a hexadecimal string.

  • string

use type trace-id

from wasi:otel/tracing@0.2.0-rc.2

The trace that this span-context belongs to.

16 bytes encoded as a hexadecimal string.

  • string

use flags trace-flags

from wasi:otel/tracing@0.2.0-rc.2

Flags that can be set on a span-context.

  • sampled

    Whether the span should be sampled or not.

use record datetime

from wasi:clocks/wall-clock@0.2.0

A time and date in seconds plus nanoseconds.

  • seconds: u64
  • nanoseconds: u32

record log-record

Represents the recording of an event.

  • timestamp: option<datetime>

    Time when the event occurred.

  • observed-timestamp: option<datetime>

    Time when the event was observed.

  • severity-text: option<string>

    The severity text(also known as log level).

  • severity-number: option<u8>

    The numerical value of the severity ranging from 1-24.

  • body: option<value>

    The body of the log record.

  • attributes: option<list<key-value>>

    Additional information about the specific event occurrence.

  • event-name: option<string>

    Name that identifies the class / type of event.

  • resource: option<resource>

    Describes the source of the log.

  • instrumentation-scope: option<instrumentation-scope>

    Describes the scope that emitted the log.

  • trace-id: option<trace-id>

    Request trace id.

  • span-id: option<span-id>

    Request span id.

  • trace-flags: option<trace-flags>

    W3C trace flag.

Functions

functionon-emit: func(data: log-record)

Called when a log is emitted.

WIT

interface logs {
  use types.{instrumentation-scope, %resource, value, key-value};
  use tracing.{span-id, trace-id, trace-flags};
  use wasi:clocks/wall-clock@0.2.0.{datetime};

  /// Represents the recording of an event.
  record log-record {
    /// Time when the event occurred.
    timestamp: option<datetime>,
    /// Time when the event was observed.
    observed-timestamp: option<datetime>,
    /// The severity text(also known as log level).
    severity-text: option<string>,
    /// The numerical value of the severity ranging from 1-24.
    severity-number: option<u8>,
    /// The body of the log record.
    body: option<value>,
    /// Additional information about the specific event occurrence.
    attributes: option<list<key-value>>,
    /// Name that identifies the class / type of event.
    event-name: option<string>,
    /// Describes the source of the log.
    %resource: option<%resource>,
    /// Describes the scope that emitted the log.
    instrumentation-scope: option<instrumentation-scope>,
    /// Request trace id.
    trace-id: option<trace-id>,
    /// Request span id.
    span-id: option<span-id>,
    /// W3C trace flag.
    trace-flags: option<trace-flags>,
  }

  /// Called when a log is emitted.
  on-emit: func(data: log-record);
}