Skip to content

Commit

Permalink
Merge pull request #733 from instana/instana-exporter-example
Browse files Browse the repository at this point in the history
chore: added instana exporter example
  • Loading branch information
kirrg001 authored Apr 26, 2023
2 parents 4ed7563 + 0a30e54 commit e105220
Show file tree
Hide file tree
Showing 10 changed files with 3,728 additions and 0 deletions.
2 changes: 2 additions & 0 deletions env.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ agent_endpoint_port=443
# agent_zone=otel-tests

# Need to compile host id manually, globally unique
APP_PORT=
INSTANA_HOST_ID=123456789
INSTANA_AGENT_KEY=${agent_key}
INSTANA_ENDPOINT_URL=${instana_endpoint}
INSTANA_OTLP_ENDPOINT=your-otlp-endpoint.here:4317

# For use with otel-collector, set this to "otel-collector:4317"
Expand Down
1 change: 1 addition & 0 deletions instana-exporter/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions instana-exporter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
15 changes: 15 additions & 0 deletions instana-exporter/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:18

ENV INSTANA_AUTO_PROFILE true

EXPOSE 8080

WORKDIR /opt/server

COPY package-lock.json package.json /opt/server/

RUN npm install

COPY server.js tracer.js logger.js /opt/server/

CMD ["node", "-r", "./tracer.js", "server.js"]
11 changes: 11 additions & 0 deletions instana-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Opentelemetry Instana Exporter Demo

https://www.ibm.com/docs/en/instana-observability/243?topic=nodejs-opentelemetry-integration#serverless-opentelemetry-exporter

This demo will transform Otel spans into Instana spans using the Instana exporter. The spans are send directly to the serverless acceptor in our backend. Data is generated every 5s.

1. Copy env.example to .env
2. Add APP_PORT, INSTANA_AGENT_KEY and INSTANA_ENDPOINT_URL. (You need to use the serverless endpoint)
3. `npm run start`
4. Go to services and look for "Instana Exporter Demo"

7 changes: 7 additions & 0 deletions instana-exporter/logger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

const logger = require('pino')();
const pinoHttp = require('pino-http')();

module.exports = logger;
module.exports.expressLogger = pinoHttp;
Loading

0 comments on commit e105220

Please sign in to comment.