Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 1.28 KB

readme.md

File metadata and controls

25 lines (19 loc) · 1.28 KB

tracing-gcp

If you're writing a webserver in rust and running it on GCP you'll likely want to use this crate.

At lockbook our production server runs in GCP and we want to fully utilize cloud monitoring's structured logging fields.

Tracing gives us the ability to attach context to each log line using Spans. Gcp's ops-agent supports a JSON formatted log lines which allow us to engage with cloud logging in a more sophisticated manner.

This crate provides an opinionated subscriber which extracts the following log metadata from fields in spans or events:

  • severity
  • message
  • source location (file, line, function)
  • http request information
    • method
    • url
    • status
    • user agent
    • remote ip
    • server ip
    • latency
  • remaining "unknown" fields are flattened out and added to "labels"

In the future we may provide a way to send data directly to cloud logging using a client API (reducing the need for the ops agent).

Will document the behavior more thoroughly soon. In the meantime see the test if you want to use this.