Skip to content

Commit

Permalink
NR-91503 feat: protocol_v4_enabled FF enabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenruizdegauna committed Feb 23, 2023
1 parent f241c7b commit 8b8d02d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/integrations/v4/dm/emitter.go
Expand Up @@ -203,7 +203,8 @@ func emitMetrics(metricSender MetricsSender,
metadata integration.Definition,
dataset protocol.Dataset,
annotations map[string]string,
labels map[string]string) {
labels map[string]string,
) {
dmProcessor := IntegrationProcessor{
IntegrationInterval: metadata.Interval,
IntegrationLabels: labels,
Expand All @@ -221,7 +222,8 @@ func emitInventory(
integrationMetadata protocol.IntegrationMetadata,
entityID entity.ID,
dataSet protocol.Dataset,
labels map[string]string) {
labels map[string]string,
) {
logEntry := elog.WithField("action", "EmitV4DataSet")

integrationUser := metadata.ExecutorConfig.User
Expand Down Expand Up @@ -294,7 +296,7 @@ func ParsePayloadV4(raw []byte, ffManager feature_flags.Retriever) (dataV4 proto
return
}

if enabled, ok := ffManager.GetFeatureFlag(fflag.FlagProtocolV4); !ok || !enabled {
if enabled, exists := ffManager.GetFeatureFlag(fflag.FlagProtocolV4); exists && !enabled {
err = ProtocolV4NotEnabledErr
return
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/integrations/v4/dm/emitter_test.go
Expand Up @@ -103,6 +103,14 @@ func TestParsePayloadV4_embeddedInventoryItems(t *testing.T) {
func TestParsePayloadV4_noFF(t *testing.T) {
ffm := feature_flags.NewManager(map[string]bool{})

d, err := ParsePayloadV4(integrationFixture.ProtocolV4.Payload, ffm)
assert.NoError(t, err)
assert.EqualValues(t, integrationFixture.ProtocolV4.ParsedV4, d)
}

func TestParsePayloadV4_FF_disabled(t *testing.T) {
ffm := feature_flags.NewManager(map[string]bool{fflag.FlagProtocolV4: false})

_, err := ParsePayloadV4(integrationFixture.ProtocolV4.Payload, ffm)
assert.Equal(t, ProtocolV4NotEnabledErr, err)
}
Expand Down

0 comments on commit 8b8d02d

Please sign in to comment.