Skip to content

Commit ec31665

Browse files
authored
Merge pull request #48 from IntersectMBO/coot/prometheus-namespace
Prometheus counters prefix
2 parents 70763da + 29c2816 commit ec31665

6 files changed

Lines changed: 40 additions & 40 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ The `Prometheus` requires a different port number than `cardano-node`'s
149149
}
150150
```
151151

152+
By default all counters are prefixed with `dmq-node_`, this can be changed with
153+
`TraceOptionMetricsPrefix` option in the configuration file, e.g.
154+
```json
155+
{
156+
"TraceOptionMetricsPrefix": "dmq-aggregator"
157+
}
158+
```
159+
152160
## Developing with Nix
153161

154162
To enter a development shell with all dependencies available, use:

cabal.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ index-state:
1818
, hackage.haskell.org 2026-02-17T10:15:41Z
1919

2020
-- Bump this if you need newer packages from CHaP
21-
, cardano-haskell-packages 2026-03-28T08:55:07Z
21+
, cardano-haskell-packages 2026-04-07T08:02:00Z
2222

2323
active-repositories:
2424
, :rest

dmq-node/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
<!-- scriv-insert-here -->
44

5+
<a id='changelog-0.4.2.0'></a>
6+
## 0.4.2.0 -- 2026-04-07
7+
8+
### Non-Breaking
9+
10+
- Changed default prefix for prometheus counters to `dmq-node_` (previously no
11+
prefix was added). The prefix can be changed using
12+
`TraceOptionMetricsPrefix` option in a configuration file.
13+
514
<a id='changelog-0.4.1.0'></a>
615
## 0.4.1.0 -- 2026-04-01
716

dmq-node/dmq-node.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 3.4
22
name: dmq-node
3-
version: 0.4.1.0
3+
version: 0.4.2.0
44
synopsis: Decentralised Message Queue Node
55
description:
66
Decentralised Message Queue Node based on Cardano Diffusion
@@ -136,7 +136,7 @@ library
136136
singletons,
137137
text >=1.2.4 && <2.2,
138138
time >=1.12 && <1.15,
139-
trace-dispatcher ^>=2.12.0,
139+
trace-dispatcher ^>=2.12.1,
140140
transformers,
141141
typed-protocols:{typed-protocols, cborg} ^>=1.2,
142142

dmq-node/src/DMQ/Tracer.hs

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -199,28 +199,6 @@ type DMQDiffusionTracers m =
199199

200200
type PrometheusConfig = Maybe (Bool, Maybe HostName, PortNumber)
201201

202-
-- | Make a default configuration option for a top level namespace.
203-
--
204-
-- * severity `Info`
205-
-- * backend `Stdout MachineFormat`
206-
--
207-
-- NOTE: no prometheus, since we'd need to pick a port number for it.
208-
--
209-
mkDefaultConfig :: [Logging.ConfigOption] -> [Logging.ConfigOption]
210-
mkDefaultConfig cfg =
211-
cfg
212-
++
213-
case filter (\opt -> case opt of
214-
Logging.ConfSeverity{} -> True
215-
_ -> False ) cfg of
216-
[] -> [Logging.ConfSeverity (Logging.SeverityF (Just Logging.Info))]
217-
_ -> []
218-
++
219-
case filter (\opt -> case opt of
220-
Logging.ConfBackend{} -> True
221-
_ -> False) cfg of
222-
[] -> [Logging.ConfBackend [Logging.Stdout Logging.MachineFormat]]
223-
_ -> []
224202

225203
-- | Create and configure `DMQTracers` and `DMQDiffusionTracers`.
226204
--
@@ -242,19 +220,24 @@ mkDMQTracers
242220
)
243221
mkDMQTracers ekgStore dmqConfigFilePath = do
244222
exist <- doesFileExist dmqConfigFilePath
245-
traceConfig' <-
223+
224+
traceConfig <-
246225
if exist
247-
then Logging.readConfiguration dmqConfigFilePath
248-
else return Logging.emptyTraceConfig
249-
let traceConfig = traceConfig'
250-
{ Logging.tcOptions =
251-
Map.alter
252-
(\case
253-
Just a -> Just (mkDefaultConfig a)
254-
Nothing -> Just (mkDefaultConfig []))
255-
mempty
256-
(Logging.tcOptions traceConfig')
257-
}
226+
then
227+
Logging.readConfigurationWithFallbackAndDefault
228+
Logging.Info
229+
Logging.DNormal
230+
(Logging.Stdout Logging.MachineFormat)
231+
dmqConfigFilePath
232+
Logging.emptyTraceConfig { Logging.tcMetricsPrefix = Just "dmq-node_" }
233+
else
234+
return
235+
(Logging.mkConfigurationWithFallback
236+
Logging.Info
237+
Logging.DNormal
238+
(Logging.Stdout Logging.MachineFormat)
239+
) { Logging.tcMetricsPrefix = Just "dmq-node_" }
240+
258241
ekgTrace <- Logging.ekgTracer traceConfig ekgStore
259242

260243
configReflection <- Logging.emptyConfigReflection

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)