Skip to content
Open
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
7 changes: 2 additions & 5 deletions config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@
"__name": "OPENTELEMETRY_LOGGING_ENABLED",
"__format": "boolean"
},
"url": "OPENTELEMETRY_LOGGING_URL",
"resourceAttributes": {
"__name": "OPENTELEMETRY_RESOURCE_ATTRIBUTES",
"__format": "json"
}
"url": "OTLP_LOGGER_ENDPOINT_URL",
"resourceAttributes": "OTEL_RESOURCE_ATTRIBUTES"
}
},
"tracing": {
Expand Down
34 changes: 34 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,37 @@ Returns the cloud provider docker registry url from global if exists or from the
{{- else -}}
{{- end -}}
{{- end -}}

{{/*
Returns the tracing url from global if set, otherwise from the chart's values
*/}}
{{- define "exporter-trigger.tracingUrl" -}}
{{- if .Values.global.telemetry.tracing.url }}
{{- .Values.global.telemetry.tracing.url -}}
{{- else if .Values.telemetry.tracing.url -}}
{{- .Values.telemetry.tracing.url -}}
{{- end -}}
{{- end -}}

{{/*
Returns the opentelemetry logging url from global if set, otherwise from the chart's values
*/}}
{{- define "exporter-trigger.opentelemetryLoggingUrl" -}}
{{- if .Values.global.telemetry.logger.opentelemetryOptions.url }}
{{- .Values.global.telemetry.logger.opentelemetryOptions.url -}}
{{- else if .Values.telemetry.logger.opentelemetryOptions.url -}}
{{- .Values.telemetry.logger.opentelemetryOptions.url -}}
{{- end -}}
{{- end -}}

{{/*
Renders a map of resource attributes as key=value,key=value for OTEL_RESOURCE_ATTRIBUTES.
Usage: {{ include "exporter-trigger.otelResourceAttributes" .resourceAttributes }}
*/}}
{{- define "exporter-trigger.otelResourceAttributes" -}}
{{- $attributes := list }}
{{- range $key, $value := . }}
{{- $attributes = append $attributes (printf "%s=%s" $key (toString $value)) }}
{{- end }}
{{- join "," $attributes }}
{{- end -}}
7 changes: 0 additions & 7 deletions helm/templates/_tplValues.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,3 @@ Custom definitions
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.jobDefinitions .Values.global.jobDefinitions ) "context" . ) }}
{{- end -}}

{{- define "common.tracing.merged" -}}
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.tracing .Values.global.tracing ) "context" . ) }}
{{- end -}}

{{- define "common.openTelemetryOptions.merged" -}}
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.env.openTelemetryOptions .Values.global.openTelemetryOptions ) "context" . ) }}
{{- end -}}
36 changes: 22 additions & 14 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{{- $chartName := include "exporter-trigger.name" . -}}
{{- $tracing := (include "common.tracing.merged" .) | fromYaml }}
{{- $openTelemetryOptions := (include "common.openTelemetryOptions.merged" .) | fromYaml }}
{{- $server := .Values.server -}}
{{- $telemetry := .Values.telemetry -}}
{{- $tracingUrl := include "exporter-trigger.tracingUrl" . -}}
{{- $opentelemetryLoggingUrl := include "exporter-trigger.opentelemetryLoggingUrl" . -}}
{{- $serviceUrls := (include "common.serviceUrls.merged" .) | fromYaml }}
{{- $storage := (include "common.storage.merged" .) | fromYaml }}
{{- $configmapName := include "configmap.fullname" . }}
Expand All @@ -13,21 +15,27 @@ kind: ConfigMap
metadata:
name: {{ $configmapName }}
data:
REQUEST_PAYLOAD_LIMIT: {{ .Values.env.requestPayloadLimit | quote }}
RESPONSE_COMPRESSION_ENABLED: {{ .Values.env.responseCompressionEnabled | quote }}
LOG_LEVEL: {{ .Values.env.logLevel | quote }}
LOG_PRETTY_PRINT_ENABLED: {{ .Values.env.logPrettyPrintEnabled | quote }}
{{- with $openTelemetryOptions }}
{{- with $server }}
REQUEST_PAYLOAD_LIMIT: {{ .requestPayloadLimit | quote }}
RESPONSE_COMPRESSION_ENABLED: {{ .responseCompressionEnabled | quote }}
{{- end }}
{{- with $telemetry }}
LOG_LEVEL: {{ .logger.level | quote }}
LOG_PRETTY_PRINT_ENABLED: {{ .logger.prettyPrint | quote }}
{{- with .logger.opentelemetryOptions }}
OPENTELEMETRY_LOGGING_ENABLED: {{ .enabled | quote }}
{{ if .enabled }}
OPENTELEMETRY_LOGGING_URL: {{ .url | quote }}
OPENTELEMETRY_RESOURCE_ATTRIBUTES: {{ .resourceAttributes | toJson | quote }}
{{- if .enabled }}
OTLP_LOGGER_ENDPOINT_URL: {{ $opentelemetryLoggingUrl | quote }}
{{- if .resourceAttributes }}
OTEL_RESOURCE_ATTRIBUTES: {{ include "exporter-trigger.otelResourceAttributes" .resourceAttributes | quote }}
{{- end }}
{{- end }}
{{- end }}
TELEMETRY_TRACING_ENABLED: {{ .tracing.enabled | quote }}
{{- if .tracing.enabled }}
TELEMETRY_TRACING_URL: {{ $tracingUrl | quote }}
{{- end }}
{{- end }}
TELEMETRY_TRACING_ENABLED: {{ $tracing.enabled | quote }}
{{ if $tracing.enabled }}
TELEMETRY_TRACING_URL: {{ $tracing.url | quote }}
{{ end }}
JOB_MANAGER_URL: {{ $serviceUrls.jobManager | quote }}
JOB_TRACKER_URL: {{ $serviceUrls.jobTracker | quote }}
CLEANUP_EXPIRATION_DAYS: {{ .Values.env.cleanupExpirationDays | quote }}
Expand Down
7 changes: 4 additions & 3 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{{- $cloudProviderDockerRegistryUrl := include "exporter-trigger.cloudProviderDockerRegistryUrl" . -}}
{{- $cloudProviderImagePullSecretName := include "exporter-trigger.cloudProviderImagePullSecretName" . -}}
{{- $imageTag := include "exporter-trigger.tag" . -}}
{{- $server := .Values.server -}}
{{- if .Values.enabled -}}

