Hi community--I’ve searched the archives for info ...
# pact-broker
d
Hi community--I’ve searched the archives for info about the
/metrics
endpoint and didn’t see any answers to my questions, so I’m asking here. I have a self-hosted pact broker, and I created an application that polls the broker’s
/metrics
endpoint and sends these metrics in to New Relic, where I’ve built a dashboard to show the metrics over time. This polling request happens from 2 different kubernetes pods (HA-setup), every 60 seconds (probably overkill). My new relic query simply selects the latest metrics hit and displays that number. I would expect the
/metrics
numbers to reflect the total accumulated since the database was created, and therefore always be increasing over time. But that’s not the case, as I’m seeing a chart like this:
👏 1
rubberduck 2
✅ 1
the visualization on the left shows the most recent hit. The chart on the right shows the max number for each time bucket.
My question is this: what would explain the metrics number going down over time?
is this verification success metric a counter that tracks from the moment the db is created? or does it get reset ever, such as during db cleanup jobs?
It looks like the code simply queries the database here, so if the cleanup job cleans up the database, that might explain it, but I have my cleanup job running every day and
PACT_BROKER_DATABASE_CLEAN_OVERWRITTEN_DATA_MAX_AGE
is set to
30
, and
PACT_BROKER_DATABASE_CLEAN_KEEP_VERSION_SELECTORS
has the
max_age
property set to
120
, so I just don’t understand how the number could go down within a week (I haven’t had this even running since 30 days ago)
looking at my clean job logs, I do see some verification results were deleted:
Copy code
"Results (0 seconds)","payload":{"pact_publications":{"deleted":0,"kept":156},"verification_res │
│ ults":{"deleted":9,"kept":238},"pact_versions":{"deleted":0,"kept":69},"triggered_webhooks":{"deleted":0,"kept":0}}}
I think this is the cause, I’ll take a look at my cleanup job configs
I double checked my database verifications table and saw that the oldest entry is indeed over 120 days. Mystery explained!
y
Excellent rubber duckying there my friend! The dashboard looks chefkiss Would you be interested in sharing some details about your setup, and experiences with Pact in a blog post sometime. No pressure but I am sure it would be beneficial to others
m
Yes, this is one of the problems with the current “metrics” implementation. We don’t have a separate data store for historical reporting, so it’s only reporting on the live info. We are looking at addressing this in PactFlow, but it’s likely to involve additional infrastructure for housing the data, so unlikely it will be ported to the Pact Broker. That being said, what are the key metrics you’re interested in?
d
@Yousaf Nabi (pactflow.io) thanks! yeah, blog post sounds interesting--I’ll have to check adobe policies on that. I’m heading out on sabbatical next week, so i’ll circle back after that. @Matt (pactflow.io / pact-js / pact-go) that makes sense--we’re interested in tracking this over time so that’s why we’re exporting to new relic (and actually we’re eating our own dog food and sending to Adobe Analytics where we track our own service using our own product 🤠 ). Tracking all the metrics from
/metrics
(especially verification successes and failures) will help give us (and upper management) an idea of how worth it it was to spend engineering resources to implement contract testing throughout the org.
🙌 1
m
Thanks, appreciate that insight.
Are you planing on using
can-i-deploy
and
record-deployment
as well? I wonder if those metrics would be additionally useful?