Skip to content

Commit bfbcde5

Browse files
committed
apply suggestions from code review
1 parent 881f253 commit bfbcde5

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

.chloggen/datadogconnector-add-stats-obfuscation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ component: datadogconnector
1010
note: Support obfuscating sql queries in APM stats
1111

1212
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13-
issues: [35401]
13+
issues: [37457]
1414

1515
# (Optional) One or more lines of additional information to render under the primary note.
1616
# These lines will be padded with 2 spaces and then inserted directly into the document.

connector/datadogconnector/connector_native.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ func (c *traceToMetricConnectorNative) Shutdown(context.Context) error {
116116
c.logger.Info("Stopping obfuscator and concentrator")
117117
// stop the obfuscator and concentrator and wait for the run loop to exit
118118
c.obfuscator.Stop()
119-
c.logger.Info("Stopping concentrator")
120-
// stop the concentrator and wait for the run loop to exit
121119
c.concentrator.Stop()
122120
c.exit <- struct{}{} // signal exit
123121
<-c.exit // wait for close

connector/datadogconnector/connector_native_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ func creteConnectorNativeWithCfg(t *testing.T, cfg *Config) (*traceToMetricConne
7373

7474
connector, ok := tconn.(*traceToMetricConnectorNative)
7575
require.True(t, ok)
76+
oconf := obfuscate.Config{Redis: obfuscate.RedisConfig{Enabled: false}}
77+
connector.obfuscator = obfuscate.NewObfuscator(oconf)
7678
return connector, metricsSink
7779
}
7880

@@ -273,12 +275,15 @@ func testMeasuredAndClientKindNative(t *testing.T, enableOperationAndResourceNam
273275
func TestObfuscate(t *testing.T) {
274276
cfg := NewFactory().CreateDefaultConfig().(*Config)
275277
cfg.Traces.BucketInterval = time.Second
276-
connector, metricsSink := creteConnectorNativeWithCfg(t, cfg)
277278

278-
oconf := obfuscate.Config{Redis: obfuscate.RedisConfig{Enabled: true}}
279-
connector.obfuscator = obfuscate.NewObfuscator(oconf)
280-
connector.tcfg.Features["enable_receive_resource_spans_v2"] = struct{}{}
281-
connector.tcfg.Features["enable_operation_and_resource_name_logic_v2"] = struct{}{}
279+
if err := featuregate.GlobalRegistry().Set("datadog.EnableReceiveResourceSpansV2", true); err != nil {
280+
t.Fatal(err)
281+
}
282+
if err := featuregate.GlobalRegistry().Set("datadog.EnableOperationAndResourceNameV2", true); err != nil {
283+
t.Fatal(err)
284+
}
285+
286+
connector, metricsSink := creteConnectorNativeWithCfg(t, cfg)
282287

283288
err := connector.Start(context.Background(), componenttest.NewNopHost())
284289
require.NoError(t, err)

0 commit comments

Comments
 (0)