File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed
Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 290290 ''
291291 #!${ pkgs . stdenv . shell }
292292
293+ export TRACE_DISPATCHER_LOGGING_HOSTNAME=${ name }
294+
293295 ${ service . script }
294296 ''
295297 ;
Original file line number Diff line number Diff line change 11# Revision history for trace-dispatcher
22
3- ## 2.11.1 -- Jan 2026
3+ ## 2.11.1 -- Feb 2026
44
55* Add strict ` contramap' ` (infix alias ` >!$!< ` ) to the API, capturing a common pattern to avoid unintentional space leaks when composing tracers
66* Increase ` PrometheusSimple ` robustness by restarting the backend upon crash, adding start/stop traces and more eagerly reaping of dangling sockets
7+ * Setting the ` TRACE_DISPATCHER_LOGGING_HOSTNAME ` environment variable will override the system hostname in trace messages.
78* Increased strictness when storing traced ` DataPoints `
89* Drastically reduced fallback value for forwarding queue capacity to minimize impact of forwarding service interruption on heap size and retention
910* Removed ` TraceConfig.tcPeerFrequency ` and hence ` TraceOptionPeerFrequency ` from config representation
Original file line number Diff line number Diff line change @@ -39,14 +39,20 @@ import Data.Text.Lazy.Builder as TB
3939import Data.Text.Lazy.Encoding (decodeUtf8 )
4040import Data.Time (defaultTimeLocale , formatTime , getCurrentTime )
4141import Network.HostName
42+ import System.Environment (lookupEnv )
4243import System.IO.Unsafe (unsafePerformIO )
4344
4445
45- -- If the hostname in the logs should be anything different from the system reported hostname,
46- -- a new field would need to be added to PreFormatted to carry a new hostname argument to preFormatted.
46+ -- | If the @TRACE_DISPATCHER_LOGGING_HOSTNAME@ environment variable is set,
47+ -- it overrides the system hostname in the trace message. This is useful when
48+ -- multiple instances of a service or application on the same host.
4749hostname :: Text
4850{-# NOINLINE hostname #-}
49- hostname = unsafePerformIO $ T. pack <$> getHostName
51+ hostname = unsafePerformIO $
52+ lookupEnv " TRACE_DISPATCHER_LOGGING_HOSTNAME" >>= maybe hostNameOnly (pure . T. pack)
53+ where
54+ -- disregard FQDNs
55+ hostNameOnly = T. pack . takeWhile (/= ' .' ) <$> getHostName
5056
5157
5258-- | Format this trace as metrics
You can’t perform that action at this time.
0 commit comments