@@ -25,22 +25,21 @@ import (
2525 "strings"
2626 "sync"
2727
28- "github.com/honeycombio/libhoney-go"
2928 "github.com/lacework/go-sdk/v2/api"
3029 "github.com/lacework/go-sdk/v2/lwdomain"
3130)
3231
3332var (
34- // HoneyDataset is the dataset in Honeycomb that we send tracing
33+ // MetricDataset is the dataset in Elastic that we send tracing
3534 // data this variable will be set depending on the environment we
3635 // are running on. During development, we send all events and
3736 // tracing data to a default dataset.
38- HoneyDataset = "lacework-cli-dev"
37+ MetricDataset = "lacework-cli-dev"
3938)
4039
4140const (
4241 // DisableTelemetry is an environment variable that can be used to
43- // disable telemetry sent to Honeycomb
42+ // disable telemetry sent to Elastic
4443 DisableTelemetry = "LW_TELEMETRY_DISABLE"
4544
4645 // HomebrewInstall is an environment variable that denotes the
@@ -54,13 +53,13 @@ const (
5453 // List of Features
5554 //
5655 // A feature within the Lacework CLI is any functionality that
57- // can't be traced or tracked by the default event sent to Honeycomb ,
56+ // can't be traced or tracked by the default event sent to Elastic ,
5857 // it is a behavior that we, Lacework engineers, would like to
5958 // trace and understand its usage and adoption.
6059 //
61- // By default the Feature field within the Honeyvent is empty,
60+ // By default the Feature field within the MetricEvent is empty,
6261 // define a new feature below and set it before sending a new
63- // Honeyvent . Additionally, there is a FeatureData field that
62+ // MetricEvent . Additionally, there is a FeatureData field that
6463 // any feature can use to inject any specific information
6564 // related to that feature.
6665 //
@@ -69,7 +68,7 @@ const (
6968 // ```go
7069 // cli.Event.Feature = featPollCtrScan
7170 // cli.Event.AddFeatureField("key", "value")
72- // cli.SendHoneyvent ()
71+ // cli.SendMetricEvent ()
7372 // ```
7473 //
7574 // Polling mechanism feature
@@ -91,11 +90,11 @@ const (
9190 featMigrateConfigV2 = "migrate_config_v2"
9291)
9392
94- // InitHoneyvent initialize honeycomb library and main Honeyvent , such event
93+ // InitMetricEvent initialize Elastic library and main MetricEvent , such event
9594// could be modified during a command execution to add extra parameters such
9695// as error message, feature data, etc.
97- func (c * cliState ) InitHoneyvent () {
98- c .Event = & api.Honeyvent {
96+ func (c * cliState ) InitMetricEvent () {
97+ c .Event = & api.MetricEvent {
9998 Os : runtime .GOOS ,
10099 Arch : runtime .GOARCH ,
101100 Version : Version ,
@@ -106,36 +105,33 @@ func (c *cliState) InitHoneyvent() {
106105 CfgVersion : c .CfgVersion ,
107106 TraceID : newID (),
108107 InstallMethod : installMethod (),
109- Dataset : HoneyDataset ,
108+ Dataset : MetricDataset ,
110109 }
111110}
112111
113112// Wait should be called before finishing the execution of any CLI command,
114- // it waits for pending workers (a.k.a. honeyvents ) to be transmitted
113+ // it waits for pending workers (a.k.a. MetricEvents ) to be transmitted
115114func (c * cliState ) Wait () {
116115 // wait for any missing worker
117116 c .workers .Wait ()
118117
119- // flush any pending calls to Honeycomb
120- libhoney .Close ()
121-
122118 // stop gRPC server gracefully
123119 c .Stop ()
124120}
125121
126- // SendHoneyvent is used throughout the CLI to send Honeyvents , these events
122+ // SendMetricEvent is used throughout the CLI to send metric events , these events
127123// have tracing data to understand how the commands are being executed, what
128124// features are used and the overall command flow. This function sends the
129125// events via goroutines so that we don't block the execution of the main process
130126//
131127// NOTE: the CLI will send at least one event per command execution
132- func (c * cliState ) SendHoneyvent () {
128+ func (c * cliState ) SendMetricEvent () {
133129 if disabled := os .Getenv (DisableTelemetry ); disabled != "" {
134130 return
135131 }
136132
137133 if c .LwApi == nil {
138- c .Log .Debug ("unable to send honeyvent " , "error" )
134+ c .Log .Debug ("unable to send MetricEvent " , "error" )
139135 return
140136 }
141137
@@ -154,8 +150,7 @@ func (c *cliState) SendHoneyvent() {
154150
155151 // Lacework accounts are NOT case-sensitive but some users configure them
156152 // in uppercase and others in lowercase, therefore we will normalize all
157- // account to be lowercase so that we don't see different accounts in
158- // Honeycomb.
153+ // account to be lowercase so that we don't see different accounts in metrics.
159154 c .Event .Account = strings .ToLower (c .Event .Account )
160155
161156 // Detect if the account has the full domain, if so, subtract the account
@@ -166,31 +161,30 @@ func (c *cliState) SendHoneyvent() {
166161 }
167162 }
168163
169- c .Log .Debugw ("new honeyvent " , "dataset" , HoneyDataset ,
164+ c .Log .Debugw ("new metric event " , "dataset" , MetricDataset ,
170165 "trace_id" , c .Event .TraceID ,
171166 "span_id" , c .Event .SpanID ,
172167 "parent_id" , c .Event .ParentID ,
173168 "context_id" , c .Event .ContextID ,
174169 )
175- honeyvent := libhoney .NewEvent ()
176- _ = honeyvent .Add (c .Event )
177- honeycombEvent := * c .Event
178- honeycombEvent .Dataset = c .Event .Dataset
170+
171+ event := * c .Event
172+ event .Dataset = c .Event .Dataset
179173
180174 c .workers .Add (1 )
181- go func (wg * sync.WaitGroup , event * libhoney. Event , honeycombEvent api.Honeyvent ) {
175+ go func (wg * sync.WaitGroup , event api.MetricEvent ) {
182176 defer wg .Done ()
183177
184- c .Log .Debugw ("sending honeyvent " , "dataset" , HoneyDataset )
178+ c .Log .Debugw ("sending MetricEvent " , "dataset" , MetricDataset )
185179
186- _ , err := c .LwApi .V2 .Metrics .Send (honeycombEvent )
180+ err := c .LwApi .V2 .Metrics .Send (event )
187181 if err != nil {
188- c .Log .Debugw ("unable to send honeyvent " , "error" , err )
182+ c .Log .Debugw ("unable to send MetricEvent " , "error" , err )
189183 }
190184
191- }(& c .workers , honeyvent , honeycombEvent )
185+ }(& c .workers , event )
192186
193- // after adding a worker to submit a honeyvent , we remove
187+ // after adding a worker to submit a metric event , we remove
194188 // all temporal fields such as feature, feature.data, error
195189 c .Event .DurationMs = 0
196190 c .Event .Error = ""
0 commit comments