imports.md
September 19, 2024 ยท View on GitHub
World imports
- Imports:
- interface
wasi:logging/logging - interface
wasi:clocks/wall-clock@0.2.1 - interface
wasi:observe/tracer
- interface
Import interface wasi:logging/logging
WASI Logging is a logging API intended to let users emit log messages with simple priority levels and context values.
Types
enum level
A log level, describing a kind of message.
Enum Cases
-
Describes messages about the values of variables and the flow of control within a program.
-
Describes messages likely to be of interest to someone debugging a program.
-
Describes messages likely to be of interest to someone monitoring a program.
-
Describes messages indicating hazardous situations.
-
Describes messages indicating serious errors.
-
Describes messages indicating fatal errors.
Functions
log: func
Emit a log message.
A log message has a level describing what kind of message is being
sent, a context, which is an uninterpreted string meant to help
consumers group similar messages, and a string containing the message
text.
Params
Import interface wasi:clocks/wall-clock@0.2.1
WASI Wall Clock is a clock API intended to let users query the current time. The name "wall" makes an analogy to a "clock on the wall", which is not necessarily monotonic as it may be reset.
It is intended to be portable at least between Unix-family platforms and Windows.
A wall clock is a clock which measures the date and time according to some external reference.
External references may be reset, so this clock is not necessarily monotonic, making it unsuitable for measuring elapsed time.
It is intended for reporting the current date and time for humans.
Types
record datetime
A time and date in seconds plus nanoseconds.
Record Fields
Functions
now: func
Read the current value of the clock.
This clock is not monotonic, therefore calling this function repeatedly will not necessarily produce a sequence of non-decreasing values.
The returned timestamps represent the number of seconds since 1970-01-01T00:00:00Z, also known as POSIX's Seconds Since the Epoch, also known as Unix Time.
The nanoseconds field of the output is always less than 1000000000.
Return values
resolution: func
Query the resolution of the clock.
The nanoseconds field of the output is always less than 1000000000.
Return values
Import interface wasi:observe/tracer
Types
type datetime
Represents a unit of work or operation.
enum span-kind
Describes the relationship between the Span, its parents, and its children in a trace.
Enum Cases
-
Indicates that the span describes a request to some remote service. This span is usually the parent of a remote server span and does not end until the response is received.
-
Indicates that the span covers server-side handling of a synchronous RPC or other remote request. This span is often the child of a remote client span that was expected to wait for a response.
-
Indicates that the span describes the initiators of an asynchronous request. This parent span will often end before the corresponding child consumer span, possibly even before the child span starts. In messaging scenarios with batching, tracing individual messages requires a new producer span per message to be created.
-
Indicates that the span describes a child of an asynchronous consumer request.
-
Default value. Indicates that the span represents an internal operation within an application, as opposed to an operations with remote parents or children.
variant status
Variant Cases
-
The default status.
-
The operation has been validated by an Application developer or Operator to have completed successfully.
-
The operation contains an error with a description.
type key
string
The key part of attribute `key-value` pairs.
variant value
The value part of attribute key-value pairs.
Variant Cases
-
A string value.
-
A boolean value.
-
A double precision floating point value.
-
A signed 64 bit integer value.
-
A homogeneous array of string values.
-
A homogeneous array of boolean values.
-
A homogeneous array of double precision floating point values.
-
A homogeneous array of 64 bit integer values.
record key-value
A key-value pair describing an attribute.
Record Fields
type trace-id
string
The trace that this `span-context` belongs to.
16 bytes encoded as a hexadecimal string.
type span-id
string
The id of this `span-context`.
8 bytes encoded as a hexadecimal string.
flags trace-flags
Flags that can be set on a span-context.
Flags members
type trace-state
Carries system-specific configuration data, represented as a list of key-value pairs. `trace-state` allows multiple tracing systems to participate in the same trace.
If any invalid keys or values are provided then the trace-state will be treated as an empty list.
record span-context
Identifying trace information about a span that can be serialized and propagated.
Record Fields
-
The `trace-id` for this `span-context`.
-
The `span-id` for this `span-context`.
-
The `trace-flags` for this `span-context`.
-
Whether this `span-context` was propagated from a remote parent.
-
The `trace-state` for this `span-context`.
record link
Describes a relationship to another span.
Record Fields
-
Denotes which `span` to link to.
-
attributes: list<key-value>Attributes describing the link.
record start-options
Configuration for starting a span.
Record Fields
-
Whether this span should act as the root of a new trace.
-
`span-kind` for the new `span`.
-
attributes: option<list<key-value>>Attributes for the new `span`.
-
links: option<list<link>>`link`'s for the new `span`.
-
timestamp: option<datetime>When the `span` should begin. If this is not provided it defaults to the current time.
Functions
start: func
Starts a new span with the given name and options.
Params
name:stringoptions: option<start-options>
Return values
- own<
span>
[method]span.span-context: func
Get the span-context for this span.
Params
self: borrow<span>
Return values
[method]span.is-recording: func
Returns true when the data provided to this span is captured in some form. If it returns false then any data provided is discarded.
Params
self: borrow<span>
Return values
[method]span.set-attributes: func
Set attributes of this span.
If a key already exists for an attribute of the Span it will be overwritten with the corresponding new value.
Params
[method]span.add-event: func
Adds an event with the provided name at the curent timestamp.
Optionally an alternative timestamp may be provided. You may also provide attributes of this event.
Params
[method]span.add-link: func
Associates this span with another.
Params
[method]span.set-status: func
Override the default span status, which is unset.
Params
[method]span.update-name: func
Updates the span name.
Params
self: borrow<span>name:string
[method]span.end: func
Signals that the operation described by this span has now ended.
If a timestamp is not provided then it is treated equivalent to passing the current time. Dropping this resource is the equivalent of calling end(none).