This repository contains a simple Node.js application that demonstrates how to configure OpenTelemetry to monitor both application and infrastructure. The application includes Docker Compose configurations for easy deployment.
Before you begin, ensure you have the following installed:
- Node.js
- Docker
-
Clone the repository:
git clone https://github.com/kloudmate/samplenodejs.git
-
Change into the repository directory:
cd samplenodejs
-
Create a
.env
file in the root directory. You can refer to the providedenv.example
for the required environment variables. -
Run the application using Docker Compose:
docker-compose up -d
This will start the main application along with a PostgreSQL database, Redis, and the OpenTelemetry collector.
- Visit
http://localhost:3006
The application is instrumented using OpenTelemetry to collect traces, logs, and metrics. The configuration can be found in the server/src/instrumentation.js
file and client/src/tracing.js
.
Feel free to explore the code and modify the OpenTelemetry configuration as needed for your specific requirements.