Skip to content

Commit

Permalink
wip: log attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
qlonik committed Mar 6, 2024
1 parent b0bad2e commit da8375a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions privacy-profile-composer/pkg/envoyfilter/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit da8375a

Please sign in to comment.