mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 13:17:08 +00:00
Add hookshot_
prefix on hookshot specific metrics (#701)
* Add hookshot_ prefix on all metrics * Only add prefix to hookshot specific metrics * Add old metric names as deprecated * Fix feeds metrics names * Update metrics docs --------- Co-authored-by: Will Hunt <will@half-shot.uk>
This commit is contained in:
parent
6345ad2347
commit
cafe05b0a2
1
changelog.d/701.misc
Normal file
1
changelog.d/701.misc
Normal file
@ -0,0 +1 @@
|
||||
Ensure all Hookshot specific metrics have a `hookshot_` prefix.
|
@ -1369,7 +1369,7 @@
|
||||
},
|
||||
"editorMode": "builder",
|
||||
"exemplar": false,
|
||||
"expr": "feed_count",
|
||||
"expr": "hookshot_feeds_count",
|
||||
"instant": false,
|
||||
"legendFormat": "{{__name__}}",
|
||||
"range": true,
|
||||
@ -1462,7 +1462,7 @@
|
||||
"uid": "${datasource}"
|
||||
},
|
||||
"editorMode": "builder",
|
||||
"expr": "feed_fetch_ms",
|
||||
"expr": "hookshot_feeds_fetch_ms",
|
||||
"legendFormat": "{{__name__}}",
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
|
@ -31,6 +31,9 @@ Below is the generated list of Prometheus metrics for Hookshot.
|
||||
| hookshot_notifications_push | Number of notifications pushed | service |
|
||||
| hookshot_notifications_service_up | Is the notification service up or down | service |
|
||||
| hookshot_notifications_watchers | Number of notifications watchers running | service |
|
||||
| hookshot_feeds_count | The number of RSS feeds that hookshot is subscribed to | |
|
||||
| hookshot_feeds_fetch_ms | The time taken for hookshot to fetch all feeds | |
|
||||
| hookshot_feeds_failing | The number of RSS feeds that hookshot is failing to read | reason |
|
||||
## matrix
|
||||
| Metric | Help | Labels |
|
||||
|--------|------|--------|
|
||||
@ -41,9 +44,9 @@ Below is the generated list of Prometheus metrics for Hookshot.
|
||||
## feed
|
||||
| Metric | Help | Labels |
|
||||
|--------|------|--------|
|
||||
| feed_count | The number of RSS feeds that hookshot is subscribed to | |
|
||||
| feed_fetch_ms | The time taken for hookshot to fetch all feeds | |
|
||||
| feed_failing | The number of RSS feeds that hookshot is failing to read | reason |
|
||||
| feed_count | (Deprecated) The number of RSS feeds that hookshot is subscribed to | |
|
||||
| feed_fetch_ms | (Deprecated) The time taken for hookshot to fetch all feeds | |
|
||||
| feed_failing | (Deprecated) The number of RSS feeds that hookshot is failing to read | reason |
|
||||
## process
|
||||
| Metric | Help | Labels |
|
||||
|--------|------|--------|
|
||||
|
@ -24,15 +24,18 @@ export class Metrics {
|
||||
public readonly matrixAppserviceEvents = new Counter({ name: "matrix_appservice_events", help: "The number of events sent over the AS API", labelNames: [], registers: [this.registry]});
|
||||
public readonly matrixAppserviceDecryptionFailed = new Counter({ name: "matrix_appservice_decryption_failed", help: "The number of events sent over the AS API that failed to decrypt", registers: [this.registry]});
|
||||
|
||||
public readonly feedsCount = new Gauge({ name: "feed_count", help: "The number of RSS feeds that hookshot is subscribed to", labelNames: [], registers: [this.registry]});
|
||||
public readonly feedFetchMs = new Gauge({ name: "feed_fetch_ms", help: "The time taken for hookshot to fetch all feeds", labelNames: [], registers: [this.registry]});
|
||||
public readonly feedsFailing = new Gauge({ name: "feed_failing", help: "The number of RSS feeds that hookshot is failing to read", labelNames: ["reason"], registers: [this.registry]});
|
||||
public readonly feedsCount = new Gauge({ name: "hookshot_feeds_count", help: "The number of RSS feeds that hookshot is subscribed to", labelNames: [], registers: [this.registry]});
|
||||
public readonly feedFetchMs = new Gauge({ name: "hookshot_feeds_fetch_ms", help: "The time taken for hookshot to fetch all feeds", labelNames: [], registers: [this.registry]});
|
||||
public readonly feedsFailing = new Gauge({ name: "hookshot_feeds_failing", help: "The number of RSS feeds that hookshot is failing to read", labelNames: ["reason"], registers: [this.registry]});
|
||||
public readonly feedsCountDeprecated = new Gauge({ name: "feed_count", help: "(Deprecated) The number of RSS feeds that hookshot is subscribed to", labelNames: [], registers: [this.registry]});
|
||||
public readonly feedsFetchMsDeprecated = new Gauge({ name: "feed_fetch_ms", help: "(Deprecated) The time taken for hookshot to fetch all feeds", labelNames: [], registers: [this.registry]});
|
||||
public readonly feedsFailingDeprecated = new Gauge({ name: "feed_failing", help: "(Deprecated) The number of RSS feeds that hookshot is failing to read", labelNames: ["reason"], registers: [this.registry]});
|
||||
|
||||
|
||||
constructor(private registry: Registry = register) {
|
||||
this.expressRouter.get('/metrics', this.metricsFunc.bind(this));
|
||||
collectDefaultMetrics({
|
||||
register: this.registry
|
||||
register: this.registry,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -232,6 +232,7 @@ export class FeedReader {
|
||||
this.feedQueue = shuffle([...this.observedFeedUrls.values()]);
|
||||
|
||||
Metrics.feedsCount.set(this.observedFeedUrls.size);
|
||||
Metrics.feedsCountDeprecated.set(this.observedFeedUrls.size);
|
||||
}
|
||||
|
||||
private async loadSeenEntries(): Promise<void> {
|
||||
@ -399,9 +400,12 @@ export class FeedReader {
|
||||
|
||||
Metrics.feedsFailing.set({ reason: "http" }, this.feedsFailingHttp.size );
|
||||
Metrics.feedsFailing.set({ reason: "parsing" }, this.feedsFailingParsing.size);
|
||||
Metrics.feedsFailingDeprecated.set({ reason: "http" }, this.feedsFailingHttp.size );
|
||||
Metrics.feedsFailingDeprecated.set({ reason: "parsing" }, this.feedsFailingParsing.size);
|
||||
|
||||
const elapsed = Date.now() - fetchingStarted;
|
||||
Metrics.feedFetchMs.set(elapsed);
|
||||
Metrics.feedsFetchMsDeprecated.set(elapsed);
|
||||
|
||||
const sleepFor = Math.max(this.sleepingInterval - elapsed, 0);
|
||||
log.debug(`Feed fetching took ${elapsed / 1000}s, sleeping for ${sleepFor / 1000}s`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user