Skip to content

Commit

Permalink
feat: support sentry sdk 'X-Sentry-Auth' header (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
wrn14897 authored Jul 15, 2024
1 parent 77df4f5 commit 4d6b362
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/violet-ads-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperdx/api': minor
'@hyperdx/app': minor
---

feat: support sentry sdk 'X-Sentry-Auth' header
17 changes: 17 additions & 0 deletions docker/ingestor/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,24 @@ inputs = ["http_server"]
source = '''
.hdx_content_type = del(."Content-Type")
.hdx_trace_id = split(del(.Traceparent), "-")[1] ?? null
tmp_sentry_auth = del(."X-Sentry-Auth")
# Hack sentry 😎
# for client like ruby
if is_string(tmp_sentry_auth) {
# input example: Sentry sentry_version=7, sentry_client=sentry-ruby/5.18.1, sentry_timestamp=1720998946, sentry_key=blabla
tmp_sentry_auth_headers = parse_key_value(tmp_sentry_auth, field_delimiter:",") ?? null
if is_object(tmp_sentry_auth_headers) {
.sentry_version = tmp_sentry_auth_headers."Sentry sentry_version"
.sentry_client = tmp_sentry_auth_headers.sentry_client
.sentry_key = tmp_sentry_auth_headers.sentry_key
tmp_timestamp = tmp_sentry_auth_headers.sentry_timestamp
if !is_nullish(tmp_timestamp) {
# override timestamp so its type is consistent
.b.timestamp = tmp_timestamp
}
}
}
if is_string(.sentry_key) && length(to_string(.sentry_key) ?? "") == 32 {
.hdx_content_type = "application/json"
.hdx_platform = "sentry"
Expand Down Expand Up @@ -548,6 +564,7 @@ del(.timestamp)
del(.authorization)
del(.hdx_content_type)
del(.hdx_trace_id)
del(.sentry_client)
del(.sentry_key)
del(.sentry_version)
'''
Expand Down
3 changes: 2 additions & 1 deletion docker/ingestor/sources.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[sources.http_server]
type = "http_server"
address = "0.0.0.0:8002"
headers = ["authorization", "Content-Type", "Traceparent"]
headers = ["authorization", "Content-Type", "Traceparent", "X-Sentry-Auth"]
strict_path = false
path = ""
query_parameters = [
"hdx_platform",
"hdx_token",
"sentry_client",
"sentry_key",
"sentry_version"
]

0 comments on commit 4d6b362

Please sign in to comment.