apm-optima 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Contributing to Optima APM
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to **Optima APM**! We welcome bug fixes, feature proposals, documentation updates, and performance improvements.
|
|
4
|
+
|
|
5
|
+
This document provides a set of guidelines and instructions for setting up your local development environment and contributing to the project.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [Code of Conduct](#code-of-conduct)
|
|
12
|
+
- [Monorepo Architecture](#monorepo-architecture)
|
|
13
|
+
- [Prerequisites](#prerequisites)
|
|
14
|
+
- [Local Development Setup](#local-development-setup)
|
|
15
|
+
- [Project Workflow & Commands](#project-workflow--commands)
|
|
16
|
+
- [Development Guidelines](#development-guidelines)
|
|
17
|
+
- [Submitting a Pull Request](#submitting-a-pull-request)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Code of Conduct
|
|
22
|
+
|
|
23
|
+
Please be respectful, constructive, and collaborative in all communications, issues, and Pull Requests.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Monorepo Architecture
|
|
28
|
+
|
|
29
|
+
This project is structured as a **Monorepo** using **npm workspaces**:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
├── packages/
|
|
33
|
+
│ └── core/ # Telemetry engine, interceptors, and WebSocket adapters (apm-optima/core)
|
|
34
|
+
│ └── dashboard/ # Next.js React Dashboard (exported statically into apm-optima/core)
|
|
35
|
+
├── apps/ # Integration & demo application (Express & NestJS)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- **`apm-optima/core`**: The published npm package containing the telemetry engine.
|
|
39
|
+
- **`packages/dashboard`**: A Next.js application that gets exported statically (`output: 'export'`) and bundled into `apm-optima/core`.
|
|
40
|
+
- **`apps`**: A local environment used to test `apm-optima/core` changes in real time.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Prerequisites
|
|
45
|
+
|
|
46
|
+
Ensure you have the following installed locally:
|
|
47
|
+
|
|
48
|
+
- **Node.js**: `>= 20.0.0` (LTS version recommended)
|
|
49
|
+
- **npm**: `>= 10.0.0` (Native support for npm workspaces)
|
|
50
|
+
- **Git**: `>= 2.x`
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Local Development Setup
|
|
55
|
+
|
|
56
|
+
Follow these steps to clone and run the repository locally:
|
|
57
|
+
|
|
58
|
+
### 1. Clone the Repository
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git clone https://github.com/Nosalis1/Optima.git
|
|
62
|
+
cd Optima
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 2. Install Dependencies
|
|
66
|
+
|
|
67
|
+
Install all dependencies across the entire monorepo with a single command from the root directory:
|
|
68
|
+
```bash
|
|
69
|
+
npm install
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 3. Build the Packages
|
|
73
|
+
|
|
74
|
+
Build all packages in order (this compiles the Next.js static dashboard and builds `apm-optima/core`):
|
|
75
|
+
```bash
|
|
76
|
+
npm run build
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Project Workflow & Commands
|
|
82
|
+
|
|
83
|
+
You can run workspace tasks from the root directory using central npm scripts:
|
|
84
|
+
|
|
85
|
+
### Build Commands
|
|
86
|
+
|
|
87
|
+
| Command | Description |
|
|
88
|
+
| :--- | :--- |
|
|
89
|
+
| `npm run build` | Builds the Dashboard first, then compiles `apm-optima/core`. |
|
|
90
|
+
| `npm run build:dashboard` | Statically exports the Next.js Dashboard into `apps/dashboard/out`. |
|
|
91
|
+
| `npm run build:core` | Compiles TypeScript code for `apm-optima/core`. |
|
|
92
|
+
| `npm run clean` | Cleans `dist`, `.next`, and build artifacts across all packages. |
|
|
93
|
+
|
|
94
|
+
### Development Commands
|
|
95
|
+
|
|
96
|
+
| Command | Description |
|
|
97
|
+
| :--- | :--- |
|
|
98
|
+
| `npm run dev:dashboard` | Runs Next.js Dashboard in dev/watch mode (`localhost:3001`). |
|
|
99
|
+
| `npm run dev:core` | Runs TypeScript watch mode for `apm-optima/core`. |
|
|
100
|
+
| `npm run dev:express` | Launches the Express integration demo. |
|
|
101
|
+
| `npm run dev:nest` | Launches the NestJS integration demo. |
|
|
102
|
+
| `npm test` | Runs test suites inside `apm-optima/core`. |
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Development Guidelines
|
|
107
|
+
|
|
108
|
+
**Working with Core and Dashboard**
|
|
109
|
+
|
|
110
|
+
1. **Dashboard Changes:** Any UI changes inside `packages/dashboard` need to be statically exported before being served via `apm-optima/core`.
|
|
111
|
+
2. **Local Linking:** Thanks to `npm workspaces`, `example-app` automatically links to `apm-optima/core` in real time without needing `npm link`.
|
|
112
|
+
3. **TypeScript:** Ensure all packages compile without errors (`npm run build`) before submitting changes.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Submitting a Pull Request
|
|
117
|
+
|
|
118
|
+
1. **Fork & Branch:** Create a fork of the repository and create a new feature branch:
|
|
119
|
+
```bash
|
|
120
|
+
git checkout -b feat/your-feature-name
|
|
121
|
+
```
|
|
122
|
+
2. **Commit Changes:** Write clear, concise commit messages following conventions:
|
|
123
|
+
- `feat`: New features
|
|
124
|
+
- `fix`: Bug fixes
|
|
125
|
+
- `docs`: Documentation changes
|
|
126
|
+
- `refactor`: Code improvements without functional changes
|
|
127
|
+
3. **Push & Open PR:** Push your branch to GitHub and open a Pull Request against the `main` branch. Provide a clear summary of your changes in the PR description.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Need Help?
|
|
132
|
+
|
|
133
|
+
If you run into issues or have questions, feel free to open a [GitHub Issue](https://github.com/Nosalis1/Optima/issues) or reach out through discussions.
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<p><b>Lightweight, real-time Telemetry & Application Performance Monitoring for Node.js</b></p>
|
|
8
8
|
|
|
9
|
-
[](https://www.npmjs.com/package
|
|
9
|
+
[](https://www.npmjs.com/package/apm-optima)
|
|
10
10
|
[](https://github.com/Nosalis1/Optima/blob/main/LICENSE)
|
|
11
11
|
[](https://nodejs.org)
|
|
12
12
|
[](https://www.npmjs.com/)
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
|
|
46
46
|
## Dashboard Preview
|
|
47
47
|
|
|
48
|
-
<!-- ZAMENI SA STVARNOM SLIKOM KADA JE DODATNA U REPOZITORIJUM -->
|
|
49
48
|
<div align="center">
|
|
50
49
|
<table border="0">
|
|
51
50
|
<tr>
|
|
@@ -66,8 +65,8 @@ Optima is structured as a **Monorepo** managed with `npm workspaces`:
|
|
|
66
65
|
|
|
67
66
|
```
|
|
68
67
|
├── packages/
|
|
69
|
-
│ └── core/ # Telemetry engine, interceptors, and WebSocket adapters (
|
|
70
|
-
│ └── dashboard/ # Next.js React Dashboard (exported statically into
|
|
68
|
+
│ └── core/ # Telemetry engine, interceptors, and WebSocket adapters (apm-optima/core)
|
|
69
|
+
│ └── dashboard/ # Next.js React Dashboard (exported statically into apm-optima/core)
|
|
71
70
|
├── apps/ # Integration & demo application (Express & NestJS)
|
|
72
71
|
```
|
|
73
72
|
|
|
@@ -78,11 +77,11 @@ Optima is structured as a **Monorepo** managed with `npm workspaces`:
|
|
|
78
77
|
### Installation
|
|
79
78
|
|
|
80
79
|
```bash
|
|
81
|
-
npm
|
|
80
|
+
npm i apm-optima
|
|
82
81
|
# or
|
|
83
|
-
pnpm add
|
|
82
|
+
pnpm add apm-optima
|
|
84
83
|
# or
|
|
85
|
-
yarn add
|
|
84
|
+
yarn add apm-optima
|
|
86
85
|
```
|
|
87
86
|
|
|
88
87
|
### Express.js Integration
|
|
@@ -90,7 +89,7 @@ yarn add @optima-apm/core
|
|
|
90
89
|
Attach Optima using setupOptima and hook the HTTP server instance:
|
|
91
90
|
```ts
|
|
92
91
|
const express = require('express');
|
|
93
|
-
const { setupOptima } = require('
|
|
92
|
+
const { setupOptima } = require('apm-optima/express');
|
|
94
93
|
|
|
95
94
|
const app = express();
|
|
96
95
|
app.use(express.json());
|
|
@@ -121,7 +120,7 @@ const stopMetrics = optima.attachServer(server);
|
|
|
121
120
|
Import MetricsModule into your root application module:
|
|
122
121
|
```ts
|
|
123
122
|
import { Module } from '@nestjs/common';
|
|
124
|
-
import { MetricsModule } from '
|
|
123
|
+
import { MetricsModule } from 'apm-optima/nest';
|
|
125
124
|
|
|
126
125
|
@Module({
|
|
127
126
|
imports: [
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
width="64"
|
|
3
|
+
height="64"
|
|
4
|
+
viewBox="0 0 200 200"
|
|
5
|
+
fill="none"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
>
|
|
8
|
+
<circle
|
|
9
|
+
cx="100"
|
|
10
|
+
cy="100"
|
|
11
|
+
r="75"
|
|
12
|
+
stroke="white"
|
|
13
|
+
strokeWidth="7"
|
|
14
|
+
strokeOpacity="0.25"
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
<path
|
|
18
|
+
d="M 45 135 A 65 65 0 1 1 155 135"
|
|
19
|
+
stroke="white"
|
|
20
|
+
strokeWidth="10"
|
|
21
|
+
strokeLinecap="round"
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<circle cx="50" cy="130" r="4" fill="white" />
|
|
25
|
+
<circle cx="100" cy="42" r="4" fill="white" />
|
|
26
|
+
<circle cx="150" cy="130" r="4" fill="white" />
|
|
27
|
+
|
|
28
|
+
<rect x="78" y="130" width="7" height="18" rx="3.5" fill="white" fillOpacity="0.5" />
|
|
29
|
+
<rect x="92" y="118" width="7" height="30" rx="3.5" fill="white" fillOpacity="0.9" />
|
|
30
|
+
<rect x="106" y="124" width="7" height="24" rx="3.5" fill="white" fillOpacity="0.6" />
|
|
31
|
+
|
|
32
|
+
<path
|
|
33
|
+
d="M 100 100 L 132 68"
|
|
34
|
+
stroke="white"
|
|
35
|
+
strokeWidth="8"
|
|
36
|
+
strokeLinecap="round"
|
|
37
|
+
/>
|
|
38
|
+
<circle cx="100" cy="100" r="8" fill="white" />
|
|
39
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apm-optima",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
"files": [
|
|
35
35
|
"dist",
|
|
36
36
|
"README.md",
|
|
37
|
+
"LICENSE",
|
|
38
|
+
"CONTRIBUTING.md",
|
|
39
|
+
"docs",
|
|
37
40
|
"package.json"
|
|
38
41
|
],
|
|
39
42
|
"scripts": {
|
|
@@ -68,4 +71,4 @@
|
|
|
68
71
|
"ts-jest": "^29.0.0",
|
|
69
72
|
"typescript": "^5.0.0"
|
|
70
73
|
}
|
|
71
|
-
}
|
|
74
|
+
}
|