@comprehend/telemetry-node 0.1.2 → 0.1.4

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.
@@ -2,8 +2,8 @@
2
2
  "permissions": {
3
3
  "allow": [
4
4
  "Bash(npm test:*)",
5
- "Bash(grep:*)"
5
+ "Bash(pnpm run test:*)"
6
6
  ],
7
7
  "deny": []
8
8
  }
9
- }
9
+ }
@@ -3,6 +3,7 @@
3
3
  <component name="NewModuleRootManager">
4
4
  <content url="file://$MODULE_DIR$">
5
5
  <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/dist" />
6
7
  <excludeFolder url="file://$MODULE_DIR$/temp" />
7
8
  <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
9
  </content>
package/DEVELOPMENT.md ADDED
@@ -0,0 +1,69 @@
1
+ # Development Guide
2
+
3
+ ## Development Setup
4
+
5
+ 1. Install dependencies:
6
+ ```bash
7
+ npm install
8
+ ```
9
+
10
+ 2. Run tests:
11
+ ```bash
12
+ npm test
13
+ ```
14
+
15
+ 3. Build the package:
16
+ ```bash
17
+ npm run build
18
+ ```
19
+
20
+ ## Making a New Release
21
+
22
+ Follow these steps to release a new version:
23
+
24
+ ### 1. Update Version Number
25
+ Edit `package.json` and update the version:
26
+ ```json
27
+ {
28
+ "version": "0.1.4"
29
+ }
30
+ ```
31
+
32
+ ### 2. Run Tests
33
+ Ensure all tests pass:
34
+ ```bash
35
+ npm test
36
+ ```
37
+
38
+ ### 3. Build Distribution Package
39
+ Build the TypeScript files:
40
+ ```bash
41
+ npm run build
42
+ ```
43
+
44
+ ### 4. Publish to npm
45
+ Publish the package (requires npm authentication):
46
+ ```bash
47
+ npm publish
48
+ ```
49
+
50
+ ### 5. Verify Release
51
+ Check that the package is available:
52
+ ```bash
53
+ # View on npm
54
+ open https://www.npmjs.com/package/@comprehend/telemetry-node
55
+
56
+ # Test installation
57
+ npm install @comprehend/telemetry-node@NEW_VERSION
58
+ ```
59
+
60
+ ### Version Strategy
61
+ - **Patch** (0.1.0 → 0.1.1): Bug fixes, small improvements
62
+ - **Minor** (0.1.0 → 0.2.0): New features, backward compatible
63
+ - **Major** (0.1.0 → 1.0.0): Breaking changes
64
+
65
+ ### Prerequisites for Release
66
+ - npm account with publish access to @comprehend scope
67
+ - Authenticated with npm (`npm login`)
68
+ - All tests passing
69
+ - Clean working directory (no uncommitted changes recommended)
package/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # @comprehend/telemetry-node
2
+
3
+ OpenTelemetry integration for [comprehend.dev](https://comprehend.dev) - automatically capture and analyze your Node.js application's architecture and performance.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @comprehend/telemetry-node
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### Starting from scratch
14
+
15
+ If you don't have OpenTelemetry set up yet, here's a complete setup:
16
+
17
+ ```bash
18
+ npm install @comprehend/telemetry-node @opentelemetry/sdk-node @opentelemetry/auto-instrumentations-node
19
+ ```
20
+
21
+ ```typescript
22
+ import { NodeSDK } from '@opentelemetry/sdk-node';
23
+ import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
24
+ import { Resource } from '@opentelemetry/resources';
25
+ import { ComprehendDevSpanProcessor } from '@comprehend/telemetry-node';
26
+
27
+ // Set up OpenTelemetry with your service information
28
+ const sdk = new NodeSDK({
29
+ resource: new Resource({
30
+ 'service.name': 'my-node-service',
31
+ 'service.namespace': 'production',
32
+ 'deployment.environment': 'prod'
33
+ }),
34
+ spanProcessors: [
35
+ new ComprehendDevSpanProcessor({
36
+ organization: 'your-org', // Use your organization name
37
+ token: process.env.COMPREHEND_INGESTION_TOKEN!,
38
+ debug: true // Optional: enable debug logging (or pass a custom logger function)
39
+ })
40
+ ],
41
+ instrumentations: [getNodeAutoInstrumentations()],
42
+ });
43
+
44
+ sdk.start();
45
+
46
+ // Graceful shutdown
47
+ process.on('SIGTERM', () => {
48
+ sdk.shutdown().then(() => console.log('Tracing terminated'));
49
+ });
50
+ ```
51
+
52
+ ### Adding to existing OpenTelemetry setup
53
+
54
+ If you already have OpenTelemetry configured, simply add the ComprehendDevSpanProcessor to your existing span processors:
55
+
56
+ ```typescript
57
+ import { ComprehendDevSpanProcessor } from '@comprehend/telemetry-node';
58
+
59
+ // Add to your existing span processors array
60
+ const comprehendProcessor = new ComprehendDevSpanProcessor({
61
+ organization: 'your-org',
62
+ token: process.env.COMPREHEND_INGESTION_TOKEN!,
63
+ debug: false // Optional
64
+ });
65
+
66
+ // If using NodeSDK:
67
+ const sdk = new NodeSDK({
68
+ // ... your existing config
69
+ spanProcessors: [
70
+ // ... your existing processors
71
+ comprehendProcessor
72
+ ],
73
+ });
74
+
75
+ // Or if using TracerProvider directly:
76
+ tracerProvider.addSpanProcessor(comprehendProcessor);
77
+ ```
78
+
79
+ ## Configuration
80
+
81
+ Set your comprehend.dev ingestion token as an environment variable:
82
+
83
+ ```bash
84
+ export COMPREHEND_INGESTION_TOKEN=your-ingestion-token-here
85
+ ```
86
+
87
+ **Note:** In production environments, the token should be stored in a secure secret management system (such as AWS Secrets Manager, HashiCorp Vault, Azure Key Vault, Kubernetes Secrets, or your cloud provider's secret management service) and injected into the environment through your container orchestrator's workload definition or service configuration.
88
+
89
+ ## What it captures
90
+
91
+ This integration automatically captures:
92
+
93
+ - **HTTP Routes** - API endpoints and their usage patterns
94
+ - **Database Operations** - SQL queries with table operations analysis
95
+ - **Service Dependencies** - HTTP client calls to external services
96
+ - **Performance Metrics** - Request durations, response codes, error rates
97
+ - **Service Architecture** - Automatically maps your service relationships
98
+
99
+ ## Requirements
100
+
101
+ - Node.js 14+
102
+ - OpenTelemetry SDK (peer dependency)
103
+
104
+ ## Framework Support
105
+
106
+ Works with any Node.js framework that supports OpenTelemetry auto-instrumentation:
107
+
108
+ - Express
109
+ - Fastify
110
+ - Koa
111
+ - NestJS
112
+ - PostgreSQL
113
+ - MySQL
114
+ - MongoDB
115
+ - Prisma
116
+ - Sequelize
117
+ - TypeORM
118
+ - And more...
119
+
120
+ ## Learn More
121
+
122
+ - Visit [comprehend.dev](https://comprehend.dev) for documentation and to get your ingestion token
123
+ - [OpenTelemetry JavaScript Documentation](https://opentelemetry.io/docs/languages/js/)
124
+
125
+ ## Development
126
+
127
+ See [DEVELOPMENT.md](DEVELOPMENT.md) for development setup and release instructions.
@@ -72,6 +72,7 @@ class ComprehendDevSpanProcessor {
72
72
  ...(environment ? { environment } : {})
73
73
  };
74
74
  this.ingestMessage(message);
75
+ return newService;
75
76
  }
76
77
  processHTTPRoute(service, route, method, span) {
77
78
  // Check if this route+method already exists under the service
@@ -0,0 +1 @@
1
+ export {};