Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
9058592
chore: playground done
kirrg001 Apr 9, 2026
dc8bcd9
chore: infra cor
kirrg001 Apr 9, 2026
062bdc7
chore: phase 1
abhilash-sivan May 4, 2026
79db188
chore: phase 2
abhilash-sivan May 4, 2026
65a6346
chore: phase 3
abhilash-sivan May 7, 2026
73c6747
chore: cleanup
abhilash-sivan May 7, 2026
88339a3
chore: rewrite
abhilash-sivan May 7, 2026
f491602
chore: test
abhilash-sivan May 7, 2026
f828557
chore: a
abhilash-sivan May 7, 2026
90c4036
chore: new fields
abhilash-sivan May 7, 2026
5881174
chore: test
abhilash-sivan May 7, 2026
3b1c1d7
test: fixed failing test
abhilash-sivan May 10, 2026
dc1d0ac
chore: cleanup
abhilash-sivan May 10, 2026
a9eadb4
chore: ui corrected
abhilash-sivan May 13, 2026
17b0e96
chore: added kafka and pg, generalize
abhilash-sivan May 14, 2026
93432b7
chore: update
abhilash-sivan May 14, 2026
e1db00a
chore: fix
abhilash-sivan May 15, 2026
b446627
chore: clean
abhilash-sivan May 15, 2026
c53e8c5
chore: update
abhilash-sivan May 15, 2026
4b24288
chore: added readme
abhilash-sivan May 18, 2026
0b8f5ec
chore: added example
abhilash-sivan May 18, 2026
bbe510f
chore: added example transformer
abhilash-sivan May 18, 2026
1bf37de
chore: update readme to minimal
abhilash-sivan May 18, 2026
83d38f6
chore: update logic
abhilash-sivan May 19, 2026
31f2d33
chore: spanBuffer uses temporary converter
abhilash-sivan May 19, 2026
2ada04a
chore: move files for using inside spanBuffer
abhilash-sivan May 19, 2026
d814ae5
chore: update
abhilash-sivan May 19, 2026
e17f7a6
chore: rearrange
abhilash-sivan May 19, 2026
34dccf6
chore: added separate transformer
abhilash-sivan May 20, 2026
ddabdce
chore: added example otel spans
abhilash-sivan May 20, 2026
f64f968
chore: make getSpanType dynamic
abhilash-sivan May 20, 2026
e1b05e7
chore: fix status
abhilash-sivan May 20, 2026
3150adf
chore: kafka systemName
abhilash-sivan May 20, 2026
bb0ba34
chore: v1 of multiple data key logic
abhilash-sivan May 21, 2026
ddb816e
chore: refactor
abhilash-sivan May 21, 2026
0e62e28
chore: optimize additioanl attributes
abhilash-sivan May 22, 2026
1f9a6aa
chore: wip more dynamic
abhilash-sivan May 22, 2026
b6857b2
chore: refatcor transformers
abhilash-sivan May 26, 2026
63d6b16
chore: refactor main file
abhilash-sivan May 26, 2026
2f8ae5a
chore: new otel span type file
abhilash-sivan May 26, 2026
f86ba13
chore: cleanup otlp transformer
abhilash-sivan May 26, 2026
c65abdc
chore: minor refactor for pr comment
abhilash-sivan May 26, 2026
c99ab4b
chore: udpate example app
abhilash-sivan Jun 2, 2026
6f59ead
chore: refactor 1
abhilash-sivan Jun 4, 2026
1f6d78e
chore: same format
abhilash-sivan Jun 4, 2026
bd43972
chore: remove circular dependency
abhilash-sivan Jun 4, 2026
a3c14ca
chore: use fn instead of string
abhilash-sivan Jun 4, 2026
53be07a
chore: rearrange
abhilash-sivan Jun 4, 2026
6ea5b7d
chore: refactor clean
abhilash-sivan Jun 4, 2026
9c32500
chore: refactor
abhilash-sivan Jun 4, 2026
0f3946e
chore: fix refactorig issues
abhilash-sivan Jun 4, 2026
43a00bb
chore: rearrage
abhilash-sivan Jun 4, 2026
f7350f9
chore: resolve priority span type
abhilash-sivan Jun 5, 2026
916e062
chore: updated structure
abhilash-sivan Jun 5, 2026
b9efdf9
chore: remove parentSpanContext for now
abhilash-sivan Jun 5, 2026
a2cfd61
chore: add version specific directory
abhilash-sivan Jun 5, 2026
f95968f
chore: service name resolution
abhilash-sivan Jun 5, 2026
5884202
chore: instr
aryamohanan Jun 8, 2026
24c8460
chore: updated the structure
aryamohanan Jun 8, 2026
b52c415
chore: tested kafka+ mongo
aryamohanan Jun 8, 2026
bcb7c4d
chore: updated
aryamohanan Jun 8, 2026
3801dcd
chore: skip log spans
aryamohanan Jun 8, 2026
d405719
chore: fine tuning
aryamohanan Jun 8, 2026
059bf5f
chore: fine tuning
aryamohanan Jun 8, 2026
25613ac
chore: renaming
aryamohanan Jun 9, 2026
94ec592
chore: added events and links
aryamohanan Jun 9, 2026
5b53b99
chore: revert
aryamohanan Jun 9, 2026
25f5dec
chore: updated
aryamohanan Jun 9, 2026
24af53b
chore: more claenup
aryamohanan Jun 9, 2026
9e6eafe
chore: readme update
aryamohanan Jun 9, 2026
0cf6f8c
chore: cleanup and test
aryamohanan Jun 9, 2026
cfc3fd5
chore: updated span status logic
aryamohanan Jun 10, 2026
577b333
chore: added some cleanup
aryamohanan Jun 10, 2026
abbe261
chore: metrics
aryamohanan Jun 10, 2026
97cfc76
chore: fixed timestap and duration
abhilash-sivan Jun 11, 2026
c63ed0e
chore: restructure
aryamohanan Jun 11, 2026
5fdba8c
chore: deleted unwanted files
aryamohanan Jun 11, 2026
35da81d
chore: more cleanup
aryamohanan Jun 11, 2026
e1de12d
test: updated
aryamohanan Jun 12, 2026
97c1bd5
chore: moved examples
aryamohanan Jun 12, 2026
9397df9
chore: fine tuning
aryamohanan Jun 12, 2026
29ea7cd
chore: metrics
aryamohanan Jun 12, 2026
9e4bb49
chore: agentconnection
aryamohanan Jun 12, 2026
76c3062
chore: agentconnection
aryamohanan Jun 12, 2026
1d63335
chore: metrics handled
aryamohanan Jun 12, 2026
ef39a22
chore: trcaes handled
aryamohanan Jun 12, 2026
5731615
chore: review comments
aryamohanan Jun 12, 2026
59fda36
chore: resource
aryamohanan Jun 12, 2026
106e017
chore: updated
aryamohanan Jun 12, 2026
97e97b7
chore: updated
aryamohanan Jun 12, 2026
e3ae1c6
chore: updated codebase
aryamohanan Jun 13, 2026
fe54baa
chore: updated
aryamohanan Jun 15, 2026
dce8d7d
chore: handled dual transformation
abhilash-sivan Jun 15, 2026
fc574d3
chore: corrected mappings from internal format
abhilash-sivan Jun 15, 2026
8daec24
test: fix tests
abhilash-sivan Jun 15, 2026
1c47ac7
test: added azure blob test
abhilash-sivan Jun 15, 2026
eadce21
chore: improved metrics
aryamohanan Jun 15, 2026
760c939
chore: improved metrics
aryamohanan Jun 15, 2026
ef0c426
chore: test
aryamohanan Jun 15, 2026
2faa117
chore: test
aryamohanan Jun 15, 2026
e3578d1
chore: test
aryamohanan Jun 15, 2026
4c1b0e1
chore: updated
aryamohanan Jun 15, 2026
c687c02
chore: updated
aryamohanan Jun 15, 2026
8982b47
chore: updated
aryamohanan Jun 16, 2026
ee8f0df
chore: fine tuning
aryamohanan Jun 16, 2026
615dcb5
chore: removed comments from agent conn
aryamohanan Jun 16, 2026
b93c790
chore: fixed tests
aryamohanan Jun 16, 2026
d56d1ae
chore: updated
aryamohanan Jun 16, 2026
9f917f9
chore: handled error.type
abhilash-sivan Jun 16, 2026
21d70b1
chore: config
aryamohanan Jun 16, 2026
5cbc32f
chore: updated
aryamohanan Jun 16, 2026
849e549
chore: updated
aryamohanan Jun 16, 2026
05c8bb0
chore: cleanup
aryamohanan Jun 16, 2026
1ecb7f4
chore: fine tuning
aryamohanan Jun 16, 2026
607774a
chore: fine tuning
aryamohanan Jun 16, 2026
c803916
chore: resource
aryamohanan Jun 16, 2026
0b054c3
chore: resource
aryamohanan Jun 16, 2026
d11d895
chore: updated http span mapping for host and port
abhilash-sivan Jun 16, 2026
7da20dd
chore: clean code
aryamohanan Jun 16, 2026
c6482c2
chore: clean metrics
aryamohanan Jun 16, 2026
af86a7d
chore: clean code
aryamohanan Jun 16, 2026
bbfe2e2
chore: updated
aryamohanan Jun 17, 2026
d075b5a
chore: renamed
aryamohanan Jun 17, 2026
0a22947
chore: renamed
aryamohanan Jun 17, 2026
c21fd18
chore: updated
aryamohanan Jun 17, 2026
23a4651
chore: updated
aryamohanan Jun 17, 2026
32df20e
chore: updated
aryamohanan Jun 17, 2026
75b67c5
chore: updated
aryamohanan Jun 17, 2026
e4f95a4
chore: updated mapping
aryamohanan Jun 18, 2026
7c47812
chore: updated
aryamohanan Jun 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion example-apps/collector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "1.0.0",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js"
"start": "node src/index.js",
"start:otlp": "INSTANA_OTLP_ENABLED=true node src/index.js"
},
"dependencies": {
"@instana/collector": "latest",
Expand Down
4 changes: 4 additions & 0 deletions example-apps/otel-exporter-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
data.txt
npm-debug.log
.DS_Store
236 changes: 236 additions & 0 deletions example-apps/otel-exporter-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
# OpenTelemetry Exporter Test App

A comprehensive Express.js application for testing OpenTelemetry tracing with Instana backend, including HTTP, PostgreSQL, and Kafka instrumentation.

## Features

- **HTTP tracing**: Express.js REST API with external HTTP calls
- **PostgreSQL tracing**: Database queries with pg driver
- **Kafka tracing**: Message producer and consumer
- **OpenTelemetry auto-instrumentation**: Automatic tracing for all operations
- **OTLP HTTP exporter**: Configured for Instana backend
- **Debug logging**: Console output for spans

## Prerequisites

1. **PostgreSQL** running on `localhost:5432`
- Database: `nodedb`
- User: `node`
- Password: `nodepw`

2. **Kafka** running on `localhost:9092`
- Topic: `test-topic` (will be created automatically)

3. **Instana** account with OTLP endpoint access

## Setup

### 1. Install Dependencies

```bash
npm install
```

### 2. Configure PostgreSQL

```bash
# Create database and user
psql -U postgres
CREATE DATABASE nodedb;
CREATE USER node WITH PASSWORD 'nodepw';
GRANT ALL PRIVILEGES ON DATABASE nodedb TO node;
```

### 3. Configure Kafka

Make sure Kafka is running on `localhost:9092`. If using Docker:

```bash
docker run -d --name kafka \
-p 9092:9092 \
-e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \
-e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 \
confluentinc/cp-kafka:latest
```

### 4. Update Instana Configuration

Edit `tracing.js` and update:
- `url`: Your Instana OTLP endpoint
- `x-instana-key`: Your Instana API key

### 5. Start the Application

```bash
npm start
```

Or for development with otel:

```bash
npm run start-otel
```

## API Endpoints

### 1. HTTP Entry + HTTP Exit

Tests HTTP client instrumentation with external API call.

```bash
curl http://localhost:3000/external-api
```

**Expected trace:**
- HTTP server span (Express)
- HTTP client span (fetch to jsonplaceholder.typicode.com)

### 2. HTTP Entry + PostgreSQL Exit

Tests PostgreSQL database instrumentation.

```bash
curl http://localhost:3000/db
```

**Expected trace:**
- HTTP server span (Express)
- PostgreSQL query span

### 3. HTTP Entry + Kafka Exit

Tests Kafka producer instrumentation.

```bash
curl -X POST http://localhost:3000/kafka \
-H "Content-Type: application/json" \
-d '{"message":"Hello from OpenTelemetry!"}'
```

**Expected trace:**
- HTTP server span (Express)
- Kafka producer span
- Kafka consumer span (async, separate trace)

## Tracing Details

The application automatically traces:

### HTTP Operations
- Express route handlers
- Outgoing HTTP requests (fetch/axios)
- Request/response details

### PostgreSQL Operations
- SQL queries
- Connection details
- Query parameters

### Kafka Operations
- Message production
- Message consumption
- Topic and partition information
- Custom attributes via hooks

## Viewing Traces

1. Make requests to the API endpoints
2. Check console output for span details
3. View traces in your Instana dashboard

## Troubleshooting

### PostgreSQL Connection Issues

```bash
# Check if PostgreSQL is running
pg_isready -h localhost -p 5432

# Test connection
psql -h localhost -U node -d nodedb
```

### Kafka Connection Issues

```bash
# Check if Kafka is running
nc -zv localhost 9092

# List topics
kafka-topics --list --bootstrap-server localhost:9092
```

### OpenTelemetry Issues

- Check console output for initialization messages
- Verify OTLP endpoint is accessible
- Ensure API key is correct
- Set log level to `DiagLogLevel.DEBUG` in `tracing.js` for more details

## Configuration

### Disable Console Exporter

In `tracing.js`, comment out:

```javascript
// provider.addSpanProcessor(new SimpleSpanProcessor(consoleExporter));
```

### Change Service Name

In `tracing.js`, update:

```javascript
[SemanticResourceAttributes.SERVICE_NAME]: 'your-service-name'
```

### Disable Specific Instrumentations

In `tracing.js`, modify the `getNodeAutoInstrumentations` options:

```javascript
getNodeAutoInstrumentations({
'@opentelemetry/instrumentation-fs': { enabled: false },
'@opentelemetry/instrumentation-dns': { enabled: false }
})
```

## Docker Setup (Optional)

For running PostgreSQL and Kafka in Docker:

```bash
# PostgreSQL
docker run -d --name postgres \
-e POSTGRES_USER=node \
-e POSTGRES_PASSWORD=nodepw \
-e POSTGRES_DB=nodedb \
-p 5432:5432 \
postgres:15

# Kafka (requires Zookeeper)
docker-compose up -d
```

Create a `docker-compose.yml`:

```yaml
version: '3'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181

kafka:
image: confluentinc/cp-kafka:latest
depends_on:
- zookeeper
ports:
- "9092:9092"
environment:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
```
106 changes: 106 additions & 0 deletions example-apps/otel-exporter-test/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* (c) Copyright IBM Corp. 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this app still?
Wondering if we can just have a separate npm script in the example-apps/collector app?

With config otlp being on.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this after finishing the playground work, since the example app also includes Kafka and database tests that are only required for playground testing.

*/

'use strict';

const express = require('express');
const { Pool } = require('pg');
const { sendKafkaMessage, startKafkaConsumer } = require('./kafka');

const app = express();
app.use(express.json());

const PORT = 3000;

const pool = new Pool({
host: 'localhost',
port: 5432,
user: 'node',
password: 'nodepw',
database: 'nodedb'
});

// ---------------------------------------------------
// 1. HTTP ENTRY + HTTP EXIT
// ---------------------------------------------------

app.get('/external-api', async (req, res) => {
try {
const response = await fetch('https://jsonplaceholder.typicode.com/todos/1');
const data = await response.json();

res.json({
success: true,
data
});
} catch (err) {
// eslint-disable-next-line no-console
console.error(err);

res.status(500).json({
error: err.message
});
}
});

// ---------------------------------------------------
// 2. HTTP ENTRY + PG EXIT
// ---------------------------------------------------

app.get('/db', async (req, res) => {
try {
const result = await pool.query('SELECT NOW() as current_time');

res.json({
success: true,
rows: result.rows
});
} catch (err) {
// eslint-disable-next-line no-console
console.error(err);

res.status(500).json({
error: err.message
});
}
});

// ---------------------------------------------------
// 3. HTTP ENTRY + KAFKA EXIT
// ---------------------------------------------------

app.post('/kafka', async (req, res) => {
try {
const payload = req.body || {
hello: 'world'
};

await sendKafkaMessage(payload);

res.json({
success: true,
sent: payload
});
} catch (err) {
// eslint-disable-next-line no-console
console.error(err);

res.status(500).json({
error: err.message
});
}
});

// ---------------------------------------------------
// START
// ---------------------------------------------------

app.listen(PORT, async () => {
// eslint-disable-next-line no-console
console.log(`Server running on port ${PORT}`);

await startKafkaConsumer();
});

// Made with Bob
Loading