From 5a2afdf5b0b9f997fdf0b33d3c2e96c417225ccd Mon Sep 17 00:00:00 2001 From: "amit.slavin" Date: Thu, 23 Nov 2023 15:12:23 +0200 Subject: [PATCH] changed http2Telemetry to be updated better --- pkg/network/protocols/http2/protocol.go | 16 +--------------- pkg/network/protocols/http2/telemetry.go | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/pkg/network/protocols/http2/protocol.go b/pkg/network/protocols/http2/protocol.go index eec1fbef7bd87..2ead128682859 100644 --- a/pkg/network/protocols/http2/protocol.go +++ b/pkg/network/protocols/http2/protocol.go @@ -370,21 +370,7 @@ func (p *protocol) updateKernelTelemetry(mgr *manager.Manager) { return } - p.http2Telemetry.http2requests.Add(int64(http2Telemetry.Request_seen)) - p.http2Telemetry.http2responses.Add(int64(http2Telemetry.Response_seen)) - p.http2Telemetry.endOfStream.Add(int64(http2Telemetry.End_of_stream)) - p.http2Telemetry.endOfStreamRST.Add(int64(http2Telemetry.End_of_stream_rst)) - p.http2Telemetry.pathExceedsFrame.Add(int64(http2Telemetry.Path_exceeds_frame)) - p.http2Telemetry.pathSizeBucket0.Add(int64(http2Telemetry.Path_size_bucket[0])) - p.http2Telemetry.pathSizeBucket1.Add(int64(http2Telemetry.Path_size_bucket[1])) - p.http2Telemetry.pathSizeBucket2.Add(int64(http2Telemetry.Path_size_bucket[2])) - p.http2Telemetry.pathSizeBucket3.Add(int64(http2Telemetry.Path_size_bucket[3])) - p.http2Telemetry.pathSizeBucket4.Add(int64(http2Telemetry.Path_size_bucket[4])) - p.http2Telemetry.pathSizeBucket5.Add(int64(http2Telemetry.Path_size_bucket[5])) - p.http2Telemetry.pathSizeBucket6.Add(int64(http2Telemetry.Path_size_bucket[6])) - p.http2Telemetry.exceedingMaxInterestingFrames.Add(int64(http2Telemetry.Exceeding_max_interesting_frames)) - p.http2Telemetry.exceedingMaxFramesToFilter.Add(int64(http2Telemetry.Exceeding_max_frames_to_filter)) - + p.http2Telemetry.update(http2Telemetry) p.http2Telemetry.Log() time.Sleep(10 * time.Second) } diff --git a/pkg/network/protocols/http2/telemetry.go b/pkg/network/protocols/http2/telemetry.go index 70ce6e8f58074..6eb3bf998f8e5 100644 --- a/pkg/network/protocols/http2/telemetry.go +++ b/pkg/network/protocols/http2/telemetry.go @@ -68,6 +68,24 @@ func newHTTP2KernelTelemetry() *kernelTelemetry { exceedingMaxFramesToFilter: metricGroup.NewCounter("exceeding_max_frames_to_filter")} } +// update updates the kernel metrics with the given telemetry. +func (t *kernelTelemetry) update(tel *HTTP2Telemetry) { + t.http2requests.Add(int64(tel.Request_seen)) + t.http2responses.Add(int64(tel.Response_seen)) + t.endOfStream.Add(int64(tel.End_of_stream)) + t.endOfStreamRST.Add(int64(tel.End_of_stream_rst)) + t.pathExceedsFrame.Add(int64(tel.Path_exceeds_frame)) + t.pathSizeBucket0.Add(int64(tel.Path_size_bucket[0])) + t.pathSizeBucket1.Add(int64(tel.Path_size_bucket[1])) + t.pathSizeBucket2.Add(int64(tel.Path_size_bucket[2])) + t.pathSizeBucket3.Add(int64(tel.Path_size_bucket[3])) + t.pathSizeBucket4.Add(int64(tel.Path_size_bucket[4])) + t.pathSizeBucket5.Add(int64(tel.Path_size_bucket[5])) + t.pathSizeBucket6.Add(int64(tel.Path_size_bucket[6])) + t.exceedingMaxInterestingFrames.Add(int64(tel.Exceeding_max_interesting_frames)) + t.exceedingMaxFramesToFilter.Add(int64(tel.Exceeding_max_frames_to_filter)) +} + func (t *kernelTelemetry) Log() { log.Debugf("http2 kernel telemetry summary: %s", t.metricGroup.Summary()) }