-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from instana/correlation_id_support
Support EUM script correlation
- Loading branch information
Showing
10 changed files
with
311 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package instana | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestParseLevel(t *testing.T) { | ||
examples := map[string]struct { | ||
Value string | ||
ExpectedSuppressed bool | ||
ExpectedCorrelation EUMCorrelationData | ||
}{ | ||
"empty header": {}, | ||
"level=0, no correlation id": { | ||
Value: "0", | ||
ExpectedSuppressed: true, | ||
}, | ||
"level=1, no correlation id": { | ||
Value: "1", | ||
}, | ||
"level=0, with correlation id": { | ||
Value: "0 , correlationType=web ;\t correlationId=Test Value", | ||
ExpectedSuppressed: true, | ||
ExpectedCorrelation: EUMCorrelationData{ | ||
Type: "web", | ||
ID: "Test Value", | ||
}, | ||
}, | ||
"level=1, with correlation id": { | ||
Value: "1,correlationType=mobile;correlationId=Test Value", | ||
ExpectedCorrelation: EUMCorrelationData{ | ||
Type: "mobile", | ||
ID: "Test Value", | ||
}, | ||
}, | ||
} | ||
|
||
for name, example := range examples { | ||
t.Run(name, func(t *testing.T) { | ||
suppressed, corrData, err := parseLevel(example.Value) | ||
require.NoError(t, err) | ||
assert.Equal(t, example.ExpectedSuppressed, suppressed) | ||
assert.Equal(t, example.ExpectedCorrelation, corrData) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.