-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to telemetry configuration discovered during docs (#4133)
Note that this code is not currently used, but is needed for the other telemetry PR changes. Various issues with telemetry next config were discovered during documentation. The code changes are addressed in this PR with a separate docs PR in the works. Part of #3226 <!-- start metadata --> --- **Checklist** Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review. - [ ] Changes are compatible[^1] - [ ] Documentation[^2] completed - [ ] Performance impact assessed and acceptable - Tests added and passing[^3] - [ ] Unit Tests - [ ] Integration Tests - [ ] Manual Tests **Exceptions** *Note any exceptions here* **Notes** [^1]: It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. [^2]: Configuration is an important part of many changes. Where applicable please try to document configuration examples. [^3]: Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. Co-authored-by: bryn <[email protected]>
- Loading branch information
Showing
7 changed files
with
247 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
apollo-router/src/plugins/telemetry/config_new/conditions.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use schemars::JsonSchema; | ||
use serde::Deserialize; | ||
|
||
use crate::plugins::telemetry::config::AttributeValue; | ||
|
||
#[allow(dead_code)] | ||
#[derive(Deserialize, JsonSchema, Clone, Debug)] | ||
#[serde(deny_unknown_fields, rename_all = "snake_case")] | ||
pub(crate) enum Condition<T> { | ||
/// A condition to check a selection against a value. | ||
Eq([SelectorOrValue<T>; 2]), | ||
/// All sub-conditions must be true. | ||
All(Vec<Condition<T>>), | ||
/// At least one sub-conditions must be true. | ||
Any(Vec<Condition<T>>), | ||
/// The sub-condition must not be true | ||
Not(Box<Condition<T>>), | ||
} | ||
|
||
impl Condition<()> { | ||
pub(crate) fn empty<T>() -> Condition<T> { | ||
Condition::Any(vec![]) | ||
} | ||
} | ||
|
||
#[allow(dead_code)] | ||
#[derive(Deserialize, JsonSchema, Clone, Debug)] | ||
#[serde(deny_unknown_fields, rename_all = "snake_case", untagged)] | ||
pub(crate) enum SelectorOrValue<T> { | ||
/// A constant value. | ||
Value(AttributeValue), | ||
/// Selector to extract a value from the pipeline. | ||
Selector(T), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.