Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: added instana exporter example #733

Merged
merged 2 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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