From ae780e6a9b8f9f7255b35978f0991352a9677dc1 Mon Sep 17 00:00:00 2001 From: Ugur Can Ozturk <57688057+ugur99@users.noreply.github.com> Date: Tue, 19 Dec 2023 04:00:10 +0100 Subject: [PATCH] [etcd]: add etcd distributed tracing flags (#10666) * [etcd]: add etcd distributed tracing flags Signed-off-by: Ugur Ozturk * [etcd]: add etcd distributed tracing flags - fix Signed-off-by: Ugur Ozturk * [etcd]: add etcd distributed tracing flags - fix Signed-off-by: Ugur Ozturk --------- Signed-off-by: Ugur Ozturk --- inventory/sample/group_vars/etcd.yml | 9 +++++++++ roles/etcd/defaults/main.yml | 7 +++++++ roles/etcd/templates/etcd.env.j2 | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/inventory/sample/group_vars/etcd.yml b/inventory/sample/group_vars/etcd.yml index f07c7209c..68beeb62b 100644 --- a/inventory/sample/group_vars/etcd.yml +++ b/inventory/sample/group_vars/etcd.yml @@ -24,3 +24,12 @@ ### ETCD: disable peer client cert authentication. # This affects ETCD_PEER_CLIENT_CERT_AUTH variable # etcd_peer_client_auth: true + +## Enable distributed tracing +## To enable this experimental feature, set the etcd_experimental_enable_distributed_tracing: true, along with the +## etcd_experimental_distributed_tracing_sample_rate to choose how many samples to collect per million spans, +## the default sampling rate is 0 https://etcd.io/docs/v3.5/op-guide/monitoring/#distributed-tracing +# etcd_experimental_enable_distributed_tracing: false +# etcd_experimental_distributed_tracing_sample_rate: 100 +# etcd_experimental_distributed_tracing_address: "localhost:4317" +# etcd_experimental_distributed_tracing_service_name: etcd \ No newline at end of file diff --git a/roles/etcd/defaults/main.yml b/roles/etcd/defaults/main.yml index bf38acee5..5eca0ee9e 100644 --- a/roles/etcd/defaults/main.yml +++ b/roles/etcd/defaults/main.yml @@ -120,3 +120,10 @@ etcd_experimental_initial_corrupt_check: true # may contain some private data, so it is recommended to set it to false # in the production environment. unsafe_show_logs: false + +# Enable distributed tracing +# https://etcd.io/docs/v3.5/op-guide/monitoring/#distributed-tracing +etcd_experimental_enable_distributed_tracing: false +etcd_experimental_distributed_tracing_sample_rate: 100 +etcd_experimental_distributed_tracing_address: "localhost:4317" +etcd_experimental_distributed_tracing_service_name: etcd \ No newline at end of file diff --git a/roles/etcd/templates/etcd.env.j2 b/roles/etcd/templates/etcd.env.j2 index 2abd9cc80..13a2437e1 100644 --- a/roles/etcd/templates/etcd.env.j2 +++ b/roles/etcd/templates/etcd.env.j2 @@ -68,3 +68,11 @@ ETCDCTL_CERT={{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem # ETCD 3.5.x issue # https://groups.google.com/a/kubernetes.io/g/dev/c/B7gJs88XtQc/m/rSgNOzV2BwAJ?utm_medium=email&utm_source=footer ETCD_EXPERIMENTAL_INITIAL_CORRUPT_CHECK={{ etcd_experimental_initial_corrupt_check }} + +{% if etcd_experimental_enable_distributed_tracing %} +ETCD_EXPERIMENTAL_ENABLE_DISTRIBUTED_TRACING=true +ETCD_EXPERIMENTAL_DISTRIBUTED_TRACING_SAMPLE_RATE={{ etcd_experimental_distributed_tracing_sample_rate }} +ETCD_EXPERIMENTAL_DISTRIBUTED_TRACING_ADDRESS={{ etcd_experimental_distributed_tracing_address }} +ETCD_EXPERIMENTAL_DISTRIBUTED_TRACING_SERVICE_NAME={{ etcd_experimental_distributed_tracing_service_name }} +ETCD_EXPERIMENTAL_DISTRIBUTED_TRACING_INSTANCE_ID={{ etcd_member_name }} +{% endif %} \ No newline at end of file