-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add opentelemetry for bio-api
Signed-off-by: Manuel Ruck <[email protected]>
- Loading branch information
Manuel Ruck
committed
Aug 4, 2024
1 parent
403ef86
commit b129be6
Showing
5 changed files
with
1,371 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const { NodeSDK } = require('@opentelemetry/sdk-node'); | ||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node'); | ||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http'); | ||
const { Resource } = require('@opentelemetry/resources'); | ||
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions'); | ||
|
||
if (!process.env.OTEL_EXPORTER_OTLP_TRACES_URL) { | ||
console.warn('OTEL_EXPORTER_OTLP_TRACES_URL is not set, tracing will not be enabled'); | ||
} else { | ||
// do not set headers in exporterOptions, the OTel spec recommends setting headers through ENV variables | ||
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables | ||
|
||
// highlight-start | ||
const exporterOptions = { | ||
url: process.env.OTEL_EXPORTER_OTLP_TRACES_URL, | ||
}; | ||
// highlight-end | ||
|
||
const traceExporter = new OTLPTraceExporter(exporterOptions); | ||
const sdk = new NodeSDK({ | ||
traceExporter, | ||
instrumentations: [getNodeAutoInstrumentations()], | ||
resource: new Resource({ | ||
// highlight-next-line | ||
[SemanticResourceAttributes.SERVICE_NAME]: 'bundestag-io-api', | ||
}), | ||
}); | ||
|
||
// initialize the SDK and register with the OpenTelemetry API | ||
// this enables the API to record telemetry | ||
sdk.start(); | ||
|
||
// gracefully shut down the SDK on process exit | ||
process.on('SIGTERM', () => { | ||
sdk | ||
.shutdown() | ||
.then(() => console.log('Tracing terminated')) | ||
.catch((error) => console.log('Error terminating tracing', error)) | ||
.finally(() => process.exit(0)); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
kind: Deploy | ||
type: helm | ||
name: cert-manager | ||
|
||
spec: | ||
chart: | ||
name: cert-manager | ||
repo: https://charts.jetstack.io | ||
version: v1.15.1 | ||
values: | ||
installCRDs: true | ||
--- | ||
kind: Deploy | ||
type: helm | ||
name: opentelemetry | ||
|
||
dependencies: | ||
- deploy.cert-manager | ||
|
||
spec: | ||
chart: | ||
name: opentelemetry-operator | ||
repo: https://open-telemetry.github.io/opentelemetry-helm-charts | ||
version: '0.64.2' | ||
values: | ||
manager: | ||
collectorImage: | ||
repository: otel/opentelemetry-collector | ||
--- | ||
kind: Deploy | ||
type: helm | ||
name: signoz | ||
|
||
dependencies: | ||
- deploy.opentelemetry | ||
|
||
spec: | ||
chart: | ||
name: signoz | ||
repo: https://charts.signoz.io | ||
version: 0.46.0 | ||
values: | ||
frontend: | ||
ingress: | ||
enabled: true | ||
hosts: | ||
- host: 'signoz.${var.hostname}' | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
port: 3301 | ||
otelCollector: | ||
ingress: | ||
enabled: true | ||
hosts: | ||
- host: 'otelcollector.${var.hostname}' | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
port: 4318 | ||
schemaMigrator: | ||
enabled: false |
Oops, something went wrong.