Skip to content

Commit

Permalink
feat: Enable HTTP URL recording by default (#281)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
Now we strip query string parameters from the Url in #269, we can more
safely default to recording HTTP URL. The option is still be available
to opt-out if desired.

- Closes #280

## Short description of the changes
- Change default value of IncludeRequestURL config option to `true`
- Update unit tests 

## How to verify that this has the expected result
The agent's default behaviour to to record HTTP request URLs. The can be
disabled via setting the config option to false.
  • Loading branch information
MikeGoldsmith committed Oct 13, 2023
1 parent a6d091e commit e25f2fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func NewConfig() Config {
AgentPodIP: utils.LookupEnvOrString("AGENT_POD_IP", ""),
AgentPodName: utils.LookupEnvOrString("AGENT_POD_NAME", ""),
AdditionalAttributes: utils.LookupEnvAsStringMap("ADDITIONAL_ATTRIBUTES"),
IncludeRequestURL: utils.LookupEnvOrBool("INCLUDE_REQUEST_URL", false),
IncludeRequestURL: utils.LookupEnvOrBool("INCLUDE_REQUEST_URL", true),
}
}

Expand Down
6 changes: 3 additions & 3 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestEnvVars(t *testing.T) {
t.Setenv("AGENT_POD_IP", "pod_ip")
t.Setenv("AGENT_POD_NAME", "pod_name")
t.Setenv("ADDITIONAL_ATTRIBUTES", "key1=value1,key2=value2")
t.Setenv("INCLUDE_REQUEST_URL", "true")
t.Setenv("INCLUDE_REQUEST_URL", "false")

config := NewConfig()
assert.Equal(t, "1234567890123456789012", config.APIKey)
Expand All @@ -81,7 +81,7 @@ func TestEnvVars(t *testing.T) {
assert.Equal(t, "pod_ip", config.AgentPodIP)
assert.Equal(t, "pod_name", config.AgentPodName)
assert.Equal(t, map[string]string{"key1": "value1", "key2": "value2"}, config.AdditionalAttributes)
assert.Equal(t, true, config.IncludeRequestURL)
assert.Equal(t, false, config.IncludeRequestURL)
}

func TestEnvVarsDefault(t *testing.T) {
Expand All @@ -105,7 +105,7 @@ func TestEnvVarsDefault(t *testing.T) {
assert.Equal(t, "", config.AgentPodIP)
assert.Equal(t, "", config.AgentPodName)
assert.Equal(t, map[string]string{}, config.AdditionalAttributes)
assert.Equal(t, false, config.IncludeRequestURL)
assert.Equal(t, true, config.IncludeRequestURL)
}

func Test_Config_buildBpfFilter(t *testing.T) {
Expand Down

0 comments on commit e25f2fe

Please sign in to comment.