Skip to main content

Crate teksilo_telemetry_codegen

Crate teksilo_telemetry_codegen 

Source
Expand description

teksilo-telemetry-codegen — compile-time codegen for Teksilo telemetry.

Consumes a YAML event manifest at build time and expands to:

  • A SCHEMA_VERSION: u32 constant.
  • For each event with enum-typed props: a dedicated enum type with an as_str() method.
  • For each event: a typed emit_<event_name>(reporter, install_id, session_id, …props…) free function that assembles an teksilo_telemetry::Event and hands it to the reporter.

§Usage

ⓘ
// In your app's lib.rs or main.rs:
teksilo_telemetry_codegen::include_telemetry_schema!("telemetry/events.yaml");

The path is resolved relative to CARGO_MANIFEST_DIR (the crate containing the macro invocation).

§YAML format

schema_version: 1
events:
  - name: intent.dispatched
    category: intent
    expires: "2027-06-01"
    bug: "https://github.com/your-org/your-app/issues/42"
    description: "Fired whenever an intent passes through dispatch."
    props:
      - name: name
        type: dev_static
      - name: source
        type: enum
        values: [shortcut, menu, handler, programmatic, accessibility]

§Property types

YAML typeRust typePropValue variant
dev_static&'static strStaticStr
bounded_str&strBoundedStr
u32u32U32
i64i64I64
boolboolBool
f64_bucketteksilo_telemetry::F64BucketF64Bucket
enumgenerated enum (see above)Enum { variant: &'static str }

Macros§

include_telemetry_schema
Expand a YAML telemetry manifest into typed emit_* functions.