From 827c9eb5f60c8e3d6812cdae8a6c078ce0551b07 Mon Sep 17 00:00:00 2001 From: Evan Purkhiser Date: Fri, 22 Nov 2024 11:17:19 -0500 Subject: [PATCH] feat(uptime): Add missing User-Agent to example http request --- .../app/views/alerts/rules/uptime/httpSnippet.spec.tsx | 1 + static/app/views/alerts/rules/uptime/httpSnippet.tsx | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/static/app/views/alerts/rules/uptime/httpSnippet.spec.tsx b/static/app/views/alerts/rules/uptime/httpSnippet.spec.tsx index 7df1d079e87259..f49f860ef51558 100644 --- a/static/app/views/alerts/rules/uptime/httpSnippet.spec.tsx +++ b/static/app/views/alerts/rules/uptime/httpSnippet.spec.tsx @@ -31,6 +31,7 @@ describe('HTTPSnippet', function () { 'POST /test?query=value HTTP/1.1', 'Host: example.com', 'X-Something: Header Value', + 'User-Agent: SentryUptimeBot/1.0 (+http://docs.sentry.io/product/alerts/uptime-monitoring/', 'Sentry-Trace: sentry-trace-value', 'Content-Size: 18', ``, diff --git a/static/app/views/alerts/rules/uptime/httpSnippet.tsx b/static/app/views/alerts/rules/uptime/httpSnippet.tsx index 4eb4870d19ddaf..51953fa40ae5cb 100644 --- a/static/app/views/alerts/rules/uptime/httpSnippet.tsx +++ b/static/app/views/alerts/rules/uptime/httpSnippet.tsx @@ -32,7 +32,14 @@ export function HTTPSnippet({body, headers, method, url, traceSampling}: Props) : urlObject.pathname; const appendedBody = body ? `\r\n${body}` : ''; - const additionaLheaders = [...headers, ['Sentry-Trace', exampleTrace]]; + const additionaLheaders = [ + ...headers, + [ + 'User-Agent', + 'SentryUptimeBot/1.0 (+http://docs.sentry.io/product/alerts/uptime-monitoring/', + ], + ['Sentry-Trace', exampleTrace], + ]; if (appendedBody !== '') { additionaLheaders.push(['Content-Size', new Blob([appendedBody]).size.toString()]);