Skip to content

Commit

Permalink
[opentelemetry-operator] incorporate suggested changes from PR (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
timojohlo authored Jun 24, 2024
1 parent 3fe87fc commit 3c63b10
Show file tree
Hide file tree
Showing 14 changed files with 12,162 additions and 0 deletions.
26 changes: 26 additions & 0 deletions opentelemetry-collector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: OpenTelemetry Collector
---

This Plugin is intended for ingesting, generating, collecting, and exporting telemetry data (metrics, logs, and traces).

Components included in this Plugin:

- [Collector](https://github.com/open-telemetry/opentelemetry-collector)
- [Filelog Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/filelogreceiver)
- [OpenSearch Exporter](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/opensearchexporter)
- ServiceMonitor to scrape logs statically into prometheus infra-frontend

# Owner

1. Timo Johner (@timojohlo)
2. Olaf Heydorn (@kuckkuck)
3. Tommy Sauer (@viennaa)

### Parameters

TBD

### Examples

TBD
6 changes: 6 additions & 0 deletions opentelemetry-collector/chart/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: opentelemetry-operator
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
version: 0.56.0
digest: sha256:4278224e98428dd4b27bc1217e2e4d558f8ce98249a8d2cca1ff4be3b940e9f4
generated: "2024-06-20T12:53:56.089589+02:00"
20 changes: 20 additions & 0 deletions opentelemetry-collector/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors
# SPDX-License-Identifier: Apache-2.0

apiVersion: v2
name: opentelemetry-operator
version: 0.0.4
description: OpenTelemetry Operator Helm chart for Kubernetes
icon: https://raw.githubusercontent.com/cncf/artwork/a718fa97fffec1b9fd14147682e9e3ac0c8817cb/projects/opentelemetry/icon/color/opentelemetry-icon-color.png
type: application
maintainers:
- name: timojohlo
- name: kuckkuck
- name: viennaa
sources:
- https://github.com/cloudoperators/greenhouse-extensions
appVersion: 0.98.0
dependencies:
- name: opentelemetry-operator
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
version: 0.56.0
Binary file not shown.
2,856 changes: 2,856 additions & 0 deletions opentelemetry-collector/chart/crds/crd-opentelemetry.io_opampbridges.yaml

Large diffs are not rendered by default.

7,460 changes: 7,460 additions & 0 deletions opentelemetry-collector/chart/crds/crd-opentelemetrycollector.yaml

Large diffs are not rendered by default.

1,588 changes: 1,588 additions & 0 deletions opentelemetry-collector/chart/crds/crd-opentelemetryinstrumentation.yaml

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions opentelemetry-collector/chart/templates/crds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{/*
SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if .Values.installCRDs }}
{{- range $path, $bytes := .Files.Glob "crds/*.yaml" }}
{{ $.Files.Get $path }}
---
{{- end }}
{{- end }}
94 changes: 94 additions & 0 deletions opentelemetry-collector/chart/templates/logs-collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{{/*
SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors
SPDX-License-Identifier: Apache-2.0
*/}}

apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
name: logs
spec:
volumeMounts:
- mountPath: /var/log
name: varlog
readOnly: true
volumes:
- name: varlog
hostPath:
path: /var/log
envFrom:
- secretRef:
name: otel-basic-auth
config: |
receivers:
filelog:
include: [ /var/log/containers/*.log ]
exclude: [ /var/log/containers/logs-collector-*.log ]
include_file_path: true
include_file_name: false
start_at: end
retry_on_failure:
enabled: true
operators:
- type: router
id: get-format
routes:
- output: parser-containerd
expr: 'body matches "^[^ Z]+Z"'
default: parse-time
# Parse CRI-Containerd format
- type: regex_parser
id: parser-containerd
regex: '^(?P<time>[^ Z]+Z) (?P<stream>stdout|stderr) (?P<logtag>[^ ]*) ?(?P<logs>.*)$'
timestamp:
parse_from: attributes.time
layout: '%Y-%m-%dT%H:%M:%S.%LZ'
- type: regex_parser
id: parse-time
regex: '^(?P<time>[^ Z]+)'
timestamp:
parse_from: attributes.time
layout_type: gotime
layout: '2006-01-02T15:04:05.999999999'
- type: move
from: attributes.logs
to: body
# Extract metadata from file path
- type: regex_parser
id: extract_metadata_from_filepath
regex: '^.*\/(?P<pod_name>[^_]+)_(?P<namespace>[^_]+)_(?P<container>[a-z].*)\-(?P<uid>[a-f0-9\-]{64})'
parse_from: attributes["log.file.path"]
cache:
size: 128
exporters:
debug:
verbosity: detailed
opensearch/logs:
http:
auth:
authenticator: basicauth
endpoint: {{ .Values.open_telemetry.opensearch_logs.endpoint }}
logs_index: otel-filelog-datastream
extensions:
basicauth:
client_auth:
password: ${env:password}
username: ${env:username}
service:
extensions:
- basicauth
telemetry:
metrics:
address: 0.0.0.0:8888
level: detailed
pipelines:
logs:
receivers:
- filelog
exporters:
- opensearch/logs
40 changes: 40 additions & 0 deletions opentelemetry-collector/chart/templates/metrics-collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{/*
SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors
SPDX-License-Identifier: Apache-2.0
*/}}

apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
name: metrics
spec:
config: |
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
exporters:
debug:
verbosity: detailed
prometheus:
endpoint: "0.0.0.0:9000"
send_timestamps: true
service:
pipelines:
#traces:
#receivers: [otlp]
#exporters: [debug]
metrics:
receivers: [otlp]
exporters: [prometheus]
logs:
receivers: [otlp]
exporters: [debug]
telemetry:
metrics:
level: detailed
address: 0.0.0.0:8888
12 changes: 12 additions & 0 deletions opentelemetry-collector/chart/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{/*
SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors
SPDX-License-Identifier: Apache-2.0
*/}}

apiVersion: v1
kind: Secret
metadata:
name: otel-basic-auth
data:
password: {{ .Values.open_telemetry.opensearch_logs.password | b64enc | quote }}
username: {{ .Values.open_telemetry.opensearch_logs.username | b64enc | quote }}
26 changes: 26 additions & 0 deletions opentelemetry-collector/chart/templates/smon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{/*
SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors
SPDX-License-Identifier: Apache-2.0
*/}}

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
annotations:
name: opentelemetry-collector-metrics
spec:
endpoints:
- port: prometheus
relabelings:
- regex: pod
action: labeldrop
- port: monitoring
relabelings:
- regex: pod
action: labeldrop
selector:
matchLabels:
app.kubernetes.io/component: opentelemetry-collector
app.kubernetes.io/instance: otel.metrics
app.kubernetes.io/managed-by: opentelemetry-operator
app.kubernetes.io/part-of: opentelemetry
23 changes: 23 additions & 0 deletions opentelemetry-collector/chart/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors
# SPDX-License-Identifier: Apache-2.0

installCRDs: true

opentelemetry-operator:
admissionWebhooks:
failurePolicy: 'Ignore'
manager:
deploymentAnnotations:
vpa-butler.cloud.sap/update-mode: Auto
prometheusRule:
enabled: true
defaultRules:
enabled: true
serviceMonitor:
enabled: true
kubeRBACProxy:
enabled: false
testFramework:
image:
repository: busybox
tag: latest
Binary file added opentelemetry-collector/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3c63b10

Please sign in to comment.