{{- $fs := (include "common.fs.merged" .) | fromYaml }}
Expand Down Expand Up @@ -60,16 +61,16 @@ spec:
fieldRef:
fieldPath: metadata.uid
- name: SERVER_PORT
value: {{ .Values.env.targetPort | quote }}
value: {{ $server.targetPort | quote }}
- name: GPKGS_LOCATION
value: {{ $gpkgLocation }}
envFrom:
- configMapRef:
name: {{ $configmapName }}
ports:
- name: http
containerPort: {{ .Values.env.targetPort }}
protocol: TCP
containerPort: {{ $server.targetPort }}
protocol: {{ $server.protocol }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
livenessProbe:
initialDelaySeconds: {{ .Values.initialDelaySeconds }}
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ spec:
service:
name: {{ $serviceName }}
port:
number: {{ .Values.env.port }}
number: {{ .Values.server.port }}
host: {{ $ingressHost }}
{{- end -}}
7 changes: 4 additions & 3 deletions helm/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{{- $chartName := include "exporter-trigger.name" . -}}
{{- $cloudProviderFlavor := include "exporter-trigger.cloudProviderFlavor" . -}}
{{- $serviceName := include "service.fullname" . -}}
{{- $server := .Values.server -}}
{{- if .Values.enabled -}}
apiVersion: v1
kind: Service
Expand All @@ -18,9 +19,9 @@ spec:
type: NodePort
{{- end }}
ports:
- port: {{ .Values.env.internalPort }}
targetPort: {{ .Values.env.targetPort }}
protocol: TCP
- port: {{ $server.port }}
targetPort: {{ $server.targetPort }}
protocol: {{ $server.protocol }}
name: internal
{{- if eq $cloudProviderFlavor "minikube" }}
nodePort: {{ .Values.nodePort }}
Expand Down
45 changes: 27 additions & 18 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
global:
cloudProvider: {}
tracing: {}
openTelemetryOptions: {}
telemetry:
tracing: {}
logger:
opentelemetryOptions: {}
environment: ""
serviceUrls: {}
storage: {}
Expand All @@ -21,7 +23,7 @@ mclabels:
port: 8080

configManagement:
offlineMode: false
offlineMode: true
name: 'exporter-trigger'
version: 'latest'
serverUrl: 'http://localhost:8080/api'
Expand Down Expand Up @@ -53,7 +55,7 @@ replicaCount: 1
initialDelaySeconds: 60
nodePort: 30030 # for minikube deployment only
resetOnConfigChange: true
imagePullPolicy: Always
imagePullPolicy: IfNotPresent

cloudProvider:
dockerRegistryUrl: my-registry-url.io
Expand All @@ -71,22 +73,29 @@ image:
# annotation2: annotation-value-2
podAnnotations: {}

tracing:
enabled: false
url: ""

env:
port: 8080
server:
port: 80
targetPort: 8080
internalPort: 80
logLevel: info
logPrettyPrintEnabled: false
openTelemetryOptions:
enabled: false
url: ''
resourceAttributes: {}
protocol: TCP
responseCompressionEnabled: true
requestPayloadLimit: 1mb

telemetry:
logger:
level: info
prettyPrint: false
opentelemetryOptions:
enabled: true
url: http://localhost:4317
# Rendered as OTEL_RESOURCE_ATTRIBUTES in "key=value,key=value" format
# resourceAttributes:
# service.namespace: namespace
# deployment.environment: dev
tracing:
enabled: true
url: http://localhost:55681/v1/traces

env:
disableHttpClientLogs: false
cleanupExpirationDays: 30
httpRetry:
Expand All @@ -111,7 +120,7 @@ resources:
memory: 128Mi

route:
enabled: true
enabled: false
host:
path: /api/raster/v1
https: true
Expand Down
2 changes: 1 addition & 1 deletion src/containerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const registerExternalValues = async (options?: RegisterOptions): Promise

const loggerConfig = configInstance.get('telemetry.logger');

const logger = await jsLogger({ ...loggerConfig, prettyPrint: loggerConfig.prettyPrint, mixin: getOtelMixin() });
const logger = await jsLogger({ ...loggerConfig, mixin: getOtelMixin() });

const tracer = trace.getTracer(SERVICE_NAME);
const metricsRegistry = new Registry();
Expand Down
Loading