mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
c60fcebc12
Summary: `ObservabilityContext` is a structure that helps logging facilities within Mononoke to make logging decisions. Specifically, the upcoming `DynamicLoggingDrain` and already existing `MononokeScubaSampleBuilder` will have this structure as a component and decide whether a particular logging statement (slog or scuba) should go ahead. Internally, `ObservabilityContext` is a wrapper around data received from a [configerator endpoint](https://www.internalfb.com/intern/configerator/edit/?path=scm%2Fmononoke%2Fobservability%2Fobservability_config.cconf). This diff makes a few unobvious decisions about how this is organized. My goals were: 1. to have production (i.e. reading from configerator), static (i.e. emulating current prod behavior) and test variants of `ObservabilityContext` 1. to avoid having consumers know which of these variants are used 1. to avoid making all consumers of `ObservabilityContext` necessarily generic 1. to avoid using dynamic dispatch of `ObservabilityContext`'s methods Points 3 and 4 mean that `ObservabilityContext` cannot be a trait. `enum` is a common solution in such cases. However, if `ObservabilityContext` is an `enum`, consumers will know which variant they are using (because `enum` variants are public). So the solution is to use a private enum wrapped in a struct. Reviewed By: mitrandir77 Differential Revision: D25287759 fbshipit-source-id: da034c71570137e8a8fb7749b1e4ad43be482f66
14 lines
420 B
TOML
14 lines
420 B
TOML
[package]
|
|
name = "observability"
|
|
edition = "2018"
|
|
version = "0.1.0"
|
|
authors = ['Facebook']
|
|
license = "GPLv2+"
|
|
include = ["src/**/*.rs"]
|
|
|
|
[dependencies]
|
|
observability_config = { path = "../../../configerator/structs/scm/mononoke/observability" }
|
|
cached_config = { git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
|
|
anyhow = "1.0"
|
|
slog = { version = "2.5", features = ["max_level_debug"] }
|