Skip to content

Commit

Permalink
Revert "🐛[RUMF-809] URL encode tags in intake requests (DataDog#689)"
Browse files Browse the repository at this point in the history
This reverts commit 8b051ea.
  • Loading branch information
kcaffrey authored Jan 29, 2021
1 parent eec4b2d commit f8e43b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
25 changes: 9 additions & 16 deletions packages/core/src/domain/configuration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,34 +62,27 @@ describe('configuration', () => {
describe('sdk_version, env, version and service', () => {
it('should not modify the logs and rum endpoints tags when not defined', () => {
const configuration = buildConfiguration({ clientToken }, usEnv)
expect(decodeURIComponent(configuration.rumEndpoint)).toContain(`&ddtags=sdk_version:${usEnv.sdkVersion}`)
expect(configuration.rumEndpoint).toContain(`&ddtags=sdk_version:${usEnv.sdkVersion}`)

expect(decodeURIComponent(configuration.rumEndpoint)).not.toContain(',env:')
expect(decodeURIComponent(configuration.rumEndpoint)).not.toContain(',service:')
expect(decodeURIComponent(configuration.rumEndpoint)).not.toContain(',version:')
expect(decodeURIComponent(configuration.logsEndpoint)).not.toContain(',env:')
expect(decodeURIComponent(configuration.logsEndpoint)).not.toContain(',service:')
expect(decodeURIComponent(configuration.logsEndpoint)).not.toContain(',version:')
expect(configuration.rumEndpoint).not.toContain(',env:')
expect(configuration.rumEndpoint).not.toContain(',service:')
expect(configuration.rumEndpoint).not.toContain(',version:')
expect(configuration.logsEndpoint).not.toContain(',env:')
expect(configuration.logsEndpoint).not.toContain(',service:')
expect(configuration.logsEndpoint).not.toContain(',version:')
})

it('should be set as tags in the logs and rum endpoints', () => {
const configuration = buildConfiguration({ clientToken, env: 'foo', service: 'bar', version: 'baz' }, usEnv)
expect(decodeURIComponent(configuration.rumEndpoint)).toContain(
expect(configuration.rumEndpoint).toContain(
`&ddtags=sdk_version:${usEnv.sdkVersion},env:foo,service:bar,version:baz`
)
expect(decodeURIComponent(configuration.logsEndpoint)).toContain(
expect(configuration.logsEndpoint).toContain(
`&ddtags=sdk_version:${usEnv.sdkVersion},env:foo,service:bar,version:baz`
)
})
})

describe('tags', () => {
it('should be encoded', () => {
const configuration = buildConfiguration({ clientToken, service: 'bar+foo' }, usEnv)
expect(configuration.rumEndpoint).toContain(`ddtags=sdk_version%3Asome_version%2Cservice%3Abar%2Bfoo`)
})
})

describe('cookie options', () => {
it('should not be secure nor crossSite by default', () => {
const configuration = buildConfiguration({ clientToken }, usEnv)
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/domain/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,7 @@ function getEndpoint(
const host = conf.proxyHost ? conf.proxyHost : datadogHost
const proxyParameter = conf.proxyHost ? `ddhost=${datadogHost}&` : ''
const applicationIdParameter = conf.applicationId ? `_dd.application_id=${conf.applicationId}&` : ''
const parameters = `${applicationIdParameter}${proxyParameter}ddsource=${
source || 'browser'
}&ddtags=${encodeURIComponent(tags)}`
const parameters = `${applicationIdParameter}${proxyParameter}ddsource=${source || 'browser'}&ddtags=${tags}`

return `https://${host}/v1/input/${conf.clientToken}?${parameters}`
}
Expand Down

0 comments on commit f8e43b8

Please sign in to comment.