-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schema Processor Revamp [Part 1] - Operators and Migrators #35214
Closed
ankitpatel96
wants to merge
20
commits into
open-telemetry:main
from
ankitpatel96:ankit-schema-processor-operator
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1fe52c8
operator and migrator support
ankitpatel96 df85bba
update metadata.yaml
ankitpatel96 b51ea3b
add support for log and all type operators in operators
ankitpatel96 92699a5
excise Apply and Rollback in favor of Do
ankitpatel96 49eafe1
simple migrator fix
ankitpatel96 935ff02
new tests for attribute operators
ankitpatel96 361363f
table tests and metrics
ankitpatel96 7f43ce5
move to correct file
ankitpatel96 8df413c
format
ankitpatel96 ad44a65
more operator tests
ankitpatel96 8f533b0
spanevent operator tests
ankitpatel96 0191c3e
lots of comments
ankitpatel96 8f69415
format
ankitpatel96 32b29fa
rename migrator
ankitpatel96 1c4f2b2
switch to generic operator interface
ankitpatel96 4c5c381
rename operator to transformer
ankitpatel96 e858e8f
rename file
ankitpatel96 25f85da
add comment about ambiguous inverts
ankitpatel96 8b3c62b
license files :(
ankitpatel96 21fce18
change md links since there's a linter for it
ankitpatel96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Design | ||
|
||
The Schema Processor is split into several different components. | ||
|
||
Here's a general structure diagram: | ||
|
||
```mermaid | ||
graph LR; | ||
A[Previous Collector Component] --> B[Transformer] | ||
B -- Schema URL --> C[Translation Manager] | ||
C -- Translation --> B | ||
B --> H[Translator] | ||
H --> E[Revision] | ||
E --> I[ChangeList] | ||
subgraph Interpreter | ||
direction RL | ||
I --> F[Transformer] | ||
F --> G[Migrator] | ||
end | ||
|
||
``` | ||
The [Transformer](transformer.go) is registered as a Processor in the Collector by the factory. | ||
Data flows into the Transformer, which uses the Schema URL to fetch the translation from the Translation Manager. | ||
The Translation Manager (at internal/translation/manager.go in a future PR) is responsible for fetching and caching the translations. It takes in a schema URL and returns a Translator struct. | ||
|
||
The Translator struct contains the target schema URL, the target schema version, and a list of Revisions. The Translator figures out what the version of the incoming data is and what Revisions to apply to the incoming data to get it to the target schema version. The Translator is also responsible for applying the Revisions to the incoming data - it iterates through these Revisions and applies them to the incoming data. | ||
|
||
Each Revision represents all the changes within a specific version. It consists of several ChangeLists (at internal/changelist/changelist.go in a future PR) - one for each type of change block (at the time of writing - `all`, `resources`, `spans`, `spanEvents`, `metrics`, `logs`). Each ChangeList is similar to a program in an interpreter - in this case the programming language is the schema file! They iterate through whatever changes they are constructed with, and call a [Transformer](internal/transformer) for each type of change. The Transformer accepts a typed value - a log, a metric, etc. It then, under the hood, calls one of a few Migrators. The Migrators do the fundamental work of changing attributes, changing names, etc. The Migrators generally operate on lower levels than the Transformers - they operate on `Attributes`, or an `alias.NamedSignal` (a signal that implements `Name()` and `SetName()`). |
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
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
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding this document, it is very useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is really awesome, and I also had no idea github support mermaid diagrams.
100% going to start doing this more often.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay I'm glad ya'll like it! I contributed one to the collector too at https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/internal-architecture.md. I hope to make more!