Skip to content

Commit

Permalink
fixed updateKernelTelemetry func
Browse files Browse the repository at this point in the history
  • Loading branch information
amitslavin committed Nov 26, 2023
1 parent 4c741d3 commit e4d2518
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions pkg/network/protocols/http2/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,19 @@ func (p *protocol) PreStart(mgr *manager.Manager) (err error) {
func (p *protocol) PostStart(mgr *manager.Manager) error {
// Setup map cleaner after manager start.
ticker := time.NewTicker(10 * time.Second)
http2Telemetry := &HTTP2Telemetry{}

mp, _, err := mgr.GetMap(telemetryMap)
if err != nil {
log.Warnf("error retrieving http2 telemetry map: %s", err)
}
go func() {
defer ticker.Stop()

for {
select {
case <-ticker.C:
p.updateKernelTelemetry(mgr)
p.updateKernelTelemetry(http2Telemetry, mp)
}
}
}()
Expand Down Expand Up @@ -362,15 +368,8 @@ func (p *protocol) GetStats() *protocols.ProtocolStats {
}

// updateKernelTelemetry updates the HTTP/2 kernel telemetry.
func (p *protocol) updateKernelTelemetry(mgr *manager.Manager) {
func (p *protocol) updateKernelTelemetry(http2Telemetry *HTTP2Telemetry, mp *ebpf.Map) {
var zero uint32
http2Telemetry := &HTTP2Telemetry{}

mp, _, err := mgr.GetMap(telemetryMap)
if err != nil {
log.Warnf("error retrieving http2 telemetry map: %s", err)
return
}

if err := mp.Lookup(unsafe.Pointer(&zero), unsafe.Pointer(http2Telemetry)); err != nil {
log.Warnf("unable to lookup http2 telemetry map: %s", err)
Expand Down

0 comments on commit e4d2518

Please sign in to comment.