Naming and Shaping Events
Design an event around an occurrence an operator needs to identify, query, or investigate. A shared naming scheme and field vocabulary let the same filters and access policies work across components and language SDKs.
The example is a backup package named org.example.backup. It records each
attempt to create a snapshot archive. The
event specification owns the
rules; this guide applies them to an emitter's design.
Before you start #
- Identify the package that owns the event and the operation it describes.
- Inspect the installed event catalog with
evmanfrom Peiosutils. - Identify which facts your component observes and which it receives as claims.
Choose an event rather than a log or metric #
- Ask whether an operator would act on the information. Developer narrative belongs in a log.
- Ask whether one occurrence matters by itself. If only the trend matters, publish a metric instead.
A failed snapshot matters individually, so the backup attempt is an event. The daily amount of backed-up data is a metric. A trace of internal function calls is developer logging. See Event Classification and Tiers.
Name the operation #
-
Start with the owning package name.
-
Add nouns from general to specific where the grouping supports a useful filter or policy boundary.
-
End with a past-tense description of the operation:
org.example.backup.snapshot.created
Use one type for success and failure. A failed creation still uses this type,
with outcome.success = false; do not add a parallel snapshot.failed type.
Use lowercase kebab-case segments, such as copied-up. Short platform roots,
such as kacs, are reserved. Package-name roots and the remaining segments
have their own grammar in Event Types.
Reuse the field vocabulary #
-
Search existing definitions before adding fields:
-
Choose fields by their role:
subjectfor who acted,objectfor what was acted on,sourceanddestinationfor endpoints, andoutcomefor the result. -
If no existing field has the required meaning, define a field beneath the owning package name and its role.
The snapshot uses shared fields plus one package-owned identifier:
| Field | Meaning in the snapshot event |
|---|---|
object.kind | file |
object.file.path | Archive path |
object.file.size | Archive size in bytes, present on success |
object.org.example.backup.snapshot.id | Stable snapshot identifier |
operation.duration | Elapsed nanoseconds |
outcome.success | Whether creation succeeded |
outcome.reason | A declared reason when it failed |
outcome.errno | Negative error number when applicable |
The package owns object.org.example.backup.snapshot.id; it references the
other definitions rather than redefining them. If many components need the
same missing concept, propose a shared field instead of giving it several
incompatible names.
Do not duplicate the timestamp, sequence, or identity fields already stamped in the event header. Use binary security identifiers for principals rather than account names. Omit a field for which no value is available; do not substitute nil, an empty string, or zero. A real zero, such as an empty file's size, remains a meaningful value.
Match the declared wire types #
Choose the encoding from the catalog definition, not from how a value is displayed:
| Value | MessagePack encoding |
|---|---|
| Security identifier (SID) | Binary SID bytes |
| Globally unique identifier (GUID) | 16 raw bytes |
| Timestamp | Unsigned nanoseconds since the Unix epoch |
| Duration | Unsigned nanoseconds |
| Boolean | Boolean value |
| String enumeration | Declared kebab-case string |
| Numeric enumeration | Declared unsigned numeric value |
| Error number | Signed negative integer |
A numeric enumeration is not interchangeable with a string enumeration. Follow the declared field type and its list of values. See Values for the full encoding rules.
Represent dotted paths as nested maps. object.file.path means an object
map containing a file map containing a path key. A literal key named
object.file.path is not that hierarchy. The package-owned identifier has
its own nested object → org → example → backup → snapshot → id
path.
Record the outcome #
- Set
outcome.successto the result of the operation. - On failure, supply a declared
outcome.reason, such asdisk-full. - Include
outcome.errnoonly when an error number applies. Record its negative form, such as-ENOSPC.
The reason is a stable filtering value. Free-form explanation belongs in
outcome.detail when the catalog allows it; consumers should not parse that
text as a replacement for the reason. Describe required and conditional
fields in the fragment so both successful and failed attempts remain valid.
See Outcomes.
Choose the tier and apply policy #
Use standard for ordinary operational records, including this snapshot.
Use verbose for investigation detail and debug for developer detail;
those tiers are off by default. Reserve essential for rare, critical
occurrences or events already governed by their own configuration, such as
access auditing. Essential does not mean that every program's diagnostics
are unconditionally important.
Emission policy is rooted at Machine\Generic\Events, with one key per
segment. This package's subtree is
Machine\Generic\Events\org\example\backup. Check policy before building
and emitting a nonessential record. Consumer-side filtering does not replace
that decision. Read Emission Policy
for inheritance, failure handling, and interactions with other audit controls.
Publish the definition and check the result #
- Describe the event and package-owned field in an
.evmanfragment. - Specify the tier and each field's required, optional, or conditional presence.
- Lint it with the intended catalog and test actual encoded events against it.
- Include the fragment in the package alongside the emitter.
Writing evman Pages contains the matching snapshot fragment and the validation workflow. Keep it as the format example rather than maintaining a second copy here. Emitting Events builds the corresponding payload with the C SDK and explains individual and batch submission.
A well-formed MessagePack value is not necessarily a catalog-conforming event. Check that successful and failed fixtures contain every required field with the declared type, that absent values are omitted, and that queries can reach the nested paths. A successful encoding or emission call does not prove those semantic properties.
If your daemon guards access to its own objects, pass an audit context to the kernel access check instead of inventing a competing access-denial event. Access Decisions explains how the descriptor and audit policy control those records.