From da8375a062db700bfa852e9418a2d836da1899e5 Mon Sep 17 00:00:00 2001 From: Nikita Volodin Date: Tue, 5 Mar 2024 20:47:19 -0500 Subject: [PATCH] wip: log attributes --- .../pkg/envoyfilter/filter.go | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/privacy-profile-composer/pkg/envoyfilter/filter.go b/privacy-profile-composer/pkg/envoyfilter/filter.go index 44aecdc7..c2232848 100644 --- a/privacy-profile-composer/pkg/envoyfilter/filter.go +++ b/privacy-profile-composer/pkg/envoyfilter/filter.go @@ -59,6 +59,19 @@ type Filter struct { func (f *Filter) DecodeHeaders(header api.RequestHeaderMap, endStream bool) api.StatusType { log.Println(">>> DECODE HEADERS") + log.Println("AS MANY ATTRIBUTES AS POSSIBLE") + attrs := []string{ + "request.path", "request.host", + "response.flags", "response.code_details", + "source.address", "source.port", "destination.address", "destination.port", + "connection.id", "connection.requested_server_name", + "upstream.address", "upstream.port", "upstream.local_address", + } + for _, attr := range attrs { + val, err := f.callbacks.GetProperty(attr) + log.Printf("%s :: %s\n:: %s\n", attr, err, val) + } + f.parentSpanContext = f.tracer.Extract(header) span := f.tracer.StartSpan("test span in decode headers", zipkin.Parent(f.parentSpanContext)) @@ -157,6 +170,19 @@ func (f *Filter) DecodeTrailers(trailers api.RequestTrailerMap) api.StatusType { func (f *Filter) EncodeHeaders(header api.ResponseHeaderMap, endStream bool) api.StatusType { log.Println("<<< ENCODE HEADERS") + log.Println("AS MANY ATTRIBUTES AS POSSIBLE") + attrs := []string{ + "request.path", "request.host", + "response.flags", "response.code_details", + "source.address", "source.port", "destination.address", "destination.port", + "connection.id", "connection.requested_server_name", + "upstream.address", "upstream.port", "upstream.local_address", + } + for _, attr := range attrs { + val, err := f.callbacks.GetProperty(attr) + log.Printf("%s :: %s\n:: %s\n", attr, err, val) + } + common.LogEncodeHeaderData(header) span := f.tracer.StartSpan("test span in encode headers", zipkin.Parent(f.parentSpanContext))