unmbt/ciallo-data/telemetry does not have a README file

    QueryObserver

    type QueryObserver = (QuerySpan) -> Unit

    QuerySpan

    pub(all) struct QuerySpan {
    system : String
    operation : String
    statement : String
    duration_micros : Int64
    ok : Bool
    error_summary : String?
    source_loc : String
    traceparent : String?
    } derive(Eq,
    Debug
    )

    统一数据查询观测 Span(SQL / Redis / MongoDB 共用)

    SingleFlight

    pub struct SingleFlight[V] {
    // private fields
    }

    无锁协作式请求合并器(防缓存击穿与并发回源放大;异常/取消均安全唤醒所有等待协程)

    SingleFlight::SingleFlight

    fn[V] SingleFlight::SingleFlight() -> SingleFlight[V]

    SingleFlight::do_once

    async fn[V] SingleFlight::do_once(self : SingleFlight[V], key : StringView, loader : async () -> V) -> V

    SingleFlight::in_flight_count

    fn[V] SingleFlight::in_flight_count(self : SingleFlight[V]) -> Int

    TelemetryConfig

    pub(all) struct TelemetryConfig {
    slow_threshold_micros : Int64
    sql_commenter : Bool
    observer : (QuerySpan) -> Unit?
    }

    数据观测配置(支持慢查询阈值、SQLCommenter 注入与回调观察器)

    TelemetryConfig::TelemetryConfig

    fn TelemetryConfig::TelemetryConfig(slow_threshold_micros? : Int64, sql_commenter? : Bool, observer? : (QuerySpan) -> Unit) -> TelemetryConfig

    TelemetryConfig::emit

    fn TelemetryConfig::emit(self : TelemetryConfig, span : QuerySpan) -> Unit

    TelemetryConfig::is_slow

    fn TelemetryConfig::is_slow(self : TelemetryConfig, span : QuerySpan) -> Bool

    inject_sql_commenter

    fn inject_sql_commenter(sql : String, traceparent? : String, source_loc? : String, route? : String) -> String

    在 SQL 语句末尾追加 Google SQLCommenter 注释,贯通 W3C traceparent 与源码位置

    Source Files