@egintegrations/telemetry 0.3.0 → 0.3.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/README.md +72 -32
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,12 +26,37 @@ npx @egintegrations/telemetry init
|
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
The CLI will:
|
|
29
|
-
1.
|
|
30
|
-
2.
|
|
31
|
-
3.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
1. Show the EGI ASCII logo and welcome message
|
|
30
|
+
2. Detect your framework (Next.js, Express, Fastify, or generic)
|
|
31
|
+
3. Prompt for engine configuration:
|
|
32
|
+
- Engine name
|
|
33
|
+
- Version (semantic version like 1.0.0)
|
|
34
|
+
- System type (16 options: API, BOT, WA, RAG, ETL, INT, CMS, MA, DA, AI, DB, OP, FX, SDK, CLI, QA)
|
|
35
|
+
- Platform (25 options: VE, EKS, GKE, NPM, PYPI, etc.)
|
|
36
|
+
4. Generate full SKU automatically (e.g., `1.0.0.API.VE.20260113`)
|
|
37
|
+
5. Create configuration file (`.egi/telemetry.json`)
|
|
38
|
+
6. Create integration code (`lib/telemetry.ts` for Next.js, `telemetry.ts` for Express/Fastify)
|
|
39
|
+
|
|
40
|
+
### How It Works
|
|
41
|
+
|
|
42
|
+
1. **Install and configure** (30 seconds)
|
|
43
|
+
2. **Deploy your project** (Vercel, Heroku, K8s, anywhere)
|
|
44
|
+
3. **Engine automatically registers** on first startup
|
|
45
|
+
4. **View in dashboard**: https://control-center.egintegrations.com/ui
|
|
46
|
+
|
|
47
|
+
No manual configuration. No YAML files. Just install, configure, and deploy!
|
|
48
|
+
|
|
49
|
+
### SKU Format
|
|
50
|
+
|
|
51
|
+
SKUs follow the format: `VERSION.TYPE.PLATFORM.DATE`
|
|
52
|
+
|
|
53
|
+
**Example:** `1.0.0.API.VE.20260113`
|
|
54
|
+
- **VERSION**: Semantic version (1.0.0, 2.1.3, etc.)
|
|
55
|
+
- **TYPE**: System type - API, BOT, WA, RAG, ETL, INT, CMS, MA, DA, AI, DB, OP, FX, SDK, CLI, QA
|
|
56
|
+
- **PLATFORM**: Deployment platform - VE (Vercel), EKS, GKE, NPM, PYPI, etc.
|
|
57
|
+
- **DATE**: Auto-generated timestamp (YYYYMMDD)
|
|
58
|
+
|
|
59
|
+
The CLI will guide you through selecting the appropriate type and platform for your project.
|
|
35
60
|
|
|
36
61
|
### Non-Interactive Setup
|
|
37
62
|
|
|
@@ -40,9 +65,10 @@ For CI/CD or automated setups:
|
|
|
40
65
|
```bash
|
|
41
66
|
npx @egintegrations/telemetry init \
|
|
42
67
|
--engine my-engine \
|
|
43
|
-
--
|
|
44
|
-
--
|
|
45
|
-
--
|
|
68
|
+
--version 1.0.0 \
|
|
69
|
+
--type API \
|
|
70
|
+
--platform VE \
|
|
71
|
+
--url https://control-center.egintegrations.com
|
|
46
72
|
```
|
|
47
73
|
|
|
48
74
|
### CLI Options
|
|
@@ -50,15 +76,16 @@ npx @egintegrations/telemetry init \
|
|
|
50
76
|
| Option | Description | Default |
|
|
51
77
|
|--------|-------------|---------|
|
|
52
78
|
| `--engine <name>` | Engine name (required) | - |
|
|
53
|
-
| `--
|
|
54
|
-
| `--
|
|
79
|
+
| `--version <version>` | Semantic version (required) | - |
|
|
80
|
+
| `--type <type>` | System type (API, BOT, WA, etc.) | - |
|
|
81
|
+
| `--platform <platform>` | Platform (VE, EKS, NPM, etc.) | - |
|
|
82
|
+
| `--url <url>` | Control Center URL | `https://control-center.egintegrations.com` |
|
|
55
83
|
| `--token <token>` | Auth token (optional) | - |
|
|
56
84
|
| `--modules <modules>` | Comma-separated module list | - |
|
|
57
85
|
| `--output <path>` | Config file location | `.egi/telemetry.json` |
|
|
58
86
|
| `--framework <type>` | Force framework type (nextjs, express, fastify, generic) | Auto-detected |
|
|
59
87
|
| `--no-interactive` | Skip prompts, fail on missing args | Interactive mode |
|
|
60
88
|
| `--no-codegen` | Only generate config file | Code generation enabled |
|
|
61
|
-
| `--status-endpoint` | Generate status endpoint boilerplate | false |
|
|
62
89
|
|
|
63
90
|
### Framework-Specific Examples
|
|
64
91
|
|
|
@@ -66,18 +93,26 @@ npx @egintegrations/telemetry init \
|
|
|
66
93
|
|
|
67
94
|
```bash
|
|
68
95
|
cd my-nextjs-app
|
|
96
|
+
npm install @egintegrations/telemetry
|
|
69
97
|
npx @egintegrations/telemetry init
|
|
98
|
+
# Select: 1.0.0, API type, VE platform
|
|
99
|
+
|
|
100
|
+
# Deploy to Vercel
|
|
101
|
+
vercel deploy --prod
|
|
102
|
+
|
|
103
|
+
# Check dashboard - engine appears automatically!
|
|
104
|
+
# https://control-center.egintegrations.com/ui
|
|
70
105
|
```
|
|
71
106
|
|
|
72
107
|
**Generated Files:**
|
|
73
|
-
- `.egi/telemetry.json` - Configuration
|
|
74
|
-
- `lib/telemetry.ts` - Telemetry client singleton
|
|
75
|
-
- `.env.local` - Environment variables
|
|
76
|
-
- `app/api/engine-status/route.ts` - Status endpoint (if requested)
|
|
108
|
+
- `.egi/telemetry.json` - Configuration with full SKU
|
|
109
|
+
- `lib/telemetry.ts` - Telemetry client singleton (auto-registers on import)
|
|
77
110
|
|
|
78
111
|
**Usage in Next.js:**
|
|
79
112
|
```typescript
|
|
80
|
-
//
|
|
113
|
+
// The telemetry client is already registered automatically
|
|
114
|
+
// Just import and use when you need custom metrics:
|
|
115
|
+
|
|
81
116
|
import telemetry from '@/lib/telemetry';
|
|
82
117
|
|
|
83
118
|
export async function GET() {
|
|
@@ -93,35 +128,38 @@ export async function GET() {
|
|
|
93
128
|
|
|
94
129
|
```bash
|
|
95
130
|
cd my-express-app
|
|
131
|
+
npm install @egintegrations/telemetry
|
|
96
132
|
npx @egintegrations/telemetry init
|
|
133
|
+
# Select: 1.0.0, API type, EKS platform
|
|
134
|
+
|
|
135
|
+
# Deploy however you normally deploy
|
|
136
|
+
npm start
|
|
97
137
|
```
|
|
98
138
|
|
|
99
139
|
**Generated Files:**
|
|
100
|
-
- `.egi/telemetry.json` - Configuration
|
|
101
|
-
- `
|
|
102
|
-
- `.env` - Environment variables
|
|
103
|
-
- `src/routes/status.ts` - Status endpoint (if requested)
|
|
140
|
+
- `.egi/telemetry.json` - Configuration with full SKU
|
|
141
|
+
- `telemetry.ts` - Telemetry client with health endpoint
|
|
104
142
|
|
|
105
143
|
**Usage in Express:**
|
|
106
144
|
```typescript
|
|
107
|
-
//
|
|
145
|
+
// telemetry.ts already sets up /.well-known/engine-status endpoint
|
|
146
|
+
// and registers on startup. Just import and use:
|
|
147
|
+
|
|
108
148
|
import express from 'express';
|
|
109
149
|
import telemetry from './telemetry';
|
|
110
150
|
|
|
111
151
|
const app = express();
|
|
112
152
|
|
|
113
|
-
// Auto-track requests
|
|
153
|
+
// Optional: Auto-track requests
|
|
114
154
|
app.use(telemetry.middleware());
|
|
115
155
|
|
|
116
|
-
// Use in routes
|
|
156
|
+
// Use in routes for custom metrics
|
|
117
157
|
app.get('/data', async (req, res) => {
|
|
118
158
|
await telemetry.sendMetrics({ metrics: { requests: 1 } });
|
|
119
159
|
res.json({ ok: true });
|
|
120
160
|
});
|
|
121
161
|
|
|
122
|
-
app.listen(3000
|
|
123
|
-
await telemetry.register();
|
|
124
|
-
});
|
|
162
|
+
app.listen(3000);
|
|
125
163
|
```
|
|
126
164
|
|
|
127
165
|
## Manual Setup (Advanced)
|
|
@@ -136,13 +174,13 @@ import { TelemetryClient } from '@egintegrations/telemetry';
|
|
|
136
174
|
// Initialize the client
|
|
137
175
|
const telemetry = new TelemetryClient({
|
|
138
176
|
engineName: 'my-awesome-engine',
|
|
139
|
-
skuVersion: '1.0.0',
|
|
177
|
+
skuVersion: '1.0.0.API.VE.20260113', // Full SKU format: VERSION.TYPE.PLATFORM.DATE
|
|
140
178
|
controlCenterUrl: 'https://control-center.egintegrations.com',
|
|
141
179
|
authToken: 'optional-auth-token', // Optional
|
|
142
180
|
enabled: true, // Default: true
|
|
143
181
|
});
|
|
144
182
|
|
|
145
|
-
// Register your engine
|
|
183
|
+
// Register your engine (auto-creates engine in dashboard)
|
|
146
184
|
await telemetry.register({
|
|
147
185
|
environment: 'production',
|
|
148
186
|
region: 'us-east-1',
|
|
@@ -179,14 +217,16 @@ import { TelemetryClient } from '@egintegrations/telemetry';
|
|
|
179
217
|
const app = express();
|
|
180
218
|
const telemetry = new TelemetryClient({
|
|
181
219
|
engineName: 'api-server',
|
|
182
|
-
skuVersion: '1.0.0',
|
|
220
|
+
skuVersion: '1.0.0.API.EKS.20260113', // Full SKU format
|
|
183
221
|
controlCenterUrl: 'https://control-center.egintegrations.com',
|
|
184
222
|
});
|
|
185
223
|
|
|
186
224
|
// Automatic request metrics
|
|
187
225
|
app.use(telemetry.middleware());
|
|
188
226
|
|
|
189
|
-
app.listen(3000)
|
|
227
|
+
app.listen(3000, async () => {
|
|
228
|
+
await telemetry.register(); // Auto-registers in dashboard
|
|
229
|
+
});
|
|
190
230
|
```
|
|
191
231
|
|
|
192
232
|
### Automatic Health Checks
|
|
@@ -215,7 +255,7 @@ process.on('SIGTERM', async () => {
|
|
|
215
255
|
#### Constructor Options
|
|
216
256
|
|
|
217
257
|
- `engineName` (string, required) - Unique name for your engine
|
|
218
|
-
- `skuVersion` (string, required) -
|
|
258
|
+
- `skuVersion` (string, required) - Full SKU (e.g., "1.0.0.API.VE.20260113")
|
|
219
259
|
- `controlCenterUrl` (string, required) - URL of your control center
|
|
220
260
|
- `authToken` (string, optional) - Authentication token if required
|
|
221
261
|
- `enabled` (boolean, optional) - Enable/disable telemetry (default: true)
|