Skip to content

Commit

Permalink
Add MySQL metrics and logs presets (#14)
Browse files Browse the repository at this point in the history
* Add MySQL POC

Signed-off-by: Matej Gera <matejgera@gmail.com>

* Enhance preset to allow specifying multiple MySQL instances

Signed-off-by: Matej Gera <matejgera@gmail.com>

* Extend values to include MySQL logs preset config

Signed-off-by: Matej Gera <matejgera@gmail.com>

* Ensure cluste role is generate if metrics enabled

Signed-off-by: Matej Gera <matejgera@gmail.com>

* Generate examples

Signed-off-by: Matej Gera <matejgera@gmail.com>

* Bump Chart version

Signed-off-by: Matej Gera <matejgera@gmail.com>

* Regenerate examples

Signed-off-by: Matej Gera <matejgera@gmail.com>

* More docs

Signed-off-by: Matej Gera <matejgera@gmail.com>

---------

Signed-off-by: Matej Gera <matejgera@gmail.com>
  • Loading branch information
matej-g authored Jul 10, 2023
1 parent a618186 commit 8eff58c
Show file tree
Hide file tree
Showing 54 changed files with 401 additions and 53 deletions.
2 changes: 1 addition & 1 deletion charts/opentelemetry-collector/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: opentelemetry-collector
version: 0.62.2
version: 0.63.0
description: OpenTelemetry Collector Helm chart for Kubernetes
type: application
home: https://opentelemetry.io/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: DaemonSet
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -21,7 +21,7 @@ spec:
template:
metadata:
annotations:
checksum/config: e79cc5469cf0e28f464b1c7dc68de988c7466670d63a10eb8199783b4c59f4e5
checksum/config: 13b1c0a193b017fccd42b05742048c8d43d07f5b4df2c70b9078bc3daef46b4b

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: Deployment
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -23,7 +23,7 @@ spec:
template:
metadata:
annotations:
checksum/config: f16d539cbd5eaa3a4d8dd2d7fa1893b63a3ab6380c4ce076928bafd36c37f035
checksum/config: a1e9d8f628b1ccdcbbfa0aa08e2b3c44fc2cce6c2a4f1fdc546d25a99f22efa2

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: Service
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: DaemonSet
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -21,7 +21,7 @@ spec:
template:
metadata:
annotations:
checksum/config: dbf6430222760363e101e03b10593d038ea4566c4a7c83913d6deffa90e11698
checksum/config: 47a843b7fd1e7f8de1cb7e6aad6bfb5aa5f9123511c928241aa1a46d6a3b2ce0

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: DaemonSet
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -21,7 +21,7 @@ spec:
template:
metadata:
annotations:
checksum/config: 5942647a9be4d6a1dcbb1ca17f1ec2284b67c41156ea71d4680aa7a3e3aa9271
checksum/config: 8257525211973c77e15c376416b8c693e536210f65bd4170993d042795e96004

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: DaemonSet
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -21,7 +21,7 @@ spec:
template:
metadata:
annotations:
checksum/config: 5942647a9be4d6a1dcbb1ca17f1ec2284b67c41156ea71d4680aa7a3e3aa9271
checksum/config: 8257525211973c77e15c376416b8c693e536210f65bd4170993d042795e96004

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
# Source: opentelemetry-collector/templates/clusterrole.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
app.kubernetes.io/managed-by: Helm
rules:
- apiGroups: [""]
resources: ["pods", "namespaces"]
verbs: ["get", "watch", "list"]
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get", "list", "watch"]
- apiGroups: ["extensions"]
resources: ["replicasets"]
verbs: ["get", "list", "watch"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# Source: opentelemetry-collector/templates/clusterrolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
app.kubernetes.io/managed-by: Helm
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: example-opentelemetry-collector
subjects:
- kind: ServiceAccount
name: example-opentelemetry-collector
namespace: default
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -16,6 +16,10 @@ data:
logging: {}
extensions:
health_check: {}
k8s_observer:
auth_type: serviceAccount
node: ${env:K8S_NODE_NAME}
observe_pods: true
memory_ballast:
size_in_percentage: 40
processors:
Expand Down Expand Up @@ -136,12 +140,28 @@ data:
static_configs:
- targets:
- ${env:MY_POD_IP}:8888
receiver_creator/mysql:
receivers:
mysql:
config:
collection_interval: 10s
password: ${env:MYSQL_PASSWORD}
statement_events:
digest_text_limit: 120
limit: 250
time_limit: 24h
username: root
rule: type == "port" && port == 3306 && pod.labels["env"] == "test" && pod.labels["team"]
== "teamA"
watch_observers:
- k8s_observer
zipkin:
endpoint: ${env:MY_POD_IP}:9411
service:
extensions:
- health_check
- memory_ballast
- k8s_observer
pipelines:
logs:
exporters:
Expand All @@ -161,6 +181,7 @@ data:
receivers:
- otlp
- prometheus
- receiver_creator/mysql
traces:
exporters:
- logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: DaemonSet
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -21,7 +21,7 @@ spec:
template:
metadata:
annotations:
checksum/config: 5074141502e17f6316105f2e2715cb24f748fd4c7fd907b6e614cd3885b7b271
checksum/config: ceb81173d48f7280ec8e8f737108fcc4145d08c4bed1764f615035ad964b35ee

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,14 @@ presets:
combine_field: body
source_identifier: attributes["log.file.path"]
is_first_entry: body matches "^([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}|[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})"
mysql:
metrics:
enabled: true
instances:
- username: "root"
password: ${env:MYSQL_PASSWORD}
port: 3306
labelSelectors:
env: "test"
team: "teamA"

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: DaemonSet
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -21,7 +21,7 @@ spec:
template:
metadata:
annotations:
checksum/config: 95e9619b4a954c26d6cf37135b3f20b9cb502bcaf9e2c4e8b9ee8e1cb626df15
checksum/config: 2aca0ef8db2e452eb73604d8e907035d49639ae5520ccc33fa78d52dd91679da

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: Deployment
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.62.2
helm.sh/chart: opentelemetry-collector-0.63.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -23,7 +23,7 @@ spec:
template:
metadata:
annotations:
checksum/config: f16d539cbd5eaa3a4d8dd2d7fa1893b63a3ab6380c4ce076928bafd36c37f035
checksum/config: a1e9d8f628b1ccdcbbfa0aa08e2b3c44fc2cce6c2a4f1fdc546d25a99f22efa2

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down
Loading

0 comments on commit 8eff58c

Please sign in to comment.