this is an example of how one would monitor such use case:

using this file I'm setting up my front application and the nginx prometheus exporter to expose the Prometheus metrics in the appropriate format: docker-compose.yml

version: "3.9"
services:
  web:
    build: .
    ports:
      - "3000:3000"
  nginx-exporter:
    image: "nginx/nginx-prometheus-exporter:latest"
    command: ["-nginx.scrape-uri=http://web:3000/metrics"]
    ports:
      - "9113:9113"

add this section to your nginx.conf file

location /metrics {
    stub_status on;
}

as part of the whole file:

pid /tmp/nginx.pid;

#Provides the configuration file context in which the directives that affect connection processing are specified.
events {
    # Sets the maximum number of simultaneous connections that can be opened by a worker process.
    worker_connections 8000;
    # Tells the worker to accept multiple connections at a time
    multi_accept on;
}

http {
    # what times to include
    include       /etc/nginx/mime.types;
    # what is the default one
    default_type  application/octet-stream;

    # Sets the path, format, and configuration for a buffered log write
    log_format compression '$remote_addr - $remote_user [$time_local] '
        '"$request" $status $upstream_addr '
        '"$http_referer" "$http_user_agent"';

    server {
        # listen on port 3000
        listen 3000;
        # save logs here
        access_log /var/log/nginx/access.log compression;

        # where the root here
        root /usr/share/nginx/html;
        # what file to server as index
        index index.html index.htm;

        location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to redirecting to index.html
            try_files uri/ /index.html;
        }
        
        location /metrics {
            stub_status on;
        }

        # Media: images, icons, video, audio, HTC
        location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
          expires 1M;
          access_log off;
          add_header Cache-Control "public";
        }

        # Javascript and CSS files
        location ~* \.(?:css|js)$ {
            try_files $uri =404;
            expires 1y;
            access_log off;
            add_header Cache-Control "public";
        }

        # Any route containing a file extension (e.g. /devicesfile.js)
        location ~ ^.+\..+$ {
            try_files $uri =404;
        }
    }
}

then in your prometheus configuration file add this new job:

  - job_name: 'nginx'
    static_configs:
    - targets: ['<machine_ip>:9113']

And here you can find an example dashboard

Answer from Noam Yizraeli on Stack Overflow
Top answer
1 of 2
1

this is an example of how one would monitor such use case:

using this file I'm setting up my front application and the nginx prometheus exporter to expose the Prometheus metrics in the appropriate format: docker-compose.yml

version: "3.9"
services:
  web:
    build: .
    ports:
      - "3000:3000"
  nginx-exporter:
    image: "nginx/nginx-prometheus-exporter:latest"
    command: ["-nginx.scrape-uri=http://web:3000/metrics"]
    ports:
      - "9113:9113"

add this section to your nginx.conf file

location /metrics {
    stub_status on;
}

as part of the whole file:

pid /tmp/nginx.pid;

#Provides the configuration file context in which the directives that affect connection processing are specified.
events {
    # Sets the maximum number of simultaneous connections that can be opened by a worker process.
    worker_connections 8000;
    # Tells the worker to accept multiple connections at a time
    multi_accept on;
}

http {
    # what times to include
    include       /etc/nginx/mime.types;
    # what is the default one
    default_type  application/octet-stream;

    # Sets the path, format, and configuration for a buffered log write
    log_format compression '$remote_addr - $remote_user [$time_local] '
        '"$request" $status $upstream_addr '
        '"$http_referer" "$http_user_agent"';

    server {
        # listen on port 3000
        listen 3000;
        # save logs here
        access_log /var/log/nginx/access.log compression;

        # where the root here
        root /usr/share/nginx/html;
        # what file to server as index
        index index.html index.htm;

        location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to redirecting to index.html
            try_files uri/ /index.html;
        }
        
        location /metrics {
            stub_status on;
        }

        # Media: images, icons, video, audio, HTC
        location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
          expires 1M;
          access_log off;
          add_header Cache-Control "public";
        }

        # Javascript and CSS files
        location ~* \.(?:css|js)$ {
            try_files $uri =404;
            expires 1y;
            access_log off;
            add_header Cache-Control "public";
        }

        # Any route containing a file extension (e.g. /devicesfile.js)
        location ~ ^.+\..+$ {
            try_files $uri =404;
        }
    }
}

