PubsubGrpc.Telemetry (PubsubGrpc v0.4.2)
View SourceTelemetry events emitted by PubsubGrpc.
Events
All events share the prefix [:pubsub_grpc, :request, _] and are produced by
:telemetry.span/3. Three events are emitted per operation:
[:pubsub_grpc, :request, :start]— measurements%{system_time: integer, monotonic_time: integer}[:pubsub_grpc, :request, :stop]— measurements%{duration: integer, monotonic_time: integer}[:pubsub_grpc, :request, :exception]— emitted when the wrapped function raises
Metadata
Start and stop events carry the operation context. Typical keys:
:operation— atom, e.g.:publish,:pull,:acknowledge,:create_topic:project_id— Google Cloud project id (always present):topic_id,:subscription_id,:schema_id— when applicable:message_count— for:publishand:pull(where known up front)
Stop events additionally include:
:result—:okfor success,{:error, error_code}for known errors,:unknownfor unexpected return shapes
Example
:telemetry.attach(
"pubsub-grpc-logger",
[:pubsub_grpc, :request, :stop],
fn _event, %{duration: duration}, %{operation: op, result: result}, _config ->
IO.inspect({op, result, System.convert_time_unit(duration, :native, :millisecond)})
end,
nil
)Auth events
Token fetches emit [:pubsub_grpc, :auth, _] events with the same three suffixes.
Stop metadata includes :source (:cache | :goth | :gcloud) when available.