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
🌐
GitHub
github.com › deibl › Prometheus-Angular
GitHub - deibl/Prometheus-Angular · GitHub
Contribute to deibl/Prometheus-Angular development by creating an account on GitHub.
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%
🌐
GitHub
github.com › ngolforoushan › Prometheus-Angular
GitHub - ngolforoushan/Prometheus-Angular · GitHub
Contribute to ngolforoushan/Prometheus-Angular development by creating an account on GitHub.
Author: ngolforoushan
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 › 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
Author: arcanite24
🌐
GitHub
github.com › prometheus › client_js › issues › 350
Angular · Issue #350 · prometheus/client_js
March 12, 2020 - prometheus / client_js Public · Notifications · You must be signed in to change notification settings · Fork 411 · Star 3.5k · New issueCopy link · New issueCopy link · Closed · Closed · Angular#350 · Copy link · Labels · question · ngrkishore ·
Author: prometheus
🌐
GitHub
github.com › prometheus-systems
prometheus-systems (Prometheus-Systems) · GitHub
Desenvolvedor Angular. prometheus-systems has 9 repositories available. Follow their code on GitHub.
🌐
GitHub
github.com › CloudNativeJS › appmetrics-prometheus
GitHub - CloudNativeJS/appmetrics-prometheus: Module for providing a /metrics endpoint using data from appmetrics for use with Prometheus
May 5, 2022 - Module for providing a /metrics endpoint using data from appmetrics for use with Prometheus - CloudNativeJS/appmetrics-prometheus
Starred by 61 users
Forked by 16 users
Languages: JavaScript 100.0% | JavaScript 100.0%
Find elsewhere
Starred by 33 users
Forked by 15 users
Languages: C# 93.4% | PowerShell 4.1% | Shell 2.5% | C# 93.4% | PowerShell 4.1% | Shell 2.5%
🌐
Prometheus
prometheus.io › docs › instrumenting › clientlibs
Client libraries | Prometheus
Before you can monitor your services, you need to add instrumentation to their code via one of the Prometheus client libraries.
🌐
GitHub
github.com › RisingStack › example-prometheus-nodejs
GitHub - RisingStack/example-prometheus-nodejs: Prometheus monitoring example with Node.js · GitHub
Prometheus monitoring example with Node.js. Contribute to RisingStack/example-prometheus-nodejs development by creating an account on GitHub.
Starred by 331 users
Forked by 125 users
Languages: JavaScript
🌐
GitHub
github.com › grafana › grafana › pull › 41213
Prometheus: Add custom query parameters when creating PromLink url by ong-yy · Pull Request #41213 · grafana/grafana
What this PR does / why we need it: To add custom query parameters set during data source configuration to PromLink url generation Which issue(s) this PR fixes: Fixes #36239
Author: grafana
🌐
npm
npmjs.com › package › @opentelemetry › exporter-prometheus
@opentelemetry/exporter-prometheus - npm
July 21, 2026 - github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-prometheus
      » npm install @opentelemetry/exporter-prometheus
    
Published: Aug 31, 2026
Version: 0.222.0
🌐
GitHub
github.com › topics › prometheus
prometheus · GitHub Topics · GitHub
docker jenkins machine-learning grafana prometheus mlops fastapi · Updated · Jun 24, 2026 · HTML · Star 14 · Angular based frontend for openITCOCKPIT · monitoring nagios prometheus naemon hacktoberfest observability · Updated · Jun 26, 2026 · HTML · Star 0 ·
🌐
Coder Society
codersociety.com › blog › articles › nodejs-application-monitoring-with-prometheus-and-grafana
Node.js Application Monitoring with Prometheus and Grafana, — Coder Society
We created a code repository which contains a collection of Docker containers with Prometheus, Grafana, and a Node.js sample application. It also contains a Grafana dashboard, which follows the RED monitoring methodology. ... $ git clone https://github.com/coder-society/nodejs-application-monitoring-with-prometheus-and-grafana.git
🌐
GitHub
github.com › prometheus-community › monaco-promql › blob › master › docs › angular_integration.md
monaco-promql/docs/angular_integration.md at master · prometheus-community/monaco-promql
Add the these dependencies to your package.json : atularen/ngx-monaco-editor · prometheus-community/monaco-promql · npm install @monaco-editor/loader --save npm install monaco-promql --save · Disclaimer I didn't manage to make a good plug-and-play integration for Angular.
Author: prometheus-community
🌐
GitHub
github.com › siimon › prom-client › issues › 313
Can prom-client be used in angular 2+ application? · Issue #313 · siimon/prom-client
January 22, 2020 - I tried to install and use it in an angular 2+ application, throwing error 'Module not found in cluster.js in //node_modules/prom-client'
Author: siimon
🌐
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...