-
Notifications
You must be signed in to change notification settings - Fork 5.5k
xDS: add xDS config tracker extension point #23485
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
Merged
mattklein123
merged 43 commits into
envoyproxy:main
from
botengyao:xds-metadata-extension-point
Dec 13, 2022
Merged
Changes from 10 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
4d2c47e
intitial commit for xds tracer extension point
botengyao b5234d2
clean up
botengyao ba27917
clean up
botengyao 43b5983
add some docs
botengyao bdc4b16
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 12bb4f3
clean up
botengyao 51533cf
clean up
botengyao 7ac3748
clean up
botengyao a04823a
fix format
botengyao 5f4ed83
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 2ab302b
Add more comments
botengyao 340d71e
fix typo
botengyao ca58505
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao acfb636
make it more generic
botengyao fe3066e
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 2c11de7
clean up
botengyao f19005e
fix format
botengyao 8a4b472
changed name to onConfigReceivedOrFailed
botengyao 11c8def
changed name to onConfigReceivedOrFailed
botengyao a48502a
clean up
botengyao 3efd2b3
add unified mux xds
botengyao 1a65c33
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 6796419
add comments
botengyao 7aec7d1
fix spell
botengyao adaf244
fix ci
botengyao 621327d
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao a144dbd
fix ci
botengyao bf8105c
fix clang
botengyao 91dc002
fix intergration test
botengyao b897721
clean up
botengyao b805acb
fix comments
botengyao ac31b6e
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao a382c6d
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 9b23b37
simplify test
botengyao 41a3f13
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 27d1072
add more integration tests
botengyao 982cd9d
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao cf96f4b
fix typo
botengyao cb9dddb
modify comments and make test specific
botengyao e5a9acc
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 348aa7f
fix typo
botengyao 7a90bcc
modify api comments and add release notes
botengyao 9003a4d
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,96 @@ | ||
| #pragma once | ||
|
|
||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include "envoy/common/optref.h" | ||
| #include "envoy/config/subscription.h" | ||
| #include "envoy/config/typed_config.h" | ||
| #include "envoy/protobuf/message_validator.h" | ||
|
|
||
| #include "source/common/protobuf/protobuf.h" | ||
|
|
||
| #include "google/rpc/status.pb.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Config { | ||
|
|
||
| // The status of processing Delta/DiscoveryResponse. | ||
| enum TraceState { | ||
| // Successfully got the resources or message. | ||
| RECEIVE = 0, | ||
| // Successfully ingested the resouces. | ||
| INGESTED = 1, | ||
| // Failed to apply the resources. | ||
| FAILED = 2, | ||
| }; | ||
|
|
||
| struct TraceDetails { | ||
| TraceDetails(const TraceState state) : state_(state){}; | ||
| TraceDetails(const TraceState state, const ::google::rpc::Status error_detail) | ||
| : state_(state), error_detail_(error_detail){}; | ||
| const TraceState state_; | ||
| ::google::rpc::Status error_detail_; | ||
| }; | ||
|
|
||
| /** | ||
| * An interface for hooking into xDS update events to provide the ablility to use some | ||
| * external logger or processor in xDS update. | ||
| * | ||
| * Instance of this interface get invoked on the main Envoy thread. Thus, it is important | ||
| * for implementations of this interface to not execute any blocking operations on the same | ||
| * thread. | ||
| */ | ||
| class XdsConfigTracer { | ||
|
botengyao marked this conversation as resolved.
Outdated
|
||
| public: | ||
| virtual ~XdsConfigTracer() = default; | ||
|
|
||
| /** | ||
| * Log the decoded SotW xDS resources that are about to be ingested. | ||
| * @param type_url The type url of xDS message. | ||
| * @param resources List of decoded resources that reflect the latest state. | ||
| * @param details The log point state and details. | ||
| */ | ||
| virtual void log(const absl::string_view type_url, | ||
|
botengyao marked this conversation as resolved.
Outdated
|
||
| const std::vector<DecodedResourcePtr>& resources, | ||
| const TraceDetails& details) PURE; | ||
|
|
||
| /** | ||
| * Log point for SotW xDS discovery response. | ||
| * @param message The SotW discovery response message body. | ||
| * @param details The log point state and details. | ||
|
botengyao marked this conversation as resolved.
Outdated
|
||
| */ | ||
| virtual void log(const envoy::service::discovery::v3::DiscoveryResponse& message, | ||
| const TraceDetails& details) PURE; | ||
|
|
||
| /** | ||
| * Log point for Delta xDS discovery response message when received, ingested, and failed. | ||
| * @param message The Delta discovery response message body. | ||
| * @param details The log point state and details. | ||
| */ | ||
| virtual void log(const envoy::service::discovery::v3::DeltaDiscoveryResponse& message, | ||
| const TraceDetails& details) PURE; | ||
| }; | ||
|
|
||
| using XdsConfigTracerPtr = std::unique_ptr<XdsConfigTracer>; | ||
| using XdsConfigTracerOptRef = OptRef<XdsConfigTracer>; | ||
|
|
||
| /** | ||
| * A factory abstract class for creating instances of XdsConfigTracer. | ||
| */ | ||
| class XdsConfigTracerFactory : public Config::TypedFactory { | ||
| public: | ||
| ~XdsConfigTracerFactory() override = default; | ||
|
|
||
| /** | ||
| * Creates an XdsConfigTracer using the given config. | ||
| */ | ||
| virtual XdsConfigTracerPtr | ||
| createXdsConfigTracer(const ProtobufWkt::Any& config, | ||
| ProtobufMessage::ValidationVisitor& validation_visitor) PURE; | ||
|
|
||
| std::string category() const override { return "envoy.config.xds_tracers"; } | ||
| }; | ||
|
|
||
| } // namespace Config | ||
| } // namespace Envoy | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
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.
Why is this not-implemented-hide? Isn't it implemented? Also, can you please add a release note? Thank you.
/wait
Uh oh!
There was an error while loading. Please reload this page.
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.
Thanks! This PR only adds an api extension interface right now, and there is no actual extension implementation. This enables the ability to extend this interface for different use cases. Should I add a release note only for this interface?
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.
The fact that it can be implemented means it's implemented, so I would remove the not-implemented-hide and still add a release note for it. It would be also good to
:repo:link to the test extension so people can look at an example of the API, and I would also mention there are no in-repo extensions currently, etc.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.
Thanks! Done, and waiting CI.