Skip to content

Commit

Permalink
apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgopack4 committed Jan 24, 2025
1 parent 7d54a4d commit 98616a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .chloggen/datadogconnector-add-stats-obfuscation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ component: datadogconnector
note: Support obfuscating sql queries in APM stats

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

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
Expand Down
2 changes: 0 additions & 2 deletions connector/datadogconnector/connector_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ func (c *traceToMetricConnectorNative) Shutdown(context.Context) error {
c.logger.Info("Stopping obfuscator and concentrator")
// stop the obfuscator and concentrator and wait for the run loop to exit
c.obfuscator.Stop()
c.logger.Info("Stopping concentrator")
// stop the concentrator and wait for the run loop to exit
c.concentrator.Stop()
c.exit <- struct{}{} // signal exit
<-c.exit // wait for close
Expand Down
15 changes: 10 additions & 5 deletions connector/datadogconnector/connector_native_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ func creteConnectorNativeWithCfg(t *testing.T, cfg *Config) (*traceToMetricConne

connector, ok := tconn.(*traceToMetricConnectorNative)
require.True(t, ok)
oconf := obfuscate.Config{Redis: obfuscate.RedisConfig{Enabled: false}}
connector.obfuscator = obfuscate.NewObfuscator(oconf)
return connector, metricsSink
}

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

oconf := obfuscate.Config{Redis: obfuscate.RedisConfig{Enabled: true}}
connector.obfuscator = obfuscate.NewObfuscator(oconf)
connector.tcfg.Features["enable_receive_resource_spans_v2"] = struct{}{}
connector.tcfg.Features["enable_operation_and_resource_name_logic_v2"] = struct{}{}
if err := featuregate.GlobalRegistry().Set("datadog.EnableReceiveResourceSpansV2", true); err != nil {
t.Fatal(err)
}
if err := featuregate.GlobalRegistry().Set("datadog.EnableOperationAndResourceNameV2", true); err != nil {
t.Fatal(err)
}

connector, metricsSink := creteConnectorNativeWithCfg(t, cfg)

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

0 comments on commit 98616a2

Please sign in to comment.