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 @@ -14,11 +14,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: 23 additions & 11 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,35 @@ Returns the cloud provider image pull secret name from global if exists or from
{{- end -}}

{{/*
Returns the tracing url from global if exists or from the chart's values
Returns the tracing url from global if set, otherwise from the chart's values
*/}}
{{- define "cache-seeder.tracingUrl" -}}
{{- if .Values.global.tracing.url }}
{{- .Values.global.tracing.url -}}
{{- else if .Values.cloudProvider -}}
{{- .Values.env.tracing.url -}}
{{- 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 tracing url from global if exists or from the chart's values
Returns the opentelemetry logging url from global if set, otherwise from the chart's values
*/}}
{{- define "cache-seeder.metricsUrl" -}}
{{- if .Values.global.metrics.url }}
{{- .Values.global.metrics.url -}}
{{- else -}}
{{- .Values.env.metrics.url -}}
{{- define "cache-seeder.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 "cache-seeder.otelResourceAttributes" .resourceAttributes }}
*/}}
{{- define "cache-seeder.otelResourceAttributes" -}}
{{- $attributes := list }}
{{- range $key, $value := . }}
{{- $attributes = append $attributes (printf "%s=%s" $key (toString $value)) }}
{{- end }}
{{- join "," $attributes }}
{{- end -}}
12 changes: 0 additions & 12 deletions helm/templates/_tplValues.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,6 @@ Custom definitions
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.redis .Values.global.redis ) "context" . ) }}
{{- end -}}

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

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

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

{{- define "common.serviceUrls.merged" -}}
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.serviceUrls .Values.global.serviceUrls ) "context" . ) }}
{{- end -}}
Expand Down
40 changes: 23 additions & 17 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{{- $tracing := (include "common.tracing.merged" .) | fromYaml }}
{{- $openTelemetryOptions := (include "common.openTelemetryOptions.merged" .) | fromYaml }}
{{- $server := .Values.server -}}
{{- $telemetry := .Values.telemetry -}}
{{- $tracingUrl := include "cache-seeder.tracingUrl" . -}}
{{- $opentelemetryLoggingUrl := include "cache-seeder.opentelemetryLoggingUrl" . -}}
{{- $configmapName := include "configmap.fullname" . }}
{{- $redis := (include "common.redis.merged" .) | fromYaml }}
{{- $serviceUrls := (include "common.serviceUrls.merged" .) | fromYaml }}
Expand All @@ -11,22 +13,26 @@ 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 }}
TELEMETRY_TRACING_ENABLED: {{ $tracing.enabled | quote }}
{{ if $tracing.enabled }}
TELEMETRY_TRACING_URL: {{ $tracing.url }}
{{ end }}
{{- 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 }}
{{ if .resourceAttributes }}
OPENTELEMETRY_RESOURCE_ATTRIBUTES: {{ .resourceAttributes | toJson | quote }}
{{ end }}
{{ end }}
{{- if .enabled }}
OTLP_LOGGER_ENDPOINT_URL: {{ $opentelemetryLoggingUrl | quote }}
{{- if .resourceAttributes }}
OTEL_RESOURCE_ATTRIBUTES: {{ include "cache-seeder.otelResourceAttributes" .resourceAttributes | quote }}
{{- end }}
{{- end }}
{{- end }}
TELEMETRY_TRACING_ENABLED: {{ .tracing.enabled | quote }}
{{- if .tracing.enabled }}
TELEMETRY_TRACING_URL: {{ $tracingUrl | quote }}
{{- end }}
{{- end }}
npm_config_cache: /tmp/
QUEUE_JOB_MANAGER_BASE_URL: {{ $serviceUrls.jobManager | quote}}
Expand Down
10 changes: 5 additions & 5 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ spec:
fieldRef:
fieldPath: metadata.uid
- name: SERVER_PORT
value: {{ .Values.env.targetPort | quote }}
value: {{ .Values.server.targetPort | quote }}
{{- if .Values.global.ca.caSecretName }}
- name: REQUESTS_CA_BUNDLE
value: {{ printf "%s/%s" .Values.global.ca.caPath .Values.global.ca.caKey | quote }}
Expand All @@ -109,16 +109,16 @@ spec:
name: {{ $releaseName }}-{{ $chartName }}-configmap
ports:
- name: http
containerPort: {{ .Values.env.targetPort }}
protocol: {{ .Values.env.protocol }}
containerPort: {{ .Values.server.targetPort }}
protocol: {{ .Values.server.protocol }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
httpGet:
path: {{ .Values.livenessProbe.path }}
port: {{ .Values.env.targetPort }}
port: {{ .Values.server.targetPort }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
Expand All @@ -127,7 +127,7 @@ spec:
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
httpGet:
path: {{ .Values.readinessProbe.path }}
port: {{ .Values.env.targetPort }}
port: {{ .Values.server.targetPort }}
{{- end }}
{{- if .Values.resources.enabled }}
resources:
Expand Down
6 changes: 3 additions & 3 deletions helm/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ spec:
type: NodePort
{{- end }}
ports:
- port: {{ .Values.env.port }}
targetPort: {{ .Values.env.targetPort }}
protocol: {{ .Values.env.protocol }}
- port: {{ .Values.server.port }}
targetPort: {{ .Values.server.targetPort }}
protocol: {{ .Values.server.protocol }}
name: http
{{- if eq $cloudProviderFlavor "minikube" }}
nodePort: {{ .Values.nodePort }}
Expand Down
43 changes: 23 additions & 20 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
global:
cloudProvider: {}
tracing: {}
metrics: {}
openTelemetryOptions: {}
telemetry:
tracing: {}
logger:
opentelemetryOptions: {}
environment: ''
jobDefinitions: {}
storage:
Expand Down Expand Up @@ -106,14 +107,6 @@ serviceUrls:
heartbeatManager: ""
jobTracker: ""

tracing:
enabled: false
url: ''

metrics:
enabled: false
url: ''

configManagement:
offlineMode: true
name: 'cache-seeder'
Expand All @@ -123,7 +116,7 @@ configManagement:
image:
repository: cache-seeder
tag: 'latest'
pullPolicy: Always
pullPolicy: IfNotPresent

jobDefinitions:
jobs:
Expand All @@ -133,19 +126,29 @@ jobDefinitions:
seed:
type: ''

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

telemetry:
logger:
level: info
prettyPrint: false
opentelemetryOptions:
enabled: true
url: http://localhost:4317
# resourceAttributes:
# service.namespace: namespace
# deployment.environment: dev
tracing:
enabled: true
# url can be overridden from global.telemetry.tracing.url
url: http://localhost:55681/v1/traces

env:
httpRetry:
attempts: 5
delay: exponential
Expand All @@ -161,7 +164,7 @@ env:
seedYamlDir: /mapproxy/seed.yaml
geometryTxtFile: /mapproxy/coverage.json
seedAttempts: 5
seedConcurrency: 5
seedConcurrency: 25
mapproxyCmdCommand: "mapproxy-seed"
refreshBeforeYearsOffset: 1
invalidBboxInitialBufferMeters: 200
Expand Down
2 changes: 1 addition & 1 deletion src/containerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const registerExternalValues = async (options?: RegisterOptions): Promise
const config = configInstance as unknown as IConfig;

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

const queueConfig = config.get<IQueueConfig>('queue');
const tracer = trace.getTracer(SERVICE_NAME);
Expand Down
Loading