feat: allow users to specify 'service.name' attr (flyio) (#169)

This commit is contained in:
Warren 2023-12-29 10:11:13 -08:00 committed by GitHub
parent 58d928cd7b
commit b8133eb46f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,6 @@
---
'@hyperdx/api': patch
'@hyperdx/app': patch
---
feat: allow users to specify 'service.name' attr (flyio)

View file

@ -303,13 +303,19 @@ if .hdx_platform == "vector-internal" {
if tmp_level != "info" {
.st = tmp_level
}
.sv = .b.fly.app.name
.ts = to_unix_timestamp(parse_timestamp(.b.timestamp, format: "%+") ?? now(), unit: "nanoseconds")
.b._hdx_body = .b.message
structured = parse_json(.b.message) ?? null
if is_object(structured) {
.b = merge(.b, structured, deep: true) ?? .b
}
# use user-specifed service name by default
.sv = .b."service.name"
if is_nullish(.sv) {
.sv = .b.fly.app.name
}
# TODO: maybe move this to post_logs
if !is_nullish(.b.message) {
.b._hdx_body = .b.message