Skip to content

853 opentelemetry metrics for server mode #944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from
Draft
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
6 changes: 3 additions & 3 deletions charts/eodag-server/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.19.3
digest: sha256:de997835d9ce9a9deefc2d70d8c62b11aa1d1a76ece9e86a83736ab9f930bf4d
generated: "2024-06-03T18:43:30.71045378+02:00"
version: 2.4.0
digest: sha256:b371e6f7f1449fa3abdcb97a04b0bbb2b5d36a4facb8e79041ac36a455b02bb0
generated: "2023-06-19T12:39:44.271254606+02:00"
2 changes: 1 addition & 1 deletion charts/eodag-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies:
repository: oci://registry-1.docker.io/bitnamicharts
tags:
- bitnami-common
version: 2.x.x
version: 2.x
description: EODAG (Earth Observation Data Access Gateway) is a tool for searching,
aggregating results and downloading remote sensed images offering a unified API
for data access regardless of the data provider.
Expand Down
7 changes: 2 additions & 5 deletions charts/eodag-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ The command removes all the Kubernetes components associated with the chart and
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` |
| `global.storageClass` | Global StorageClass for Persistent Volume(s) | `""` |


### Common parameters

| Name | Description | Value |
Expand All @@ -59,6 +60,7 @@ The command removes all the Kubernetes components associated with the chart and
| `clusterDomain` | Kubernetes cluster domain name | `cluster.local` |
| `extraDeploy` | Array of extra objects to deploy with the release | `[]` |


### EODAG Server parameters

| Name | Description | Value |
Expand Down Expand Up @@ -177,11 +179,6 @@ The command removes all the Kubernetes components associated with the chart and
| `serviceAccount.name` | The name of the ServiceAccount to use. | `""` |
| `serviceAccount.annotations` | Additional custom annotations for the ServiceAccount | `{}` |
| `serviceAccount.automountServiceAccountToken` | Automount service account token for the server service account | `true` |
| `autoscaling.enabled` | Enable autoscaling | `false` |
| `autoscaling.minReplicas` | Minimum number of replicas | `1` |
| `autoscaling.maxReplicas` | Maximum number of replicas | `10` |
| `autoscaling.targetCPU` | Target CPU utilization percentage | `""` |
| `autoscaling.targetMemory` | Target Memory utilization percentage | `""` |


```console
Expand Down
26 changes: 25 additions & 1 deletion charts/eodag-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Create EODAG Server app version
{{- end -}}

{{/*
Return the proper image name
Return the proper EODAG server image name
*/}}
{{- define "eodag-server.image" -}}
{{- $registryName := .Values.image.registry -}}
Expand All @@ -75,3 +75,27 @@ Return the proper image name
{{- printf "%s%s%s" $repositoryName $separator $termination -}}
{{- end -}}
{{- end -}}

{{/*
Return the proper OpenTelemetry Collector image name
*/}}
{{- define "otel-collector.image" -}}
{{- $registryName := .Values.otel.collector.image.registry -}}
{{- $repositoryName := .Values.otel.collector.image.repository -}}
{{- $separator := ":" -}}
{{- $termination := .Values.otel.collector.image.tag | toString -}}
{{- if .Values.global }}
{{- if .Values.global.imageRegistry }}
{{- $registryName = .Values.global.imageRegistry -}}
{{- end -}}
{{- end -}}
{{- if .Values.otel.collector.image.digest }}
{{- $separator = "@" -}}
{{- $termination = .Values.otel.collector.image.digest | toString -}}
{{- end -}}
{{- if $registryName }}
{{- printf "%s/%s%s%s" $registryName $repositoryName $separator $termination -}}
{{- else -}}
{{- printf "%s%s%s" $repositoryName $separator $termination -}}
{{- end -}}
{{- end -}}
6 changes: 5 additions & 1 deletion charts/eodag-server/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if or .Values.productTypes .Values.providers }}
{{- if or .Values.productTypes .Values.providers .Values.otelCollectorConfig }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -20,4 +20,8 @@ data:
providers.yml: |-
{{- .Values.providers | nindent 4 }}
{{- end }}
{{- if .Values.otelCollectorConfig }}
otelcol_config.yml: |-
{{- .Values.otelCollectorConfig | nindent 4 }}
{{- end }}
{{- end }}
37 changes: 36 additions & 1 deletion charts/eodag-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,22 @@ spec:
- name: EODAG_LOGGING
value: {{ .Values.logLevel | quote }}
{{- end }}
- name: EODAG_CORS_ALLOWED_ORIGINS
value: "*"
{{- if .Values.otel.enabled }}
{{- if .Values.otel.endpoint }}
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: {{ .Values.otel.endpoint | quote }}
{{- end }}
{{- if .Values.otel.timeout }}
- name: OTEL_EXPORTER_OTLP_TIMEOUT
value: {{ .Values.otel.timeout | quote }}
{{- end }}
{{- if .Values.otel.interval }}
- name: OTEL_METRIC_EXPORT_INTERVAL
value: {{ .Values.otel.interval | quote }}
{{- end }}
{{- end }}
{{- if or .Values.extraEnvVarsCM .Values.extraEnvVarsSecret }}
envFrom:
{{- if .Values.extraEnvVarsCM }}
Expand Down Expand Up @@ -179,11 +195,30 @@ spec:
{{- if .Values.extraVolumeMounts }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.otel.collector.enabled }}
- name: opentelemetry-collector
image: {{ include "otel-collector.image" . }}
imagePullPolicy: {{ .Values.otel.collector.image.pullPolicy }}
ports:
- name: otlp-receiver
containerPort: {{ .Values.otel.collector.image.ports.otlpReceiver }}
protocol: TCP
- name: prom-exporter
containerPort: {{ .Values.otel.collector.image.ports.prometheusExporter }}
protocol: TCP
volumeMounts:
- name: config
mountPath: /etc/otelcol-contrib/config.yaml
subPath: otelcol_config.yml
{{- if .Values.otel.collector.resources }}
resources: {{- toYaml .Values.otel.collector.resources | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.sidecars }}
{{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
{{- if or .Values.productTypes .Values.providers }}
{{- if or .Values.productTypes .Values.providers .Values.otel.collector.enabled }}
- name: config
configMap:
name: {{ printf "%s-config" (include "common.names.fullname" .) }}
Expand Down
48 changes: 0 additions & 48 deletions charts/eodag-server/templates/hpa.yaml

This file was deleted.

11 changes: 11 additions & 0 deletions charts/eodag-server/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ spec:
{{- else if eq .Values.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if and .Values.otel.enabled .Values.otel.collector.enabled }}
- port: 9090
targetPort: prom-exporter
protocol: TCP
name: metrics
{{- if (and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePort))) }}
nodePort: {{ .Values.service.nodePorts.metrics }}
{{- else if eq .Values.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- end }}
{{- if .Values.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
Expand Down
37 changes: 37 additions & 0 deletions charts/eodag-server/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{{- if and .Values.otel.enabled .Values.otel.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: metrics
path: /metrics
{{- if .Values.otel.serviceMonitor.interval }}
interval: {{ .Values.otel.serviceMonitor.interval }}
{{- end }}
{{- if .Values.otel.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.otel.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.otel.serviceMonitor.relabelings }}
relabelings:
{{- include "common.tplvalues.render" (dict "value" .Values.otel.serviceMonitor.relabelings "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.otel.serviceMonitor.relabelings }}
metricRelabelings:
{{- include "common.tplvalues.render" (dict "value" .Values.otel.serviceMonitor.metricRelabelings "context" $) | nindent 8 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ include "common.names.namespace" . }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
{{- end }}
Loading
Loading