Skip to content

Commit

Permalink
changed http2Telemetry to be updated better
Browse files Browse the repository at this point in the history
  • Loading branch information
amitslavin committed Nov 23, 2023
1 parent 7f1b8e4 commit 5a2afdf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
16 changes: 1 addition & 15 deletions pkg/network/protocols/http2/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
18 changes: 18 additions & 0 deletions pkg/network/protocols/http2/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

0 comments on commit 5a2afdf

Please sign in to comment.