Skip to content

Commit

Permalink
Some smaller improvements to metrics.md (#856)
Browse files Browse the repository at this point in the history
* Update metrics.md

Made descriptions of metrics more consistent and some smaller improvements.

* Update README.md (#855)

* Update README.md

Smaller improvements. Fixed a typo.

* Create 855.doc

---------

Co-authored-by: Will Hunt <[email protected]>

* Update setup.md (#857)

* Update setup.md

Smaller improvements such as fixes for typos, also added an example on how to pass requests from Nginx

* Create 857.docs

* Rename 857.docs to 857.doc

---------

Co-authored-by: Will Hunt <[email protected]>

* Update workers.md (#858)

* Update workers.md

Fixed typos

Signed-off-by: Joshua Hoffmann [email protected]

* Create 858.doc

---------

Signed-off-by: Joshua Hoffmann [email protected]
Co-authored-by: Will Hunt <[email protected]>

* Update encryption.md (#860)

* Update encryption.md

Consistently spell Hookshot with an upper-case H as the first letter

Signed-off-by: Joshua Hoffmann [email protected]

* Create 860.doc

---------

Signed-off-by: Joshua Hoffmann [email protected]
Co-authored-by: Will Hunt <[email protected]>

* Update widgets.md (#859)

* Update widgets.md

Consistently spell Hookshot with an upper-case H as the first letter

Signed-off-by: Joshua Hoffmann [email protected]

* Create 859.doc

---------

Signed-off-by: Joshua Hoffmann [email protected]
Co-authored-by: Will Hunt <[email protected]>

* Drop Node 18, start testing Node 21 & update dependencies. (#862)

* Major package upgrades

* Update rust deps and fix a few things

* Drop 18 testing

* Use node 20

* lint rust

* lint

* changelog

* Drop usage of SVGs, use compound elements.

* Update widget API

* Better support for dark mode in widgets (#863)

* Major package upgrades

* Update rust deps and fix a few things

* Drop 18 testing

* Use node 20

* lint rust

* lint

* changelog

* Drop usage of SVGs, use compound elements.

* Update widget API

* Drop usage of SVGs, use compound elements.

* Add dark mode for widgets

* changelog

* Remove yarn-error.log

* Commit metrics changes

* Cleanup

---------

Signed-off-by: Joshua Hoffmann [email protected]
Co-authored-by: Will Hunt <[email protected]>
  • Loading branch information
Joshua Hoffmann and Half-Shot authored Dec 27, 2023
1 parent 30bb52f commit 1db6f60
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 30 deletions.
1 change: 1 addition & 0 deletions changelog.d/856.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Generally tidy up and improve metrics documentation.
32 changes: 17 additions & 15 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ metrics:
port: 9002
```
Hookshot will then provide metrics on `127.0.0.1` at port `9002`.

An example dashboard that can be used with [Grafana](https://grafana.com) can be found at [/contrib/hookshot-dashboard.json](https://github.com/matrix-org/matrix-hookshot/blob/main/contrib/hookshot-dashboard.json).
There are 3 variables at the top of the dashboard:

![image](https://user-images.githubusercontent.com/2803622/179366574-1bb83e30-05c6-4558-9e66-e813e85b3a6e.png)

Select the Prometheus with your Hookshot metrics as Data Source. Set Interval to your scraping interval. Set 2x Interval to twice the Interval value ([why?](https://github.com/matrix-org/matrix-hookshot/pull/407#issuecomment-1186251618)).
Select the Prometheus instance with your Hookshot metrics as Data Source. Set Interval to your scraping interval. Set 2x Interval to twice the Interval value ([why?](https://github.com/matrix-org/matrix-hookshot/pull/407#issuecomment-1186251618)).

Below is the generated list of Prometheus metrics for Hookshot.

Expand All @@ -24,29 +26,29 @@ Below is the generated list of Prometheus metrics for Hookshot.
| Metric | Help | Labels |
|--------|------|--------|
| hookshot_webhooks_http_request | Number of requests made to the hookshot webhooks handler | path, method |
| hookshot_provisioning_http_request | Number of requests made to the hookshot webhooks handler | path, method |
| hookshot_provisioning_http_request | Number of requests made to the hookshot provisioner handler | path, method |
| hookshot_queue_event_pushes | Number of events pushed through the queue | event |
| hookshot_connection_event_failed | The number of events that failed to process | event, connectionId |
| hookshot_connections | The number of active hookshot connections | service |
| hookshot_connection_event_failed | Number of events that failed to process | event, connectionId |
| hookshot_connections | Number of active hookshot connections | service |
| hookshot_notifications_push | Number of notifications pushed | service |
| hookshot_notifications_service_up | Is the notification service up or down | service |
| hookshot_notifications_service_up | Whether the notification service is 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 |
| hookshot_feeds_count | Number of RSS feeds that hookshot is subscribed to | |
| hookshot_feeds_fetch_ms | Time taken for hookshot to fetch all feeds | |
| hookshot_feeds_failing | Number of RSS feeds that hookshot is failing to read | reason |
## matrix
| Metric | Help | Labels |
|--------|------|--------|
| matrix_api_calls | The number of Matrix client API calls made | method |
| matrix_api_calls_failed | The number of Matrix client API calls which failed | method |
| matrix_appservice_events | The number of events sent over the AS API | |
| matrix_appservice_decryption_failed | The number of events sent over the AS API that failed to decrypt | |
| matrix_api_calls | Number of Matrix client API calls made | method |
| matrix_api_calls_failed | Number of Matrix client API calls which failed | method |
| matrix_appservice_events | Number of events sent over the AS API | |
| matrix_appservice_decryption_failed | Number of events sent over the AS API that failed to decrypt | |
## feed
| Metric | Help | Labels |
|--------|------|--------|
| 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 |
| feed_count | (Deprecated) Number of RSS feeds that hookshot is subscribed to | |
| feed_fetch_ms | (Deprecated) Time taken for hookshot to fetch all feeds | |
| feed_failing | (Deprecated) Number of RSS feeds that hookshot is failing to read | reason |
## process
| Metric | Help | Labels |
|--------|------|--------|
Expand Down
4 changes: 3 additions & 1 deletion scripts/build-metrics-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ metrics:
port: 9002
\`\`\`
Hookshot will then provide metrics on \`127.0.0.1\` at port \`9002\`.
An example dashboard that can be used with [Grafana](https://grafana.com) can be found at [/contrib/hookshot-dashboard.json](https://github.com/matrix-org/matrix-hookshot/blob/main/contrib/hookshot-dashboard.json).
There are 3 variables at the top of the dashboard:
![image](https://user-images.githubusercontent.com/2803622/179366574-1bb83e30-05c6-4558-9e66-e813e85b3a6e.png)
Select the Prometheus with your Hookshot metrics as Data Source. Set Interval to your scraping interval. Set 2x Interval to twice the Interval value ([why?](https://github.com/matrix-org/matrix-hookshot/pull/407#issuecomment-1186251618)).
Select the Prometheus instance with your Hookshot metrics as Data Source. Set Interval to your scraping interval. Set 2x Interval to twice the Interval value ([why?](https://github.com/matrix-org/matrix-hookshot/pull/407#issuecomment-1186251618)).
Below is the generated list of Prometheus metrics for Hookshot.
Expand Down
28 changes: 14 additions & 14 deletions src/Metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,28 @@ export class Metrics {
this.expressRouter.get('/metrics', this.metricsFunc.bind(this));

this.webhooksHttpRequest = new Counter({ name: "hookshot_webhooks_http_request", help: "Number of requests made to the hookshot webhooks handler", labelNames: ["path", "method"], registers: [this.registry]});
this.provisioningHttpRequest = new Counter({ name: "hookshot_provisioning_http_request", help: "Number of requests made to the hookshot webhooks handler", labelNames: ["path", "method"], registers: [this.registry]});
this.provisioningHttpRequest = new Counter({ name: "hookshot_provisioning_http_request", help: "Number of requests made to the hookshot provisioner handler", labelNames: ["path", "method"], registers: [this.registry]});

this.messageQueuePushes = new Counter({ name: "hookshot_queue_event_pushes", help: "Number of events pushed through the queue", labelNames: ["event"], registers: [this.registry]});
this.connectionsEventFailed = new Counter({ name: "hookshot_connection_event_failed", help: "The number of events that failed to process", labelNames: ["event", "connectionId"], registers: [this.registry]});
this.connections = new Gauge({ name: "hookshot_connections", help: "The number of active hookshot connections", labelNames: ["service"], registers: [this.registry]});
this.connectionsEventFailed = new Counter({ name: "hookshot_connection_event_failed", help: "Number of events that failed to process", labelNames: ["event", "connectionId"], registers: [this.registry]});
this.connections = new Gauge({ name: "hookshot_connections", help: "Number of active hookshot connections", labelNames: ["service"], registers: [this.registry]});

this.notificationsPush = new Counter({ name: "hookshot_notifications_push", help: "Number of notifications pushed", labelNames: ["service"], registers: [this.registry]});
this.notificationsServiceUp = new Gauge({ name: "hookshot_notifications_service_up", help: "Is the notification service up or down", labelNames: ["service"], registers: [this.registry]});
this.notificationsServiceUp = new Gauge({ name: "hookshot_notifications_service_up", help: "Whether the notification service is up or down", labelNames: ["service"], registers: [this.registry]});
this.notificationsWatchers = new Gauge({ name: "hookshot_notifications_watchers", help: "Number of notifications watchers running", labelNames: ["service"], registers: [this.registry]});

this.matrixApiCalls = new Counter({ name: "matrix_api_calls", help: "The number of Matrix client API calls made", labelNames: ["method"], registers: [this.registry]});
this.matrixApiCallsFailed = new Counter({ name: "matrix_api_calls_failed", help: "The number of Matrix client API calls which failed", labelNames: ["method"], registers: [this.registry]});
this.matrixApiCalls = new Counter({ name: "matrix_api_calls", help: "Number of Matrix client API calls made", labelNames: ["method"], registers: [this.registry]});
this.matrixApiCallsFailed = new Counter({ name: "matrix_api_calls_failed", help: "Number of Matrix client API calls which failed", labelNames: ["method"], registers: [this.registry]});

this.matrixAppserviceEvents = new Counter({ name: "matrix_appservice_events", help: "The number of events sent over the AS API", labelNames: [], registers: [this.registry]});
this.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]});
this.matrixAppserviceEvents = new Counter({ name: "matrix_appservice_events", help: "Number of events sent over the AS API", labelNames: [], registers: [this.registry]});
this.matrixAppserviceDecryptionFailed = new Counter({ name: "matrix_appservice_decryption_failed", help: "Number of events sent over the AS API that failed to decrypt", registers: [this.registry]});

this.feedsCount = new Gauge({ name: "hookshot_feeds_count", help: "The number of RSS feeds that hookshot is subscribed to", labelNames: [], registers: [this.registry]});
this.feedFetchMs = new Gauge({ name: "hookshot_feeds_fetch_ms", help: "The time taken for hookshot to fetch all feeds", labelNames: [], registers: [this.registry]});
this.feedsFailing = new Gauge({ name: "hookshot_feeds_failing", help: "The number of RSS feeds that hookshot is failing to read", labelNames: ["reason"], registers: [this.registry]});
this.feedsCountDeprecated = new Gauge({ name: "feed_count", help: "(Deprecated) The number of RSS feeds that hookshot is subscribed to", labelNames: [], registers: [this.registry]});
this.feedsFetchMsDeprecated = new Gauge({ name: "feed_fetch_ms", help: "(Deprecated) The time taken for hookshot to fetch all feeds", labelNames: [], registers: [this.registry]});
this.feedsFailingDeprecated = new Gauge({ name: "feed_failing", help: "(Deprecated) The number of RSS feeds that hookshot is failing to read", labelNames: ["reason"], registers: [this.registry]});
this.feedsCount = new Gauge({ name: "hookshot_feeds_count", help: "Number of RSS feeds that hookshot is subscribed to", labelNames: [], registers: [this.registry]});
this.feedFetchMs = new Gauge({ name: "hookshot_feeds_fetch_ms", help: "Time taken for hookshot to fetch all feeds", labelNames: [], registers: [this.registry]});
this.feedsFailing = new Gauge({ name: "hookshot_feeds_failing", help: "Number of RSS feeds that hookshot is failing to read", labelNames: ["reason"], registers: [this.registry]});
this.feedsCountDeprecated = new Gauge({ name: "feed_count", help: "(Deprecated) Number of RSS feeds that hookshot is subscribed to", labelNames: [], registers: [this.registry]});
this.feedsFetchMsDeprecated = new Gauge({ name: "feed_fetch_ms", help: "(Deprecated) Time taken for hookshot to fetch all feeds", labelNames: [], registers: [this.registry]});
this.feedsFailingDeprecated = new Gauge({ name: "feed_failing", help: "(Deprecated) Number of RSS feeds that hookshot is failing to read", labelNames: ["reason"], registers: [this.registry]});

collectDefaultMetrics({
register: this.registry,
Expand Down

0 comments on commit 1db6f60

Please sign in to comment.