From fc52d7660b9cc243f94d432d399c7c0d89ed05f0 Mon Sep 17 00:00:00 2001
From: Povilas Versockas
Date: Thu, 29 Aug 2024 09:48:22 +0300
Subject: [PATCH] feat: add central cluster collector for tail sampling
---
otel-integration/CHANGELOG.md | 3 +
otel-integration/k8s-helm/Chart.yaml | 7 +-
otel-integration/k8s-helm/README.md | 53 +++++
.../k8s-helm/central-agent-values.yaml | 38 ++++
.../central-tail-sampling-values.yaml | 100 ++++++++++
otel-integration/k8s-helm/values.yaml | 186 +++++++++++++++++-
6 files changed, 385 insertions(+), 2 deletions(-)
create mode 100644 otel-integration/k8s-helm/central-agent-values.yaml
create mode 100644 otel-integration/k8s-helm/central-tail-sampling-values.yaml
diff --git a/otel-integration/CHANGELOG.md b/otel-integration/CHANGELOG.md
index 0a8491a0..e770410d 100644
--- a/otel-integration/CHANGELOG.md
+++ b/otel-integration/CHANGELOG.md
@@ -2,6 +2,9 @@
## OpenTelemtry-Integration
+### v0.0.98 / 2024-08-29
+- [Feat] Add a way to deploy central collector cluster for tail sampling
+
### v0.0.97 / 2024-08-19
- [Fix] ignore process name not found errors for hostmetrics process preset
diff --git a/otel-integration/k8s-helm/Chart.yaml b/otel-integration/k8s-helm/Chart.yaml
index 8be891d0..916d7eac 100644
--- a/otel-integration/k8s-helm/Chart.yaml
+++ b/otel-integration/k8s-helm/Chart.yaml
@@ -1,7 +1,7 @@
apiVersion: v2
name: otel-integration
description: OpenTelemetry Integration
-version: 0.0.97
+version: 0.0.98
keywords:
- OpenTelemetry Collector
- OpenTelemetry Agent
@@ -24,6 +24,11 @@ dependencies:
version: "0.90.0"
repository: https://cgx.jfrog.io/artifactory/coralogix-charts-virtual
condition: opentelemetry-cluster-collector.enabled
+ - name: opentelemetry-collector
+ alias: opentelemetry-receiver
+ version: "0.90.0"
+ repository: https://cgx.jfrog.io/artifactory/coralogix-charts-virtual
+ condition: opentelemetry-receiver.enabled
- name: opentelemetry-collector
alias: opentelemetry-gateway
version: "0.90.0"
diff --git a/otel-integration/k8s-helm/README.md b/otel-integration/k8s-helm/README.md
index 8bb53bb7..71ac98c8 100644
--- a/otel-integration/k8s-helm/README.md
+++ b/otel-integration/k8s-helm/README.md
@@ -245,6 +245,59 @@ This change will configure otel-agent pods to send span data to coralogix-opente
When running in Openshift make sure to set `distribution: "openshift"` in your `values.yaml`. When running in Windows environments, please use `values-windows-tailsampling.yaml` values file.
+### Deploying Central Collector Cluster for Tail Sampling
+
+If you want to deploy OpenTelemetry Collector in a seperate "central" Kubernetes Cluster, that receives telemetry data via OTLP receivers and does [Tail Sampling](https://opentelemetry.io/docs/concepts/sampling/#tail-sampling) you can install `otel-integration` using `central-tail-sampling-values.yaml` values file. Check the values file for configuration.
+
+This will deploy two deployments:
+- opentelemetry-receiver - responsible for receiving otlp data, pushing metrics and logs to Coralogix and loadbalancing spans to opentelemetry-gateway deployment.
+- opentelemetry-gateway - a service that receives span data and does Tail Sampling decisions.
+
+The opentelemetry-receiver will need to be exposed to other Kubernetes Clusters for sending data. You can do that by using service of type LoadBalancer, configuring Ingress object, or manually configuring your load balancer. Also, make sure to configure enough replicas and resource requests and limits to handle the load. Next, you will need to configure [tail sampling processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/tailsamplingprocessor) policies with your custom tail sampling policies.
+
+```bash
+helm repo add coralogix-charts-virtual https://cgx.jfrog.io/artifactory/coralogix-charts-virtual
+
+helm upgrade --install otel-coralogix-central-collector coralogix-charts-virtual/otel-integration \
+ --render-subchart-notes -f central-tail-sampling-values.yaml
+```
+
+Once you deploy it, you can validate by sending some otlp data to opentelemetry-receiver Service and checking Coralogix for spans. This can be done via telemetrygen:
+```
+kubectl apply -f - <