From f6fbf20b801c008ca5c60a9420de7b092863517d Mon Sep 17 00:00:00 2001 From: Naveen Naidu Date: Wed, 14 Apr 2021 16:09:53 +0530 Subject: [PATCH] Server: Format Tracing values to string GitOrigin-RevId: eaa5aba0bc283f36870910671e3336aca0ea8222 --- CHANGELOG.md | 1 + server/src-lib/Hasura/Tracing.hs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c8e0e163f9..e17a24220e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ In the future, we will probably offer a way to explicitly choose which behaviour - server: add a new `/dev/rts_stats` endpoint, enabled when hasura is started with '+RTS -T' - server: re-enable a default HASURA_GRAPHQL_PG_CONN_LIFETIME of 10min - server: support for bigquery datasets +- server: format the values of `injectEventContext` as hexadecimal string instead of integer (fix #6465) - console: add custom_column_names to track_table request with replaced invalid characters (#992) - console: add details button to the success notification to see inserted row - console: add request preview for REST endpoints diff --git a/server/src-lib/Hasura/Tracing.hs b/server/src-lib/Hasura/Tracing.hs index f3e180d999a..35da15993b1 100644 --- a/server/src-lib/Hasura/Tracing.hs +++ b/server/src-lib/Hasura/Tracing.hs @@ -247,8 +247,8 @@ extractHttpContext hdrs = do injectEventContext :: TraceContext -> J.Value injectEventContext TraceContext{..} = J.object - [ "trace_id" J..= tcCurrentTrace - , "span_id" J..= tcCurrentSpan + [ "trace_id" J..= word64ToHex tcCurrentTrace + , "span_id" J..= word64ToHex tcCurrentSpan ] -- | Extract a trace context from an event trigger payload. @@ -256,9 +256,9 @@ extractEventContext :: J.Value -> IO (Maybe TraceContext) extractEventContext e = do freshSpanId <- liftIO Rand.randomIO pure $ TraceContext - <$> (e ^? JL.key "trace_context" . JL.key "trace_id" . JL._Integral) + <$> (hexToWord64 =<< e ^? JL.key "trace_context" . JL.key "trace_id" . JL._String) <*> pure freshSpanId - <*> pure (e ^? JL.key "trace_context" . JL.key "span_id" . JL._Integral) + <*> pure (hexToWord64 =<< e ^? JL.key "trace_context" . JL.key "span_id" . JL._String) -- | Perform HTTP request which supports Trace headers tracedHttpRequest