@oneteme/inspect-ng-collector 1.3.3 → 1.3.4-beta.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 CHANGED
@@ -3,7 +3,6 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@oneteme/inspect-ng-collector.svg)](https://www.npmjs.com/package/@oneteme/inspect-ng-collector)
4
4
  [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
5
  [![Angular Version](https://img.shields.io/badge/Angular-%3E%3D16.2.8-red.svg)](https://angular.io)
6
- [![Tests](https://img.shields.io/badge/Tests-150%2B%20Cases-brightgreen.svg)](#testing)
7
6
 
8
7
  A comprehensive **front-end telemetry and monitoring library for Angular applications**. Automatically collect user interactions, HTTP requests, navigation events, performance metrics, and errors—then send them to your backend analytics service.
9
8
 
@@ -34,11 +33,6 @@ A comprehensive **front-end telemetry and monitoring library for Angular applica
34
33
  - Environment and version tracking
35
34
  - Debug mode for development
36
35
 
37
- - **🧪 Fully Tested**
38
- - 150+ unit test cases
39
- - 80%+ code coverage
40
- - Comprehensive test documentation
41
-
42
36
  ## 📦 Installation
43
37
 
44
38
  ```bash
@@ -133,59 +127,48 @@ export class MyService {
133
127
 
134
128
  ```typescript
135
129
  NgCollectorModule.forRoot({
136
- // Core Configuration
137
- enabled: true, // Enable/disable collection
138
- debugMode: false, // Enable debug console output
139
-
140
- // Application Identity (at root level)
141
- name: 'my-app',
142
- version: () => getAppVersion(), // Can be a function
143
- env: 'production',
144
- user: 'john@example.com', // Optional user identifier
145
-
146
- // Additional Properties
147
- additionalProperties: () => ({
148
- customProperty: 'value',
149
- userId: getUserId()
150
- }),
151
-
152
- // Scheduling
153
- scheduling: {
154
- interval: 30000 // Export interval in ms (default: 30s)
155
- },
156
-
157
- // Monitoring Configuration
158
- monitoring: {
159
- // HTTP Monitoring
160
- httpRoute: {
161
- excludes: {
162
- path: [/\/health$/, /\/status$/] // Exclude paths from tracking
163
- }
164
- },
165
- httpRequest: {
166
- excludes: {
167
- host: ['localhost:4200'] // Exclude hosts
168
- }
130
+ collector: {
131
+ enabled: true,
132
+ debugMode: false,
133
+ application: {
134
+ name: 'my-app',
135
+ namespace: 'jarvis',
136
+ version: () => getAppVersion(),
137
+ env: 'production',
138
+ user: 'john@example.com'
169
139
  },
170
- // Features
171
- resources: {
172
- enabled: true // Track memory usage
140
+ additionalProperties: () => ({
141
+ customProperty: 'value',
142
+ userId: getUserId()
143
+ }),
144
+ scheduling: {
145
+ interval: 30000, // milliseconds; default: 60000
146
+ queueCapacity: 1000
173
147
  },
174
- analytics: {
175
- enabled: true // Track user actions
148
+ monitoring: {
149
+ httpRoute: {
150
+ excludes: {
151
+ path: [/\/health$/, /\/status$/]
152
+ }
153
+ },
154
+ httpRequest: {
155
+ excludes: {
156
+ host: ['localhost:4200']
157
+ }
158
+ },
159
+ resources: { enabled: true },
160
+ analytics: { enabled: true },
161
+ logger: { enabled: true }, // Capture console.warn and console.error
162
+ reporter: { enabled: true }, // Send internal collector reports
163
+ storage: { enabled: false }
176
164
  },
177
- storage: {
178
- enabled: false // Track storage events
179
- }
180
- },
181
-
182
- // Tracing Configuration
183
- tracing: {
184
- queueCapacity: 1000, // Max events in queue
185
- remote: {
186
- host: 'https://analytics.example.com',
187
- mode: 'cors',
188
- retentionMaxAge: 86400000 // 24 hours
165
+ tracing: {
166
+ remote: {
167
+ host: 'https://analytics.example.com',
168
+ mode: 'cors',
169
+ token: () => getCollectorToken(),
170
+ retentionMaxAge: { audit: 7, diagnostics: 10 }
171
+ }
189
172
  }
190
173
  }
191
174
  })
@@ -195,18 +178,22 @@ NgCollectorModule.forRoot({
195
178
 
196
179
  | Property | Type | Default | Description |
197
180
  |----------|------|---------|-------------|
198
- | `enabled` | boolean | false | Enable/disable collection |
199
- | `debugMode` | boolean | false | Enable debug output |
200
- | `name` | string \| function | required | Application name |
201
- | `version` | string \| function | optional | Application version |
202
- | `env` | string \| function | optional | Environment (prod, dev, etc.) |
203
- | `user` | string \| function | optional | Current user identifier |
204
- | `additionalProperties` | function | optional | Custom app properties |
205
- | `scheduling.interval` | number | 30000 | Event export interval (ms) |
206
- | `monitoring.resources.enabled` | boolean | false | Track memory metrics |
207
- | `monitoring.analytics.enabled` | boolean | false | Track user interactions |
208
- | `tracing.queueCapacity` | number | 1000 | Max queued events |
209
- | `tracing.remote.host` | string | required | Backend analytics endpoint |
181
+ | `collector.enabled` | boolean | false | Enable/disable collection |
182
+ | `collector.debugMode` | boolean | false | Enable debug output |
183
+ | `collector.application.name` | string \| function | required | Application name |
184
+ | `collector.application.namespace` | string \| function | required | Application namespace |
185
+ | `collector.application.env` | string \| function | required | Environment (prod, dev, etc.) |
186
+ | `collector.application.user` | string \| function | optional | Current user identifier |
187
+ | `collector.scheduling.interval` | number | 60000 | Event export interval (ms) |
188
+ | `collector.scheduling.queueCapacity` | number | 1000 | Maximum queued traces |
189
+ | `collector.monitoring.resources.enabled` | boolean | false | Track memory metrics |
190
+ | `collector.monitoring.analytics.enabled` | boolean | false | Track user interactions |
191
+ | `collector.monitoring.logger.enabled` | boolean | false | Capture `console.warn()` and `console.error()` calls |
192
+ | `collector.monitoring.reporter.enabled` | boolean | false | Send internal collector reports |
193
+ | `collector.tracing.remote.host` | string | `http://localhost` | Backend analytics endpoint |
194
+ | `collector.tracing.remote.token` | string \| function | empty | Backend authentication token |
195
+
196
+ Console capture covers `warn` and `error`, not `log` or `info`. Captured messages are sent to the configured backend, so avoid logging secrets or other sensitive values.
210
197
 
211
198
  ## 📊 Collected Data
212
199