Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REPLAY-1965 fix: SR data uploads to AP1 site #1418

Merged
merged 3 commits into from
Aug 18, 2023

Conversation

ncreated
Copy link
Member

@ncreated ncreated commented Aug 17, 2023

What and why?

🐞 AP1's site url for Session Replay was wrong, so data uploads would not be possible.

How?

Updating SR upload url to the correct one, by leveraging the base URL provided by SDK core (notably, switching SR to use subdomain-less URL the same way as other products do after RUMM-2865).

Sanity check in US1, works:

[DATADOG SDK] 🐶 → 12:25:53.681    → (session-replay) accepted, won't be retransmitted: [response code: 202 (accepted), request ID: ...]

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes

Custom CI job configuration (optional)

  • Run unit tests
  • Run integration tests
  • Run smoke tests

@ncreated ncreated self-assigned this Aug 17, 2023
@ncreated ncreated marked this pull request as ready for review August 17, 2023 10:32
@ncreated ncreated requested a review from a team as a code owner August 17, 2023 10:32
@@ -97,4 +77,8 @@ internal struct RequestBuilder: FeatureRequestBuilder {
// Data is already compressed, so request building request w/o compression:
return builder.uploadRequest(with: multipart.data, compress: false)
}

private func url(with context: DatadogContext) -> URL {
customUploadURL ?? context.site.endpoint.appendingPathComponent("api/v2/replay")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a part of me preferred full paths, as in this one it's easy to make a typo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding the full path lead us to the problem we fix in this PR 🙂. What we do now is: trust the base URL provided by core SDK and specialise it with SR endpoint. Full URLs are asserted in tests, which gives us clarity and discoverability of expected values.

Note that context.site.endpoint depends on the Datadog site used.

XCTAssertEqual(try url(for: .eu1), "https://session-replay.browser-intake-datadoghq.eu/api/v2/replay")
XCTAssertEqual(try url(for: .ap1), "https://session-replay.browser-intake-datadoghq.eu/api/v2/replay")
XCTAssertEqual(try url(for: .us1_fed), "https://session-replay.browser-intake-ddog-gov.com/api/v2/replay")
XCTAssertEqual(try url(for: .us1), "https://browser-intake-datadoghq.com/api/v2/replay")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we drop session replay subdomain?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we created first iteration of SR (using above URLs), there was a global change to the way we reference intakes, see: RUMM-2865. Here we migrate SR to the subdomain-less URLs. This is for uniformity with other products in the SDK 👌.

maxep
maxep previously approved these changes Aug 17, 2023
Copy link
Member

@maxep maxep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

@ncreated ncreated merged commit e21b0f5 into develop Aug 18, 2023
3 checks passed
@ncreated ncreated deleted the ncreated/REPLAY-1965/fix-sr-url-for-ap1-dc branch August 18, 2023 12:43
@ncreated ncreated mentioned this pull request Aug 18, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants