Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

Commit

Permalink
obfuscate: add web span type to obfuscated HTTP tags (#464)
Browse files Browse the repository at this point in the history
  • Loading branch information
Emanuele Palazzetti committed Jul 26, 2018
1 parent 080cdf5 commit b8cbe80
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion obfuscate/http_test.go
Expand Up @@ -134,7 +134,7 @@ func TestObfuscateHTTP(t *testing.T) {

t.Run("wrong-type", func(t *testing.T) {
assert := assert.New(t)
span := model.Span{Type: "web", Meta: map[string]string{"http.url": testURL}}
span := model.Span{Type: "web_server", Meta: map[string]string{"http.url": testURL}}
cfg := config.HTTPObfuscationConfig{RemoveQueryString: true, RemovePathDigits: true}
NewObfuscator(&config.ObfuscationConfig{HTTP: cfg}).Obfuscate(&span)
assert.Equal(testURL, span.Meta["http.url"])
Expand Down
2 changes: 1 addition & 1 deletion obfuscate/obfuscate.go
Expand Up @@ -47,7 +47,7 @@ func (o *Obfuscator) Obfuscate(span *model.Span) {
if o.opts.Memcached.Enabled {
o.obfuscateMemcached(span)
}
case "http":
case "web", "http":
o.obfuscateHTTP(span)
case "mongodb":
o.obfuscateJSON(span, "mongodb.query", o.mongo)
Expand Down
21 changes: 21 additions & 0 deletions obfuscate/obfuscate_test.go
Expand Up @@ -167,6 +167,27 @@ func TestObfuscateConfig(t *testing.T) {
&config.ObfuscationConfig{},
))

t.Run("web/enabled", testConfig(
"web",
"http.url",
"http://mysite.mydomain/1/2?q=asd",
"http://mysite.mydomain/?/??",
&config.ObfuscationConfig{
HTTP: config.HTTPObfuscationConfig{
RemovePathDigits: true,
RemoveQueryString: true,
},
},
))

t.Run("web/disabled", testConfig(
"web",
"http.url",
"http://mysite.mydomain/1/2?q=asd",
"http://mysite.mydomain/1/2?q=asd",
&config.ObfuscationConfig{},
))

t.Run("json/enabled", testConfig(
"elasticsearch",
"elasticsearch.body",
Expand Down

0 comments on commit b8cbe80

Please sign in to comment.