Skip to content

katansapdevelop/cap-observability-app

Repository files navigation

Observability App

A simple CAP App to be used to demontrate how to capture low level app metrics and then via a batch periodically aggregate metrics data exposed via a metrics service.

The metrics data is then configured to be consumed in a grafana dashboard.

Incorporates:

  • Security
  • Observability

Node.js 18.18.0 @sap/cds 7.4.0 Issue Count

Observability

Implements a custom ping and health check. Implements logging use the CDS log service, which natively can be used to ingest into Kibana

Concepts taken from the Azure Cloud Design Pattern, Monitor Instance Health

Authentication

Credentials are created and read from the credential service. For this app use the namespace "cap-template" and name "app-health-pwd".

Hybrid Testing

Note when running hybrid testing, you need to bind the credential service local via cds bind -2 cred-store:cred-store-key. If you have not created a key, you will need to do do so via cf create-service-key cred-store cred-store-key

I also deleted the 'customer-service' prefix in the .csdrc-private.json file that was added

Grafana Cloud

Grafana Cloud has a pretty comprehensive free tier avaiable to allow you to consume a significant amount of data and maintain at least 10 dashboards.

I setup the following dashboard, which you can find the source json here.

Batch Job

A batch job has been setup in the server.js file. It runs every 60 seconds to aggergate data from the http request logs to determine the total requests in that period.

Helmet

Helmet helps secure Express apps by setting HTTP response headers and/or removing them

Testing

Chai/Jest

Added support for tests via Chai/Jest

npm run test

.http

Some simple tests have also been setup in tests.http folder to support local testing

About

CAP App Demonstrating Observability via Grafana Cloud

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published