From 3319cab6c2ea6034d3aa25ca073a1dd8602339a3 Mon Sep 17 00:00:00 2001 From: Amir Blum Date: Thu, 19 Oct 2023 10:22:00 +0300 Subject: [PATCH] feat: add odigos version resource attribute to own telemetry (#671) --- cli/cmd/install.go | 5 +++-- cli/cmd/resources/owntelemetry.go | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cli/cmd/install.go b/cli/cmd/install.go index 4c570a400..3dd09fc9c 100644 --- a/cli/cmd/install.go +++ b/cli/cmd/install.go @@ -41,7 +41,8 @@ type ResourceCreationFunc func(ctx context.Context, cmd *cobra.Command, client * var installCmd = &cobra.Command{ Use: "install", Short: "Install Odigos", - Long: `Install Odigos in your cluster. This command will install the Odigos CRDs, the Odigos Instrumentor, Scheduler, Autoscaler and Odiglet.`, + Long: `Install Odigos in your kubernetes cluster. +This command will install k8s components that will auto-instrument your applications with OpenTelemetry and send traces, metrics and logs to any telemetry backend`, Run: func(cmd *cobra.Command, args []string) { client, err := kube.CreateClient(cmd) @@ -317,7 +318,7 @@ func createOwnTelemetryPipeline(ctx context.Context, cmd *cobra.Command, client return errors.New("odigos cloud api key is required for odigos own telemetry") } - _, err := client.CoreV1().ConfigMaps(ns).Create(ctx, resources.NewOwnTelemetryConfigMapOtlpGrpc(ns), metav1.CreateOptions{}) + _, err := client.CoreV1().ConfigMaps(ns).Create(ctx, resources.NewOwnTelemetryConfigMapOtlpGrpc(ns, versionFlag), metav1.CreateOptions{}) if err != nil { return err } diff --git a/cli/cmd/resources/owntelemetry.go b/cli/cmd/resources/owntelemetry.go index 2109bd9b4..54516d55a 100644 --- a/cli/cmd/resources/owntelemetry.go +++ b/cli/cmd/resources/owntelemetry.go @@ -46,7 +46,7 @@ func NewOwnTelemetryConfigMapDisabled() *corev1.ConfigMap { } // for odigos cloud which process own telemetry -func NewOwnTelemetryConfigMapOtlpGrpc(ns string) *corev1.ConfigMap { +func NewOwnTelemetryConfigMapOtlpGrpc(ns string, odigosVersion string) *corev1.ConfigMap { return &corev1.ConfigMap{ TypeMeta: v1.TypeMeta{ Kind: "ConfigMap", @@ -60,6 +60,8 @@ func NewOwnTelemetryConfigMapOtlpGrpc(ns string) *corev1.ConfigMap { "OTEL_EXPORTER_OTLP_INSECURE": "true", // the http:// scheme is not actually used, it how the exporter is expecting the value with grpc "OTEL_EXPORTER_OTLP_ENDPOINT": fmt.Sprintf("http://%s.%s:4317", ownTelemetryCollectorServiceName, ns), + // resource attributes + "OTEL_RESOURCE_ATTRIBUTES": fmt.Sprintf("odigos.version=%s", odigosVersion), }, } }