Events and API reference
Use the Owl API to publish observations from applications or to build a stream consumer. The CLI provides the common publishing and replay operations without writing an API client.
The service is owl.v1.OwlService, defined in
proto/owl/v1/owl.proto
in the separate API repository.
The Go server uses the
generated Connect handler. Unary calls can be made with JSON over HTTP;
generated Go and TypeScript clients also support streaming reads.
To inspect the schema and generated code locally, install Git and download the API repository:
mkdir -p ~/src/owl
git clone https://gitlab.com/mergetb/frontends/owl/api.git ~/src/owl/api
cd ~/src/owl/api
If you already have the checkout, enter its directory instead of cloning it
again. For a private repository, authenticate with a GitLab account and a token
with read_repository access when prompted for a password. Schema paths on
this page are relative to this checkout; applications can consume the
versioned Go and npm packages below without a separate API checkout.
Connect a client
Use the backend base URL supplied by your deployment, such as
http://control.infra. Every request names a stream with owlid. For an XDC
viewer, match its attached ID exactly: REALIZATION.EXPERIMENT.PROJECT.
The Go module is gitlab.com/mergetb/frontends/owl/api; protobuf types are in
gen/owl/v1 and the Connect client is in gen/owl/v1/owlv1connect. The browser
uses @mergetb/owl-api and imports owl/v1/owl_pb. The CLI and viewer versions documented here consume API version v0.3.0 / 0.3.0 respectively.
The backend does not implement authentication or stream access checks. Use
its private network endpoint or your deployment's authenticated gateway. The
XDC viewer's /api proxy accepts only the GUI's read, stop, and stream deletion
methods for the attached stream; it is not an event publishing endpoint.
Publish an event with HTTP
This request appends a state change for node server to stream demo:
curl --fail-with-body http://control.infra/owl.v1.OwlService/SetEvent \
-H 'Content-Type: application/json' \
--data '{"owlid":"demo","events":[{"entity":{"entity":{"node":{"id":"server"}},"event":{"state":"STATE_OK","message":"Service ready"}}}]}'
Use your experiment's ID instead of demo to publish to its viewer. The
server creates streams on demand and assigns timestamps when it accepts the
request. A successful SetEvent response is an empty JSON object.
Operations
| RPC | Behavior in this server |
|---|---|
SetEvent | Append one or more StreamEvent records. Send a nonempty events list. |
DeleteEvent | Append an entity deletion record for a node or two-node link. Earlier history remains. |
GetEvents | Read a requested positive count using the client's stored consumer offset. It can wait if fewer events are available. |
GetEventsStream | Read from an offset, stored timestamp position, or live tail, optionally paced by event timestamps. Continues waiting after catching up. |
StopEventsStream | Stop an active streaming reader identified by owlid and clientid on this server process. |
DeleteStream | Delete stored history and recreate an empty stream with the same ID. |
SetLegend | Append a complete legend snapshot. The request field is legend (a list of Event values). |
SetTopology | Append a complete topology snapshot from the request's links list. Use SetEvent with a TopologyEvent to include an explicit node list. |
GetLegend, GetTopology | Declared in the schema but not implemented by this server. Consume snapshot records from event history instead. |
Readers and publishers are independent. Stopping a reader does not stop publishing. Deleting a stream does not stop publishers either; new events can repopulate the empty stream.
Event format
A StreamEvent contains a server-assigned timestamp and exactly one record
kind: entity, legend, or topology. JSON below uses protobuf JSON field
names and enum names. The CLI's send legend and send topology commands take
the snapshot contents directly, without the outer StreamEvent or SetEvent
request wrapper.
Entity changes
An EntityEvent holds an entity and an event. The experiment model defines
every experiment node name. Use those names to update experiment nodes in the
XDC topology; node observations with names outside that model create additional
visualization nodes for observability purposes.
{
"entity": {
"entity": { "node": { "id": "server" } },
"event": {
"state": "STATE_WARNING",
"message": "High latency",
"narrative": "Observed response time exceeded the experiment threshold.",
"duration": "5000"
}
}
}
Each event has exactly one characteristic. To update state and color, publish two entity events. Metadata can accompany any characteristic.
| Field | Value |
|---|---|
state | STATE_UNSPECIFIED (0), STATE_OK (1), STATE_WARNING (2), or STATE_ERROR (3). |
color | An object such as {"color":"#43dbc0"}; the string is a CSS color. |
shape | An object such as {"shape":"square"}. The viewer draws node shapes circle, square, triangle, and star. |
message | Optional short text. |
narrative | Optional detailed text. The viewer prefers this over the message in feed cards. |
duration | Optional unsigned 64-bit milliseconds; protobuf JSON convention encodes this as a decimal string. "0" means no expiry. |
For a link, replace the inner entity with:
{
"link": {
"a": { "id": "server" },
"b": { "id": "client1" }
}
}
The viewer treats endpoint order as interchangeable and updates two-node links already present in the experiment topology. The API accepts shape strings for links, but the viewer does not apply them. LANs with more than two endpoints cannot be addressed by this link format.
The viewer applies a duration from the time it receives the event, then restores the latest unexpired value. Replay starts the timer again, independent of playback speed. Duration is presentation metadata, not a request to remove the record from storage.
Entity deletion
DeleteEvent takes an entity and the stream ID:
{
"owlid": "demo",
"entity": { "node": { "id": "client1" } }
}
The server appends a StreamEvent containing that entity with no event
payload. This is a deletion marker (a tombstone). The viewer removes the
entity; removing a node also removes its links. This does not erase earlier
records or modify the experiment model.
Legend snapshots
The file passed to owl send legend contains an entries array of Event
values. A legend entry associates one characteristic with its description in message:
{
"entries": [
{ "state": "STATE_OK", "message": "Normal operation" },
{ "color": { "color": "#eb5757" }, "message": "Fault highlight" },
{ "shape": { "shape": "square" }, "message": "Service node" }
]
}
In SetEvent, wrap this object as {"legend":{...}} inside the events list.
Each legend snapshot replaces the preceding legend completely. An empty
entries array clears it. For SetLegend, put the entries in the request's
legend array alongside owlid.
Topology snapshots
The file passed to owl send topology lists nodes and two-node links:
{
"nodes": [{ "id": "server" }, { "id": "client1" }],
"links": [{ "a": { "id": "server" }, "b": { "id": "client1" } }]
}
In SetEvent, wrap this object as {"topology":{...}} inside the events list.
A topology snapshot represents a complete replacement rather than a patch;
it can include isolated nodes through the explicit nodes list. The XDC
viewer builds its initial topology from the experiment model retrieved from the
SPHERE portal and ignores these snapshot records for its topology.
Copyable snapshot files are provided in Event examples.
Streaming reads
Use a generated client for GetEventsStream; it uses server streaming rather
than a plain unary JSON response. The request includes an optional client ID,
an offset selector, and playbackSpeed:
{
"owlid": "demo",
"clientid": "my-reader",
"offset": { "offset": "0" },
"playbackSpeed": 1
}
Choose one field within offset:
| Selector | Start position |
|---|---|
{"offset":"42"} | Numeric stream offset. The maximum is 9223372036854775807. |
{"timestamp":"2026-11-17T14:00:00Z"} | RabbitMQ's stored timestamp position at or after the given time. |
{"next":true} | The live tail, excluding earlier history. |
| Omitted | The consumer's last stored offset. The CLI and viewer normally send an explicit start position. |
playbackSpeed is 0 for immediate delivery (the default), 1 for original
timing, 2 for twice speed, or any other finite nonnegative number. Timing
is anchored to the first event in the connection. The Owl server overwrites
submitted timestamps with its receipt time, and all events in one SetEvent
request receive the same timestamp.
Responses carry owlid, clientid, and an events list. Ignore responses
whose keepalive is true. Those messages test the connection and contain no
observations. Process all record kinds in order: legends and topology snapshots
occupy stream positions as well as entity changes. The API does not return
each record's numeric storage offset in its response.
Client IDs should be unique among concurrently active readers of the same
stream. To stop a reader, send StopEventsStream with the same Owl ID and
client ID to the same backend process. stopped: false means no matching active
reader was found. Stored history is limited to the server's configured stream
capacity (currently hard-coded to 2 GB); preserve an external copy if your
application needs an archive.