|
1 | | -use relay_general::store::MeasurementsConfig; |
2 | 1 | use serde::{Deserialize, Serialize}; |
3 | 2 |
|
4 | | -use crate::TaggingRule; |
5 | | - |
6 | 3 | /// A dynamic configuration for all Relays passed down from Sentry. |
7 | 4 | /// |
8 | 5 | /// Values shared across all projects may also be included here, to keep |
9 | 6 | /// [`ProjectConfig`](crate::ProjectConfig)s small. |
10 | 7 | #[derive(Default, Clone, Debug, Serialize, Deserialize)] |
11 | 8 | #[serde(default, rename_all = "camelCase")] |
12 | | -pub struct GlobalConfig { |
13 | | - /// Project configuration for measurements. |
14 | | - #[serde(skip_serializing_if = "Option::is_none")] |
15 | | - measurements: Option<MeasurementsConfig>, |
16 | | - /// Project configuration for rules for applying metrics tags depending on |
17 | | - /// the event's content. |
18 | | - #[serde(skip_serializing_if = "Option::is_none")] |
19 | | - metric_conditional_tagging: Option<Vec<TaggingRule>>, |
20 | | -} |
21 | | - |
22 | | -#[cfg(test)] |
23 | | -mod tests { |
24 | | - use crate::GlobalConfig; |
25 | | - |
26 | | - #[test] |
27 | | - fn test_global_config_roundtrip() { |
28 | | - let json = r#"{ |
29 | | - "measurements": { |
30 | | - "builtinMeasurements": [ |
31 | | - { |
32 | | - "name": "plate.size", |
33 | | - "unit": "5" |
34 | | - } |
35 | | - ], |
36 | | - "maxCustomMeasurements": 2 |
37 | | - }, |
38 | | - "metricConditionalTagging": [ |
39 | | - { |
40 | | - "condition": { |
41 | | - "op": "gt", |
42 | | - "name": "food.deliciousness", |
43 | | - "value": 8 |
44 | | - }, |
45 | | - "targetMetrics": [ |
46 | | - "tummy.satisfaction" |
47 | | - ], |
48 | | - "targetTag": "satisfied", |
49 | | - "tagValue": "hellyeah" |
50 | | - } |
51 | | - ] |
52 | | -}"#; |
53 | | - |
54 | | - let deserialized: GlobalConfig = serde_json::from_str(json).unwrap(); |
55 | | - let reserialized = serde_json::to_string_pretty(&deserialized).unwrap(); |
56 | | - assert_eq!(json, reserialized); |
57 | | - } |
58 | | -} |
| 9 | +pub struct GlobalConfig {} |
0 commit comments