then in your prometheus configuration file add this new job:

  - job_name: 'nginx'
    static_configs:
    - targets: ['<machine_ip>:9113']

And here you can find an example dashboard

2 of 2
0

To monitor/count events on the frontend you can run a "frontend-metrics-server" where your frontend can submit the events to be counted with Prometheus.

This is a simple implementation which also allows tracking errors from the frontend:

@RestController
@Slf4j
public class CounterController {
    private static final Map<String, Gauge> EVENT_COUNTERS = new ConcurrentHashMap<>();

    private static final Counter ERROR_COUNTER = Counter.build()
            .name("error_counter")
            .help("Number of errors received")
            .register();

    @PostMapping("/updateCounter")
    public void updateCounter(@RequestBody CounterUpdateRequest request) {
        Gauge gauge = EVENT_COUNTERS.computeIfAbsent(request.name(), name ->
                Gauge.build()
                        .name("event_counter_" + name)
                        .help("Number of " + name + " events received")
                        .register()
        );
        gauge.inc(request.amount());
        log.info("Metric {} increased by {} through user {}", request.name(), request.amount(), addTheUserIdHere);
    }

    @PostMapping("/reportError")
    public void reportError(@RequestBody ErrorReportRequest request) {
        ERROR_COUNTER.inc();
        log.error("User {}: {}", addTheUserIdHere, request.message());
    }

    public record CounterUpdateRequest(String name, int amount) {}

    public record ErrorReportRequest(String message) {}
}

Of course, you can add additional parameters or types of metrics.

Keep in mind, that the API could be called by your users with other data which can "soil" your metrics and logs.

🌐
GitHub
github.com › deibl › Prometheus-Angular
GitHub - deibl/Prometheus-Angular · GitHub
Small project, showcasing micrometer (together wir Prometheus), written using Angular (for training purposes - never used it before :-) ).
Starred by 7 users
Forked by 5 users
Languages: TypeScript 55.2% | HTML 21.7% | Java 18.8% | JavaScript 2.8% | Dockerfile 1.3% | CSS 0.2%
Discussions

How to implement Prometheus metrics tracking for Angular applications - Frontend - IT Dev Example
Now I want to extend this monitoring approach to my Angular frontend but I’m not sure where to start. I need to track things like page load times, user interactions, API call failures, and maybe some custom events from the client side. Has anyone implemented Prometheus m... More on community.webshinetech.com
🌐 community.webshinetech.com
0
June 11, 2025
Angular
I am using this library in Angular application. I can see the metrics in the browser by logging in each component. I am not sure how/what to implement in Angular so that Prometheus can pick these m... More on github.com
🌐 github.com
1
March 12, 2020
[kube-prometheus-stack] Getting Angular deprecated warnings for the dashboards
Describe the bug a clear and concise description of what the bug is. we updated kube-prometheus-stack to v57.1.1 Getting Angular deprecated warnings for the dashboards. When is it expected to be fi... More on github.com
🌐 github.com
2
March 27, 2024
Angular
Hi, Is it possible to use this from Angular application? If yes, do you have any sample code? More on github.com
🌐 github.com
5
March 12, 2020
🌐
SuprSend
suprsend.com › post › monitoring-a-notification-service-with-angular-and-prometheus
Monitoring a Notification Service with Angular and Prometheus
August 30, 2024 - Angular Frontend: The user interface built with Angular to display monitoring data. Prometheus: A monitoring system that collects and stores metrics from the notification service.
🌐
IT Dev Example
community.webshinetech.com › frontend
How to implement Prometheus metrics tracking for Angular applications - Frontend - IT Dev Example
June 11, 2025 - I have successfully set up Prometheus monitoring for my Spring Boot backend application. It tracks various metrics like response times, error rates, and custom business counters which has been really helpful for observability. Now I want to extend this monitoring approach to my Angular frontend but I’m not sure where to start.
🌐
Pixel Free Studio
blog.pixelfreestudio.com › home › how to use prometheus for monitoring frontend applications
How to Use Prometheus for Monitoring Frontend Applications
August 16, 2024 - If you’re using a framework like React or Angular, there are libraries available that help expose performance metrics. For instance, Prometheus client libraries can be used to instrument your frontend application, allowing you to expose metrics in a format that Prometheus can scrape.
🌐
GitHub
github.com › weaveworks › promjs › issues › 24
Angular · Issue #24 · weaveworks/promjs
March 12, 2020 - I am using this library in Angular application. I can see the metrics in the browser by logging in each component. I am not sure how/what to implement in Angular so that Prometheus can pick these m...
Author: weaveworks
🌐
GitHub
github.com › ngolforoushan › Prometheus-Angular
GitHub - ngolforoushan/Prometheus-Angular · GitHub
Small project, showcasing micrometer (together wir Prometheus), written using Angular (for training purposes - never used it before :-) ).
Author: ngolforoushan
🌐
Codidact
software.codidact.com › posts › 284183
How can I export metrics from Angular frontend to be read with Prometheus ? - Software Development
How can I monitor an Angular frontend with Prometheus? I was able to create metrics for my Node.js API using the express-prometheus module. But I can't...
Find elsewhere
🌐
npm
npmjs.com › package › prometheus-api-metrics
prometheus-api-metrics - npm
const apiMetrics = require('prometheus-api-metrics'); app.use(apiMetrics({ additionalLabels: ['customer', 'cluster'], extractAdditionalLabelValuesFn: (req, res) => { const { headers } = req.headers; return { customer: headers['x-custom-header-customer'], cluster: headers['x-custom-header-cluster'] } } }))
      » npm install prometheus-api-metrics
    
