We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd76e5a commit d341612Copy full SHA for d341612
cni/telemetry/client/telemetry_client.go
@@ -3,6 +3,7 @@ package telemetryclient
3
import (
4
"fmt"
5
"os"
6
+ "sync"
7
8
"github.com/Azure/azure-container-networking/telemetry"
9
"go.uber.org/zap"
@@ -17,6 +18,7 @@ type TelemetryClient struct {
17
18
CNIReportSettings *telemetry.CNIReport
19
tb *telemetry.TelemetryBuffer
20
logger *zap.Logger
21
+ lock sync.Mutex
22
}
23
24
var Telemetry = NewTelemetryClient(&telemetry.CNIReport{})
@@ -49,6 +51,8 @@ func (c *TelemetryClient) sendTelemetry(msg string) {
49
51
if c.tb == nil {
50
52
return
53
54
+ c.lock.Lock()
55
+ defer c.lock.Unlock()
56
c.CNIReportSettings.EventMessage = msg
57
eventMsg := fmt.Sprintf("[%d] %s", os.Getpid(), msg)
58
c.CNIReportSettings.EventMessage = eventMsg
0 commit comments