Skip to content

Commit

Permalink
add microsoft application insights as a supported trace datastore exa…
Browse files Browse the repository at this point in the history
…mples (#2692)

* save commit

* feature: Azure Application Insights Datastore Integration

* feature(examples): adding azure examples

* feature(examples): adding azure examples

* feature(examples): adding azure examples
  • Loading branch information
xoscar committed Jun 9, 2023
1 parent e16ed87 commit 235c3f1
Show file tree
Hide file tree
Showing 38 changed files with 14,887 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/tracetest-azure-app-insights-collector/.env
@@ -0,0 +1 @@
INSTRUMENTATION_KEY=""
2 changes: 2 additions & 0 deletions examples/tracetest-azure-app-insights-collector/.gitignore
@@ -0,0 +1,2 @@
config.yaml
node_modules
10 changes: 10 additions & 0 deletions examples/tracetest-azure-app-insights-collector/Dockerfile
@@ -0,0 +1,10 @@
FROM node:slim
WORKDIR /usr/src/app

COPY ./src/package*.json ./

RUN npm install
COPY ./src .

EXPOSE 8080
CMD [ "npm", "start" ]
13 changes: 13 additions & 0 deletions examples/tracetest-azure-app-insights-collector/README.md
@@ -0,0 +1,13 @@
# Tracetest + OTel Collector + Azure Application Insights (using the OpenTelemetry Collector)

> [Read the detailed recipe for setting up Tracetest + OTel Collector + Azure Application Insights (using the OpenTelemetry Collector) in our documentation.](https://docs.tracetest.io/examples-tutorials/recipes/running-tracetest-with-azure-app-insights-otel-collector)
This repository objective is to show how you can configure your Tracetest instance using the OpenTelemetry collector to send telemetry data to both Azure App Insights and the Tracetest.

## Steps

1. [Install the tracetest CLI](https://docs.tracetest.io/installing/)
2. Run `tracetest configure --endpoint http://localhost:11633` on a terminal
3. Update the `.env` file adding a valid set the valid App Insights Instrumentation Key
4. Run the project by using docker-compose: `docker compose -f ./docker-compose.yaml -f ./tracetest/docker-compose.yaml up -d`
5. Test if it works by running: `tracetest test run -d tests/test.yaml`. This would trigger a test that will send spans to Azure Monitor API and directly to Tracetest that is running on your machine.
@@ -0,0 +1,26 @@
receivers:
otlp:
protocols:
grpc:
http:

processors:
batch:

exporters:
azuremonitor:
instrumentation_key: ${INSTRUMENTATION_KEY}
otlp/tracetest:
endpoint: tracetest:4317
tls:
insecure: true

service:
pipelines:
traces/tracetest:
receivers: [otlp]
processors: [batch]
exporters: [otlp/tracetest]
traces/appinsights:
receivers: [otlp]
exporters: [azuremonitor]
@@ -0,0 +1,17 @@
version: "3"
services:
app:
build: .
ports:
- "8080:8080"
otel-collector:
image: otel/opentelemetry-collector-contrib:latest
command:
- "--config"
- "/otel-local-config.yaml"
volumes:
- ./collector.config.yaml:/otel-local-config.yaml
environment:
INSTRUMENTATION_KEY: ${INSTRUMENTATION_KEY}
ports:
- 4317:4317
28 changes: 28 additions & 0 deletions examples/tracetest-azure-app-insights-collector/src/app.js
@@ -0,0 +1,28 @@
const express = require("express");
const app = express();
const https = require("https");

app.get("/", (req, res) => {
setTimeout(() => {
res.send("Hello World");
}, 1000);
});

app.get("/http-request/", (req, res) => {
const endpoint = "https://www.microsoft.com/";
https.get(endpoint, (response) => {
response.on("data", () => {});

response.on("error", (err) => {
res.send(`Encountered error while making HTTPS request: ${err}`);
});

response.on("end", () => {
res.send(`Successfully reached ${endpoint}.`);
});
});
});

app.listen(8080, () => {
console.log(`Listening for requests on http://localhost:8080`);
});

0 comments on commit 235c3f1

Please sign in to comment.