Published: Mar 09, 2025
Version: 4.0.0
🌐
Reintech
reintech.io › hire-angular-prometheus
Hire Remote Angular Developers with Prometheus Skills | Reintech
August 2, 2023 - Instead of bombarding you with dozens of CVs, we provide 2-3 preselected candidates who are experts in Angular and have proficient skills in Prometheus. Angular is a powerful open-source web application framework used for building efficient and sophisticated single-page applications.
🌐
GitHub
github.com › prometheus-community › helm-charts › issues › 4398
[kube-prometheus-stack] Getting Angular deprecated warnings for the dashboards · Issue #4398 · prometheus-community/helm-charts
March 27, 2024 - Describe the bug a clear and concise description of what the bug is. we updated kube-prometheus-stack to v57.1.1 Getting Angular deprecated warnings for the dashboards. When is it expected to be fi...
Author: prometheus-community
🌐
Medium
nedmcclain.medium.com › frontend-monitoring-with-prometheus-38f798406125
Frontend Monitoring with Prometheus | by Ned McClain | Medium
December 19, 2019 - In this post, our goal is to leverage frontend browser testing for production observability and monitoring. We’ll use nightwatchjs_exporter to capture the results of Nightwatch.js tests with the Prometheus monitoring tool.
🌐
RisingStack
blog.risingstack.com › home › hírek, események › node.js performance monitoring with prometheus
Node.js Performance Monitoring with Prometheus - RisingStack Engineering
October 15, 2025 - This article helps you to understand what to monitor if you have a Node.js application in production, and how to use Prometheus – an open-source solution, which provides powerful data compressions and fast data querying for time series data – for Node.js monitoring.
🌐
GitHub
github.com › prometheus › client_js › issues › 350
Angular · Issue #350 · prometheus/client_js
March 12, 2020 - Hi, Is it possible to use this from Angular application? If yes, do you have any sample code?
Author: prometheus
Author: arcanite24
🌐
Coder Society
codersociety.com › blog › articles › nodejs-application-monitoring-with-prometheus-and-grafana
Node.js Application Monitoring with Prometheus and Grafana, — Coder Society
The Prometheus server collects metrics from your servers and other monitoring targets by pulling their metric endpoints over HTTP at a predefined time interval. For ephemeral and batch jobs, for which metrics can't be scraped periodically due ...
🌐
GitHub
github.com › prometheus-operator › kube-prometheus › issues › 2418
example dashboards use angular which is depreciated in grafana · Issue #2418 · prometheus-operator/kube-prometheus
What happened? When importing the example dashboards from manifests/grafana-dashboardDefinitions.yaml into grafana 10.4 it reports angular integration is deprecated. Did you expect to see some diff...
Author: prometheus-operator
🌐
npm
npmjs.com › package › @opentelemetry › exporter-prometheus
@opentelemetry/exporter-prometheus - npm
July 21, 2026 - The OpenTelemetry Prometheus Metrics Exporter allows the user to send collected OpenTelemetry Metrics to Prometheus.
      » npm install @opentelemetry/exporter-prometheus
    
Published: Aug 31, 2026
Version: 0.222.0