npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mashroom/mashroom-monitoring-prometheus-exporter

v2.7.1

Published

Exports Mashroom metrics for the Prometheus monitoring system

Downloads

80

Readme

Mashroom Monitoring Prometheus Exporter

Plugin for Mashroom Server, a Microfrontend Integration Platform.

This plugin exports the following metrics to the Prometheus monitoring system:

  • The standard metrics like CPU and memory usage described here
  • Additional V8 GC metrics (if the module prometheus-gc-stats is present)
  • Loaded plugins with status
  • HTTP request durations and response codes
  • Mashroom plugin metrics like session count, http proxy stats, memory cache stats, MongoDB/Redis connection stats, ...

Usage

If node_modules/@mashroom is configured as plugin path just add @mashroom/mashroom-monitoring-prometheus-exporter as dependency.

You can change the default configuration in your Mashroom config file like this:

{
  "plugins": {
        "Mashroom Monitoring Prometheus Exporter Webapp": {
            "path": "/myMetricsPath"
        }
    }
}
  • path: The path where the metrics will be exported (Default: /metrics)

Example Queries

The examples assume the Prometheus job to scrape the metrics adds the label service:Mashroom

Request rate:

sum(rate(mashroom_http_requests_total{service="Mashroom"}[5m]))

Requests with HTTP 500 response rate:

sum(rate(mashroom_http_requests_total{status="500", service="Mashroom"}[5m]))

95% of requests served within seconds:

histogram_quantile(0.95, sum(rate(mashroom_http_request_duration_seconds_bucket{service="Mashroom"}[5m])) by (le)) * 1000

Heap total in MB:

nodejs_heap_size_total_bytes{service="Mashroom"} / 1024 / 1024

Heap used in MB:

nodejs_heap_size_used_bytes{service="Mashroom"} / 1024 / 1024

CPU usage total in %:

avg(irate(process_cpu_seconds_total{service="Mashroom"}[5m])) * 100

GC pauses 95% quantile

histogram_quantile(0.95, sum(rate(nodejs_gc_duration_seconds_bucket[5m])) by (le))

User sessions:

mashroom_sessions_total{service="Mashroom"}

Active HTTP proxy connections (e.g. Portal App REST calls):

mashroom_http_proxy_http_pool_connections_active_total{service="Mashroom"}
mashroom_http_proxy_https_pool_connections_active_total{service="Mashroom"}
mashroom_http_proxy_ws_connections_active_total{service="Mashroom"}

Idle HTTP proxy connections:

mashroom_http_proxy_http_pool_connections_idle_total{service="Mashroom"}
mashroom_http_proxy_https_pool_connections_idle_total{service="Mashroom"}

Plugins total:

mashroom_plugins_total{service="Mashroom"}

Plugins loaded:

mashroom_plugins_loaded_total{service="Mashroom"}

Plugins in error state:

mashroom_plugins_error_total{service="Mashroom"}

Remote Portal App endpoints total:

mashroom_remote_app_endpoints_total{service="Mashroom"}

Remote Portal App endpoints in error state:

mashroom_remote_app_endpoints_error_total{service="Mashroom"}

Kubernetes remote Portal App services total:

mashroom_remote_app_k8s_services_total{service="Mashroom"}

Kubernetes remote Portal App services in error state:

mashroom_remote_app_k8s_services_error_total{service="Mashroom"}

Memory cache hit ratio:

mashroom_memory_cache_hit_ratio{service="Mashroom"}

Redis session store provider connected:

mashroom_sessions_redis_nodes_connected{service="Mashroom"}

Redis memory cache provider connected:

mashroom_memory_cache_redis_nodes_connected{service="Mashroom"}

MongoDB storage provider connected:

mashroom_storage_mongodb_connected{service="Mashroom"}

MQTT messaging system connected:

mashroom_messaging_mqtt_connected{service="Mashroom"}

Kubernetes Hints

On Kubernetes the metrics are scraped separately for each container. So, you have to do the aggregation in the query.

For example, the overall request rate would still be:

sum(rate(mashroom_http_requests_total{namespace="my-namespace"}[5m]))

But the request rate per pod:

sum by (kubernetes_pod_name) (rate(mashroom_http_requests_total{namespace="my-namespace"}[5m]))

Or the Session count per pod:

mashroom_sessions_total{namespace="my-namespace"} by (kubernetes_pod_name)

In the last two examples you typically would use {{kubernetes_pod_name}} in the legend.

Demo Grafana Dashboard

You can find a demo Grafana Dashboard here: https://github.com/nonblocking/mashroom/tree/master/packages/plugin-packages/mashroom-monitoring-prometheus-exporter/test/grafana-test/grafana/provisioning/dashboards/Mashroom%20Dashboard.json