envoy icon indicating copy to clipboard operation
envoy copied to clipboard

Add TypedExtensionConfig type to tap filter output sink

Open ashishb-90 opened this issue 3 years ago • 10 comments

Title: Add TypedExtensionConfig as a new output sink type to enable extensions to write their own sinks for tap output

Description: Currently, the only possible output sinks are an admin endpoint or to the file system. Adding a TypedExtensionConfig will allow Envoy extensions to write custom output sink types for additional protocols and endpoints.

Relevant Links: I have a work in progress pull request. However, before sinking too much time into this, I would like to hear back from the Envoy team and get a better idea of whether this change is something that they would like to merge.

ashishb-90 avatar Aug 04 '23 14:08 ashishb-90

Seems reasonable CC @mattklein123

htuch avatar Aug 04 '23 20:08 htuch

@ashishb-solo This looks great! Can you provide a custom sink extension for example? Thanks!

sjtuzbk avatar Aug 23 '23 08:08 sjtuzbk

@ashishb-solo which custom output sink type do you used for your test? would you share a example? thanks Cliff

coolg92003 avatar Oct 30 '23 03:10 coolg92003

I would also like to see an example for this.

3goats avatar Oct 31 '23 15:10 3goats

@sjtuzbk @coolg92003 @3goats thanks for all your comments - I'm really happy to hear that there's so much interest in this feature! I don't have a working example of a tap filter at the moment, but for now, I would look at the test config for an example of what the Envoy configuration would look like. I'll try my best to find some time to post a more comprehensive example at some point in the future. In the mean time, I'm closing this since #28808 has been merged

ashishb-90 avatar Oct 31 '23 15:10 ashishb-90

Hi @ashishb-solo, CC to @3goats @sjtuzbk thanks in advance! one quick question, when I try to config as below, there is as below exception: [2023-11-01 02:29:40.725][23][critical][main] [source/exe/terminate_handler.cc:30] std::terminate called! Uncaught EnvoyException 'Didn't find a registered implementation for 'custom_sink' with type URL: 'google.protobuf.StringValue'', see trace.

174 const std::string tap_config_yaml = 175 R"EOF( 176 match: 177 any_match: true 178 output_config: 179 sinks: 180 - format: PROTO_BINARY 181 custom_sink: 182 name: custom_sink 183 typed_config: 184 "@type": type.googleapis.cm/google.protobuf.StringValue 185 )EOF"; Therefore, what is the valid url if "type.googleapis.cm/google.protobuf.StringValue" isn't?

thanks Cliff

coolg92003 avatar Nov 01 '23 03:11 coolg92003

There's a typo in there - the o in .com is missing.

I should note that in order to get a working example working, you would have to implement the createSinkPtr interface defined here. The StringValue interface that I used in the test would not implement that so you would likely get some sort of runtime or configuration-time error if you use this code.

Implementing this interface is a bit non-trivial, hence why I haven't gotten around to posting an example yet. Apologies for the delay, but it's most certainly on my todo-list.

ashishb-90 avatar Nov 01 '23 13:11 ashishb-90

Hi @ashishb-solo , Really appreciate your reply! Look forward to your post.

thanks again! Cliff

coolg92003 avatar Nov 02 '23 01:11 coolg92003

Hi @ashishb-solo , Did you get a chance on this? Recently, when we use Tap to do call trace, however, it found there was seriously performance issue. Main thread would be veryvery busy there if there were lots of HTTP message were traced, check below link: https://github.com/envoyproxy/envoy/issues/32068

From our investigation, there is Not short solution for this. Therefore, want to check you whether your solution can solve this issue if there is no code changes.

thanks Cliff

coolg92003 avatar Jan 29 '24 07:01 coolg92003

Anyone got an example for this ? I haven't seen an example of using a custom_sink anywhere

wwadge avatar Sep 24 '24 14:09 wwadge