mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-01-16 23:00:51 +00:00
Add OpenTelemetry headers to probe and other services
This commit is contained in:
parent
4c49189315
commit
4efca8a758
10 changed files with 31 additions and 18 deletions
|
|
@ -94,12 +94,14 @@ export default class Telemetry {
|
|||
if (!this.sdk) {
|
||||
const headers: Dictionary<string> = this.getHeaders();
|
||||
|
||||
const hasHeaders: boolean = Object.keys(headers).length > 0;
|
||||
|
||||
let traceExporter: SpanExporter | undefined = undefined;
|
||||
|
||||
let metricReader: PeriodicExportingMetricReader | undefined =
|
||||
undefined;
|
||||
|
||||
if (this.getOltpTracesEndpoint()) {
|
||||
if (this.getOltpTracesEndpoint() && hasHeaders) {
|
||||
traceExporter = new OTLPTraceExporter({
|
||||
url: this.getOltpTracesEndpoint()!.toString(),
|
||||
headers: headers,
|
||||
|
|
@ -107,7 +109,7 @@ export default class Telemetry {
|
|||
});
|
||||
}
|
||||
|
||||
if (this.getOltpMetricsEndpoint()) {
|
||||
if (this.getOltpMetricsEndpoint() && hasHeaders) {
|
||||
metricReader = new PeriodicExportingMetricReader({
|
||||
exporter: new OTLPMetricExporter({
|
||||
url: this.getOltpMetricsEndpoint()!.toString(),
|
||||
|
|
@ -119,7 +121,7 @@ export default class Telemetry {
|
|||
|
||||
const loggerProvider: LoggerProvider = new LoggerProvider();
|
||||
|
||||
if (this.getOltpLogsEndpoint()) {
|
||||
if (this.getOltpLogsEndpoint() && hasHeaders) {
|
||||
const logExporter: OTLPLogExporter = new OTLPLogExporter({
|
||||
url: this.getOltpLogsEndpoint()!.toString(),
|
||||
headers: headers,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@ import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xm
|
|||
|
||||
export default class Telemetry {
|
||||
public static init(data: { serviceName: string }): void {
|
||||
if (OpenTelemetryExporterOtlpEndpoint) {
|
||||
const hasHeaders: boolean =
|
||||
Object.keys(OpenTelemetryExporterOtlpHeaders).length > 0;
|
||||
|
||||
if (OpenTelemetryExporterOtlpEndpoint && hasHeaders) {
|
||||
const providerConfig: TracerConfig = {
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: data.serviceName,
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@
|
|||
value: {{ printf "false" | squote }}
|
||||
- name: STATUS_PAGE_CNAME_RECORD
|
||||
value: {{ $.Values.statusPage.cnameRecord }}
|
||||
- name: OPENTELEMETRY_EXPORTER_OTLP_ENDPOINT
|
||||
value: {{ $.Values.openTelemetryExporter.endpoint.client }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "oneuptime.env.oneuptimeSecret" }}
|
||||
|
|
@ -84,8 +86,9 @@
|
|||
- name: IS_SERVER
|
||||
value: {{ printf "true" | squote }}
|
||||
|
||||
- name: OPENTELEMETRY_EXPORTER_OTLP_ENDPOINT
|
||||
value: {{ $.Values.openTelemetryExporter.endpoint.server }}
|
||||
|
||||
|
||||
- name: ENCRYPTION_SECRET
|
||||
{{- if $.Values.encryptionSecret }}
|
||||
value: {{ $.Values.encryptionSecret }}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# OneUptime accounts Deployment
|
||||
{{- $accountsEnv := dict "PORT" $.Values.port.accounts -}}
|
||||
{{- $accountsEnv := dict "OPENTELEMETRY_EXPORTER_OTLP_HEADERS" $.Values.openTelemetryExporter.headers.accounts "PORT" $.Values.port.accounts -}}
|
||||
{{- $accountsDeploymentArgs :=dict "IsUI" true "ServiceName" "accounts" "Port" $.Values.port.accounts "Release" $.Release "Values" $.Values "Env" $accountsEnv -}}
|
||||
{{- include "oneuptime.deployment" $accountsDeploymentArgs }}
|
||||
---
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# OneUptime adminDashboard Deployment
|
||||
{{- $adminDashboardEnv := dict "PORT" $.Values.port.adminDashboard -}}
|
||||
{{- $adminDashboardEnv := dict "OPENTELEMETRY_EXPORTER_OTLP_HEADERS" $.Values.openTelemetryExporter.headers.adminDashboard "PORT" $.Values.port.adminDashboard -}}
|
||||
{{- $adminDashboardDeploymentArgs :=dict "IsUI" true "ServiceName" "admin-dashboard" "Port" $.Values.port.adminDashboard "Release" $.Release "Values" $.Values "Env" $adminDashboardEnv -}}
|
||||
{{- include "oneuptime.deployment" $adminDashboardDeploymentArgs }}
|
||||
---
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# OneUptime app Deployment
|
||||
{{- $appEnv := dict "PORT" $.Values.port.app "SMS_HIGH_RISK_COST_IN_CENTS" $.Values.billing.smsHighRiskValueInCents "CALL_HIGH_RISK_COST_IN_CENTS_PER_MINUTE" $.Values.billing.callHighRiskValueInCentsPerMinute "SMS_DEFAULT_COST_IN_CENTS" $.Values.billing.smsDefaultValueInCents "CALL_DEFAULT_COST_IN_CENTS_PER_MINUTE" $.Values.billing.callDefaultValueInCentsPerMinute "INTERNAL_SMTP_FROM_NAME" $.Values.internalSmtp.name "INTERNAL_SMTP_EMAIL" $.Values.internalSmtp.email "INTERNAL_SMTP_PASSWORD" "internal_smtp_password" -}}
|
||||
{{- $appEnv := dict "OPENTELEMETRY_EXPORTER_OTLP_HEADERS" $.Values.openTelemetryExporter.headers.app "PORT" $.Values.port.app "SMS_HIGH_RISK_COST_IN_CENTS" $.Values.billing.smsHighRiskValueInCents "CALL_HIGH_RISK_COST_IN_CENTS_PER_MINUTE" $.Values.billing.callHighRiskValueInCentsPerMinute "SMS_DEFAULT_COST_IN_CENTS" $.Values.billing.smsDefaultValueInCents "CALL_DEFAULT_COST_IN_CENTS_PER_MINUTE" $.Values.billing.callDefaultValueInCentsPerMinute "INTERNAL_SMTP_FROM_NAME" $.Values.internalSmtp.name "INTERNAL_SMTP_EMAIL" $.Values.internalSmtp.email "INTERNAL_SMTP_PASSWORD" "internal_smtp_password" -}}
|
||||
{{- $appDeploymentArgs :=dict "IsServer" true "ServiceName" "app" "Port" $.Values.port.app "Release" $.Release "Values" $.Values "Env" $appEnv -}}
|
||||
{{- include "oneuptime.deployment" $appDeploymentArgs }}
|
||||
---
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# OneUptime dashboard Deployment
|
||||
{{- $dashboardEnv := dict "PORT" $.Values.port.dashboard -}}
|
||||
{{- $dashboardEnv := dict "OPENTELEMETRY_EXPORTER_OTLP_HEADERS" $.Values.openTelemetryExporter.headers.dashboard "PORT" $.Values.port.dashboard -}}
|
||||
{{- $dashboardDeploymentArgs :=dict "IsUI" true "ServiceName" "dashboard" "Port" $.Values.port.dashboard "Release" $.Release "Values" $.Values "Env" $dashboardEnv -}}
|
||||
{{- include "oneuptime.deployment" $dashboardDeploymentArgs }}
|
||||
---
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ spec:
|
|||
env:
|
||||
- name: PORT
|
||||
value: {{ $.Values.port.probe | squote }}
|
||||
- name: OPENTELEMETRY_EXPORTER_OTLP_HEADERS
|
||||
value: {{ $.Values.openTelemetryExporter.headers.probe }}
|
||||
- name: ONEUPTIME_URL
|
||||
value: http://{{ $.Release.Name }}-ingestor.{{ $.Release.Namespace }}.svc.{{ $.Values.global.clusterDomain }}:{{ $.Values.port.ingestor }}
|
||||
- name: PROBE_NAME
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# OneUptime statusPage Deployment
|
||||
{{- $statusPageEnv := dict "PORT" $.Values.port.statusPage -}}
|
||||
{{- $statusPageEnv := dict "OPENTELEMETRY_EXPORTER_OTLP_HEADERS" $.Values.openTelemetryExporter.headers.statusPage "PORT" $.Values.port.statusPage -}}
|
||||
{{- $statusPageDeploymentArgs :=dict "IsUI" true "ServiceName" "status-page" "Port" $.Values.port.statusPage "Release" $.Release "Values" $.Values "Env" $statusPageEnv -}}
|
||||
{{- include "oneuptime.deployment" $statusPageDeploymentArgs }}
|
||||
---
|
||||
|
|
|
|||
|
|
@ -138,15 +138,8 @@ probes:
|
|||
|
||||
port:
|
||||
app: 3002
|
||||
workflow: 3099
|
||||
alert: 3088
|
||||
ingestor: 3400
|
||||
testServer: 3800
|
||||
file: 3125
|
||||
identity: 3087
|
||||
notification: 3191
|
||||
realtime: 3300
|
||||
workers: 3452
|
||||
accounts: 3003
|
||||
statusPage: 3105
|
||||
dashboard: 3009
|
||||
|
|
@ -162,5 +155,15 @@ testServer:
|
|||
enabled: false
|
||||
|
||||
|
||||
openTelemetry:
|
||||
openTelemetryExporter:
|
||||
endpoint:
|
||||
server:
|
||||
client:
|
||||
headers:
|
||||
app:
|
||||
dashboard:
|
||||
accounts:
|
||||
statusPage:
|
||||
probe:
|
||||
adminDashboard:
|
||||
|
||||
Loading…
Add table
Reference in a new issue