You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/01/18 08:27:23 UTC

[camel-k] branch main updated (5e8fd7b35 -> 69d8d7302)

This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


    from 5e8fd7b35 chore(doc): KNative -> Knative in doc and script
     new 2c6189ff0 feat(trait): Add telemetry trait
     new 69d8d7302 feat(e2e): Add Telemetry e2e test

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../{e2e-common => e2e-telemetry}/action.yml       |  12 +-
 .../{e2e-builder => e2e-telemetry}/exec-tests.sh   |  12 +-
 .github/actions/kamel-cleanup/action.yaml          |   7 +
 .../kamel-cleanup/clean-telemetry-resources.sh     |  26 ++++
 .../kamel-install-otlp-collector/action.yml        | 117 +++++++++++++++
 .github/workflows/{upgrade.yml => telemetry.yml}   |  15 +-
 addons/addons_test.go                              |  18 +--
 addons/{register_keda.go => register_telemetry.go} |   4 +-
 addons/{tracing => telemetry}/discovery/jaeger.go  |  10 +-
 addons/{tracing => telemetry}/discovery/locator.go |   8 +-
 addons/telemetry/telemetry.go                      | 158 +++++++++++++++++++++
 addons/telemetry/telemetry_test.go                 | 100 +++++++++++++
 addons/{master => telemetry}/test_support.go       |   6 +-
 addons/telemetry/zz_desc_generated.go              |   1 +
 addons/telemetry/zz_generated_doc.go               |   1 +
 addons/tracing/tracing.go                          |   8 +-
 docs/modules/ROOT/nav.adoc                         |   3 +-
 docs/modules/traits/pages/telemetry.adoc           |  82 +++++++++++
 docs/modules/traits/pages/tracing.adoc             |   7 +-
 .../{common => telemetry}/files/rest-consumer.yaml |   0
 .../{common => telemetry}/files/rest-producer.yaml |   0
 e2e/global/telemetry/telemetry_test.go             |  73 ++++++++++
 .../install/cli/duplicate_parameters_test.go       |   6 +-
 .../install/cli/files/JavaDuplicateParams.java     |   2 +-
 e2e/support/test_support.go                        |  34 +++++
 pkg/apis/camel/v1/common_types.go                  |   2 +
 pkg/apis/camel/v1/common_types_support_test.go     |   6 +-
 pkg/resources/resources.go                         |   4 +-
 pkg/trait/util_test.go                             |   4 +-
 pkg/util/defaults/defaults.go                      |   2 +-
 resources/traits.yaml                              |  49 ++++++-
 script/Makefile                                    |   4 +
 script/gen_doc.sh                                  |   1 +
 33 files changed, 725 insertions(+), 57 deletions(-)
 copy .github/actions/{e2e-common => e2e-telemetry}/action.yml (95%)
 copy .github/actions/{e2e-builder => e2e-telemetry}/exec-tests.sh (93%)
 create mode 100755 .github/actions/kamel-cleanup/clean-telemetry-resources.sh
 create mode 100644 .github/actions/kamel-install-otlp-collector/action.yml
 copy .github/workflows/{upgrade.yml => telemetry.yml} (91%)
 copy addons/{register_keda.go => register_telemetry.go} (89%)
 copy addons/{tracing => telemetry}/discovery/jaeger.go (82%)
 copy addons/{tracing => telemetry}/discovery/locator.go (81%)
 create mode 100644 addons/telemetry/telemetry.go
 create mode 100644 addons/telemetry/telemetry_test.go
 copy addons/{master => telemetry}/test_support.go (88%)
 create mode 100644 addons/telemetry/zz_desc_generated.go
 create mode 100644 addons/telemetry/zz_generated_doc.go
 create mode 100644 docs/modules/traits/pages/telemetry.adoc
 copy e2e/global/{common => telemetry}/files/rest-consumer.yaml (100%)
 copy e2e/global/{common => telemetry}/files/rest-producer.yaml (100%)
 create mode 100644 e2e/global/telemetry/telemetry_test.go


[camel-k] 01/02: feat(trait): Add telemetry trait

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 2c6189ff05cb54c733e1150cd59fad7f81652220
Author: Gaelle Fournier <ga...@gmail.com>
AuthorDate: Thu Jan 5 16:09:54 2023 +0100

    feat(trait): Add telemetry trait
    
    * Define telemetry addon
    * Jaeger discovery for OTLP API
    * Basic configuration for tracing OTLP sampler
    * update existing e2e using tracing to telemetry
    
    Resolves: #3519
---
 addons/addons_test.go                              |  18 +--
 .../defaults.go => addons/register_telemetry.go    |  38 +----
 addons/telemetry/discovery/jaeger.go               |  73 ++++++++++
 .../telemetry/discovery/locator.go                 |  43 ++----
 addons/telemetry/telemetry.go                      | 158 +++++++++++++++++++++
 addons/telemetry/telemetry_test.go                 | 100 +++++++++++++
 .../telemetry/test_support.go                      |  36 +----
 addons/telemetry/zz_desc_generated.go              |   1 +
 addons/telemetry/zz_generated_doc.go               |   1 +
 addons/tracing/tracing.go                          |   8 +-
 docs/modules/ROOT/nav.adoc                         |   3 +-
 docs/modules/traits/pages/telemetry.adoc           |  82 +++++++++++
 docs/modules/traits/pages/tracing.adoc             |   7 +-
 .../install/cli/duplicate_parameters_test.go       |   6 +-
 .../install/cli/files/JavaDuplicateParams.java     |   2 +-
 pkg/apis/camel/v1/common_types.go                  |   2 +
 pkg/apis/camel/v1/common_types_support_test.go     |   6 +-
 pkg/resources/resources.go                         |   4 +-
 pkg/trait/util_test.go                             |   4 +-
 pkg/util/defaults/defaults.go                      |   2 +-
 resources/traits.yaml                              |  49 ++++++-
 script/gen_doc.sh                                  |   1 +
 22 files changed, 520 insertions(+), 124 deletions(-)

diff --git a/addons/addons_test.go b/addons/addons_test.go
index 786172ee8..b33e880f9 100644
--- a/addons/addons_test.go
+++ b/addons/addons_test.go
@@ -23,7 +23,7 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 
 	"github.com/apache/camel-k/addons/master"
-	"github.com/apache/camel-k/addons/tracing"
+	"github.com/apache/camel-k/addons/telemetry"
 	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
 	"github.com/apache/camel-k/pkg/trait"
 
@@ -44,7 +44,7 @@ func TestTraitConfiguration(t *testing.T) {
 							"labelKey":     "test-label",
 							"labelValue":   "test-value",
 						}),
-						"tracing": trait.ToAddonTrait(t, map[string]interface{}{
+						"telemetry": trait.ToAddonTrait(t, map[string]interface{}{
 							"enabled": true,
 						}),
 					},
@@ -63,10 +63,10 @@ func TestTraitConfiguration(t *testing.T) {
 	assert.Equal(t, "test-label", *master.LabelKey)
 	assert.Equal(t, "test-value", *master.LabelValue)
 
-	require.NotNil(t, c.GetTrait("tracing"))
-	tracing, ok := c.GetTrait("tracing").(*tracing.TestTracingTrait)
+	require.NotNil(t, c.GetTrait("telemetry"))
+	telemetry, ok := c.GetTrait("telemetry").(*telemetry.TestTelemetryTrait)
 	require.True(t, ok)
-	assert.True(t, *tracing.Enabled)
+	assert.True(t, *telemetry.Enabled)
 }
 
 func TestTraitConfigurationFromAnnotations(t *testing.T) {
@@ -78,7 +78,7 @@ func TestTraitConfigurationFromAnnotations(t *testing.T) {
 					"trait.camel.apache.org/master.resource-name": "test-lock",
 					"trait.camel.apache.org/master.label-key":     "test-label",
 					"trait.camel.apache.org/master.label-value":   "test-value",
-					"trait.camel.apache.org/tracing.enabled":      "true",
+					"trait.camel.apache.org/telemetry.enabled":    "true",
 				},
 			},
 			Spec: v1.IntegrationSpec{
@@ -97,8 +97,8 @@ func TestTraitConfigurationFromAnnotations(t *testing.T) {
 	assert.Equal(t, "test-label", *master.LabelKey)
 	assert.Equal(t, "test-value", *master.LabelValue)
 
-	require.NotNil(t, c.GetTrait("tracing"))
-	tracing, ok := c.GetTrait("tracing").(*tracing.TestTracingTrait)
+	require.NotNil(t, c.GetTrait("telemetry"))
+	telemetry, ok := c.GetTrait("telemetry").(*telemetry.TestTelemetryTrait)
 	require.True(t, ok)
-	assert.True(t, *tracing.Enabled)
+	assert.True(t, *telemetry.Enabled)
 }
diff --git a/pkg/util/defaults/defaults.go b/addons/register_telemetry.go
similarity index 54%
copy from pkg/util/defaults/defaults.go
copy to addons/register_telemetry.go
index f2a39043d..9e2961522 100644
--- a/pkg/util/defaults/defaults.go
+++ b/addons/register_telemetry.go
@@ -15,37 +15,13 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package defaults
+package addons
 
-// ***********************
-//  DO NOT EDIT THIS FILE
-// ***********************
-
-const (
-	// Version --
-	Version = "1.12.0-SNAPSHOT"
-
-	// DefaultRuntimeVersion --
-	DefaultRuntimeVersion = "1.17.0-SNAPSHOT"
-
-	// BuildahVersion --
-	BuildahVersion = "1.23.3"
-
-	// KanikoVersion --
-	KanikoVersion = "0.17.1"
-
-	// baseImage --
-	baseImage = "docker.io/adoptopenjdk/openjdk11:slim"
-
-	// LocalRepository --
-	LocalRepository = "/tmp/artifacts/m2"
-
-	// ImageName --
-	ImageName = "docker.io/apache/camel-k"
-
-	// installDefaultKamelets --
-	installDefaultKamelets = true
+import (
+	"github.com/apache/camel-k/addons/telemetry"
+	"github.com/apache/camel-k/pkg/trait"
 )
 
-// GitCommit must be provided during application build
-var GitCommit string
+func init() {
+	trait.AddToTraits(telemetry.NewTelemetryTrait)
+}
diff --git a/addons/telemetry/discovery/jaeger.go b/addons/telemetry/discovery/jaeger.go
new file mode 100644
index 000000000..2eebd14b3
--- /dev/null
+++ b/addons/telemetry/discovery/jaeger.go
@@ -0,0 +1,73 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package discovery
+
+import (
+	"context"
+	"fmt"
+	"sort"
+	"strings"
+
+	"github.com/apache/camel-k/pkg/client"
+	"github.com/apache/camel-k/pkg/trait"
+	"github.com/apache/camel-k/pkg/util/log"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
+
+type JaegerTelemetryLocator struct {
+	allowHeadless bool
+}
+
+const (
+	jaegerPortName = "grpc-otlp"
+)
+
+func (loc *JaegerTelemetryLocator) FindEndpoint(ctx context.Context, c client.Client, l log.Logger, e *trait.Environment) (string, error) {
+	opts := metav1.ListOptions{
+		LabelSelector: "app.kubernetes.io/part-of=jaeger,app.kubernetes.io/component=service-collector",
+	}
+	lst, err := c.CoreV1().Services(e.Integration.Namespace).List(ctx, opts)
+	if err != nil {
+		return "", err
+	}
+	var candidates []string
+	for _, svc := range lst.Items {
+		if !loc.allowHeadless && strings.HasSuffix(svc.Name, "-headless") {
+			continue
+		}
+
+		for _, port := range svc.Spec.Ports {
+			if port.Name == jaegerPortName && port.Port > 0 {
+				candidates = append(candidates, fmt.Sprintf("http://%s.%s.svc.cluster.local:%d", svc.Name, svc.Namespace, port.Port))
+			}
+		}
+	}
+	sort.Strings(candidates)
+	if len(candidates) > 0 {
+		for _, endpoint := range candidates {
+			l.Infof("Detected Jaeger endpoint at: %s", endpoint)
+		}
+		return candidates[0], nil
+	}
+	return "", nil
+}
+
+// registering the locator.
+func init() {
+	TelemetryLocators = append(TelemetryLocators, &JaegerTelemetryLocator{}, &JaegerTelemetryLocator{allowHeadless: true})
+}
diff --git a/pkg/util/defaults/defaults.go b/addons/telemetry/discovery/locator.go
similarity index 54%
copy from pkg/util/defaults/defaults.go
copy to addons/telemetry/discovery/locator.go
index f2a39043d..42563791e 100644
--- a/pkg/util/defaults/defaults.go
+++ b/addons/telemetry/discovery/locator.go
@@ -15,37 +15,20 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package defaults
+package discovery
 
-// ***********************
-//  DO NOT EDIT THIS FILE
-// ***********************
+import (
+	"context"
 
-const (
-	// Version --
-	Version = "1.12.0-SNAPSHOT"
-
-	// DefaultRuntimeVersion --
-	DefaultRuntimeVersion = "1.17.0-SNAPSHOT"
-
-	// BuildahVersion --
-	BuildahVersion = "1.23.3"
-
-	// KanikoVersion --
-	KanikoVersion = "0.17.1"
-
-	// baseImage --
-	baseImage = "docker.io/adoptopenjdk/openjdk11:slim"
-
-	// LocalRepository --
-	LocalRepository = "/tmp/artifacts/m2"
-
-	// ImageName --
-	ImageName = "docker.io/apache/camel-k"
-
-	// installDefaultKamelets --
-	installDefaultKamelets = true
+	"github.com/apache/camel-k/pkg/client"
+	"github.com/apache/camel-k/pkg/trait"
+	"github.com/apache/camel-k/pkg/util/log"
 )
 
-// GitCommit must be provided during application build
-var GitCommit string
+// TelemetryLocators contains available telemetry OTLP locators.
+var TelemetryLocators []TelemetryLocator
+
+// TelemetryLocator is able to find the address of an available telemetry OTLP endpoint.
+type TelemetryLocator interface {
+	FindEndpoint(context.Context, client.Client, log.Logger, *trait.Environment) (string, error)
+}
diff --git a/addons/telemetry/telemetry.go b/addons/telemetry/telemetry.go
new file mode 100644
index 000000000..b3687296c
--- /dev/null
+++ b/addons/telemetry/telemetry.go
@@ -0,0 +1,158 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package telemetry
+
+import (
+	"k8s.io/utils/pointer"
+
+	"github.com/apache/camel-k/addons/telemetry/discovery"
+	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+	traitv1 "github.com/apache/camel-k/pkg/apis/camel/v1/trait"
+	"github.com/apache/camel-k/pkg/trait"
+	"github.com/apache/camel-k/pkg/util"
+)
+
+// The Telemetry trait can be used to automatically publish tracing information to an OTLP compatible collector.
+//
+// The trait is able to automatically discover the telemetry OTLP endpoint available in the namespace (supports **Jaerger** in version 1.35+).
+//
+// The Telemetry trait is disabled by default.
+//
+// WARNING: The Telemetry trait can't be enabled at the same time as the Tracing trait.
+//
+// +camel-k:trait=telemetry.
+type Trait struct {
+	traitv1.Trait `property:",squash" json:",inline"`
+	// Enables automatic configuration of the trait, including automatic discovery of the telemetry endpoint.
+	Auto *bool `property:"auto" json:"auto,omitempty"`
+	// The name of the service that publishes telemetry data (defaults to the integration name)
+	ServiceName string `property:"service-name" json:"serviceName,omitempty"`
+	// The target endpoint of the Telemetry service (automatically discovered by default)
+	Endpoint string `property:"endpoint" json:"endpoint,omitempty"`
+	// The sampler of the telemetry used for tracing (default "on")
+	Sampler string `property:"sampler" json:"sampler,omitempty"`
+	// The sampler ratio of the telemetry used for tracing
+	SamplerRatio string `property:"sampler-ratio" json:"sampler-ratio,omitempty"`
+	// The sampler of the telemetry used for tracing is parent based (default "true")
+	SamplerParentBased *bool `property:"sampler-parent-based" json:"sampler-parent-based,omitempty"`
+}
+
+type telemetryTrait struct {
+	trait.BaseTrait
+	Trait `property:",squash"`
+}
+
+const (
+	propEnabled            = "propEnabled"
+	propEndpoint           = "propEndpoint"
+	propServiceName        = "propServiceName"
+	propSampler            = "propSampler"
+	propSamplerRatio       = "propSamplerRatio"
+	propSamplerParentBased = "propSamplerParentBased"
+)
+
+var (
+	telemetryProperties = map[v1.RuntimeProvider]map[string]string{
+		v1.RuntimeProviderQuarkus: {
+			propEndpoint:           "quarkus.opentelemetry.tracer.exporter.otlp.endpoint",
+			propServiceName:        "quarkus.opentelemetry.tracer.resource-attributes",
+			propSampler:            "quarkus.opentelemetry.tracer.sampler",
+			propSamplerRatio:       "quarkus.opentelemetry.tracer.sampler.ratio",
+			propSamplerParentBased: "quarkus.opentelemetry.tracer.sampler.parent-based",
+		},
+	}
+)
+
+// NewTelemetryTrait instance the telemetry trait as a BaseTrait capable to inject quarkus properties.
+func NewTelemetryTrait() trait.Trait {
+	return &telemetryTrait{
+		BaseTrait: trait.NewBaseTrait("telemetry", trait.TraitOrderBeforeControllerCreation),
+	}
+}
+
+func (t *telemetryTrait) Configure(e *trait.Environment) (bool, error) {
+	if e.Integration == nil || !pointer.BoolDeref(t.Enabled, false) {
+		return false, nil
+	}
+
+	if pointer.BoolDeref(t.Auto, true) {
+		if t.Endpoint == "" {
+			for _, locator := range discovery.TelemetryLocators {
+				endpoint, err := locator.FindEndpoint(e.Ctx, t.Client, t.L, e)
+				if err != nil {
+					return false, err
+				}
+				if endpoint != "" {
+					t.L.Infof("Using tracing endpoint: %s", endpoint)
+					t.Endpoint = endpoint
+					break
+				}
+			}
+		}
+
+		if t.ServiceName == "" {
+			t.ServiceName = e.Integration.Name
+		}
+
+		if t.Sampler == "" {
+			t.Sampler = "on"
+		}
+	}
+
+	return true, nil
+}
+
+func (t *telemetryTrait) Apply(e *trait.Environment) error {
+	util.StringSliceUniqueAdd(&e.Integration.Status.Capabilities, v1.CapabilityTelemetry)
+
+	if e.CamelCatalog != nil {
+		provider := e.CamelCatalog.CamelCatalogSpec.Runtime.Provider
+		properties := telemetryProperties[provider]
+
+		if appPropEnabled := properties[propEnabled]; appPropEnabled != "" {
+			e.ApplicationProperties[appPropEnabled] = "true"
+		}
+
+		if appPropEndpoint := properties[propEndpoint]; appPropEndpoint != "" && t.Endpoint != "" {
+			e.ApplicationProperties[appPropEndpoint] = t.Endpoint
+		}
+
+		if appPropServiceName := properties[propServiceName]; appPropServiceName != "" && t.ServiceName != "" {
+			e.ApplicationProperties[appPropServiceName] = "service.name=" + t.ServiceName
+		}
+
+		if appPropSampler := properties[propSampler]; appPropSampler != "" && t.Sampler != "" {
+			e.ApplicationProperties[appPropSampler] = t.Sampler
+		}
+
+		if appPropSamplerRatio := properties[propSamplerRatio]; appPropSamplerRatio != "" && t.SamplerRatio != "" {
+			e.ApplicationProperties[appPropSamplerRatio] = t.SamplerRatio
+		}
+
+		if appPropSamplerParentBased := properties[propSamplerParentBased]; appPropSamplerParentBased != "" {
+			if pointer.BoolDeref(t.SamplerParentBased, true) {
+				e.ApplicationProperties[appPropSamplerParentBased] = "true"
+			} else {
+				e.ApplicationProperties[appPropSamplerParentBased] = "false"
+			}
+		}
+
+	}
+
+	return nil
+}
diff --git a/addons/telemetry/telemetry_test.go b/addons/telemetry/telemetry_test.go
new file mode 100644
index 000000000..02070f8b2
--- /dev/null
+++ b/addons/telemetry/telemetry_test.go
@@ -0,0 +1,100 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package telemetry
+
+import (
+	"testing"
+
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/utils/pointer"
+
+	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+	"github.com/apache/camel-k/pkg/trait"
+	"github.com/apache/camel-k/pkg/util/camel"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestTelemetryTraitOnDefaultQuarkus(t *testing.T) {
+	e := createEnvironment(t, camel.QuarkusCatalog)
+	telemetry := NewTelemetryTrait()
+	tt, _ := telemetry.(*telemetryTrait)
+	tt.Enabled = pointer.Bool(true)
+	tt.Endpoint = "http://endpoint3"
+	ok, err := telemetry.Configure(e)
+	assert.Nil(t, err)
+	assert.True(t, ok)
+
+	err = telemetry.Apply(e)
+	assert.Nil(t, err)
+
+	assert.Empty(t, e.ApplicationProperties["quarkus.opentelemetry.enabled"])
+	assert.Equal(t, "http://endpoint3", e.ApplicationProperties["quarkus.opentelemetry.tracer.exporter.otlp.endpoint"])
+	assert.Equal(t, "service.name=test", e.ApplicationProperties["quarkus.opentelemetry.tracer.resource-attributes"])
+	assert.Equal(t, "on", e.ApplicationProperties["quarkus.opentelemetry.tracer.sampler"])
+	assert.Empty(t, e.ApplicationProperties["quarkus.opentelemetry.tracer.sampler.ratio"])
+	assert.Equal(t, "true", e.ApplicationProperties["quarkus.opentelemetry.tracer.sampler.parent-based"])
+}
+
+func TestTelemetryTraitWithValues(t *testing.T) {
+	e := createEnvironment(t, camel.QuarkusCatalog)
+	telemetry := NewTelemetryTrait()
+	tt, _ := telemetry.(*telemetryTrait)
+	tt.Enabled = pointer.Bool(true)
+	tt.Endpoint = "http://endpoint3"
+	tt.ServiceName = "Test"
+	tt.Sampler = "ratio"
+	tt.SamplerRatio = "0.001"
+	tt.SamplerParentBased = pointer.Bool(false)
+	ok, err := telemetry.Configure(e)
+	assert.Nil(t, err)
+	assert.True(t, ok)
+
+	err = telemetry.Apply(e)
+	assert.Nil(t, err)
+
+	assert.Empty(t, e.ApplicationProperties["quarkus.opentelemetry.enabled"])
+	assert.Equal(t, "http://endpoint3", e.ApplicationProperties["quarkus.opentelemetry.tracer.exporter.otlp.endpoint"])
+	assert.Equal(t, "service.name=Test", e.ApplicationProperties["quarkus.opentelemetry.tracer.resource-attributes"])
+	assert.Equal(t, "ratio", e.ApplicationProperties["quarkus.opentelemetry.tracer.sampler"])
+	assert.Equal(t, "0.001", e.ApplicationProperties["quarkus.opentelemetry.tracer.sampler.ratio"])
+	assert.Equal(t, "false", e.ApplicationProperties["quarkus.opentelemetry.tracer.sampler.parent-based"])
+}
+
+func createEnvironment(t *testing.T, catalogGen func() (*camel.RuntimeCatalog, error)) *trait.Environment {
+	t.Helper()
+
+	catalog, err := catalogGen()
+	assert.Nil(t, err)
+
+	e := trait.Environment{
+		CamelCatalog:          catalog,
+		ApplicationProperties: make(map[string]string),
+	}
+
+	it := v1.Integration{
+		ObjectMeta: metav1.ObjectMeta{
+			Name: "test",
+		},
+		Status: v1.IntegrationStatus{
+			Phase: v1.IntegrationPhaseDeploying,
+		},
+	}
+	e.Integration = &it
+	return &e
+}
diff --git a/pkg/util/defaults/defaults.go b/addons/telemetry/test_support.go
similarity index 53%
copy from pkg/util/defaults/defaults.go
copy to addons/telemetry/test_support.go
index f2a39043d..10ecf724c 100644
--- a/pkg/util/defaults/defaults.go
+++ b/addons/telemetry/test_support.go
@@ -15,37 +15,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package defaults
+package telemetry
 
-// ***********************
-//  DO NOT EDIT THIS FILE
-// ***********************
-
-const (
-	// Version --
-	Version = "1.12.0-SNAPSHOT"
-
-	// DefaultRuntimeVersion --
-	DefaultRuntimeVersion = "1.17.0-SNAPSHOT"
-
-	// BuildahVersion --
-	BuildahVersion = "1.23.3"
-
-	// KanikoVersion --
-	KanikoVersion = "0.17.1"
-
-	// baseImage --
-	baseImage = "docker.io/adoptopenjdk/openjdk11:slim"
-
-	// LocalRepository --
-	LocalRepository = "/tmp/artifacts/m2"
-
-	// ImageName --
-	ImageName = "docker.io/apache/camel-k"
-
-	// installDefaultKamelets --
-	installDefaultKamelets = true
-)
-
-// GitCommit must be provided during application build
-var GitCommit string
+// Expose telemetryTrait type for testing.
+type TestTelemetryTrait = telemetryTrait
diff --git a/addons/telemetry/zz_desc_generated.go b/addons/telemetry/zz_desc_generated.go
new file mode 100644
index 000000000..073f40d23
--- /dev/null
+++ b/addons/telemetry/zz_desc_generated.go
@@ -0,0 +1 @@
+package telemetry
diff --git a/addons/telemetry/zz_generated_doc.go b/addons/telemetry/zz_generated_doc.go
new file mode 100644
index 000000000..073f40d23
--- /dev/null
+++ b/addons/telemetry/zz_generated_doc.go
@@ -0,0 +1 @@
+package telemetry
diff --git a/addons/tracing/tracing.go b/addons/tracing/tracing.go
index 7423eb9fb..667240fe2 100644
--- a/addons/tracing/tracing.go
+++ b/addons/tracing/tracing.go
@@ -27,13 +27,17 @@ import (
 	"github.com/apache/camel-k/pkg/util"
 )
 
-// The Tracing trait can be used to automatically publish tracing information to an
-// OpenTracing compatible collector.
+//
+// WARNING: The Tracing trait has been **deprecated** in favor of the xref:traits:telemetry.adoc[Telemetry] trait.
+//
+// The Tracing trait can be used to automatically publish tracing information to an OpenTracing compatible collector.
 //
 // The trait is able to automatically discover the tracing endpoint available in the namespace (supports **Jaeger**).
 //
 // The Tracing trait is disabled by default.
 //
+// WARNING: The Tracing trait can't be enabled at the same time as the Telemetry trait.
+//
 // +camel-k:trait=tracing.
 type Trait struct {
 	traitv1.Trait `property:",squash" json:",inline"`
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 61a1a98a4..a9919e50a 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -52,7 +52,7 @@
 ** xref:scaling/binding.adoc[Binding]
 * xref:traits:traits.adoc[Traits]
 // Start of autogenerated code - DO NOT EDIT! (trait-nav)
-** xref:traits:3scale.adoc[3scale]
+** xref:traits:3scale.adoc[3Scale]
 ** xref:traits:affinity.adoc[Affinity]
 ** xref:traits:aws-secrets-manager.adoc[Aws Secrets Manager]
 ** xref:traits:azure-key-vault.adoc[Azure Key Vault]
@@ -92,6 +92,7 @@
 ** xref:traits:route.adoc[Route]
 ** xref:traits:service-binding.adoc[Service Binding]
 ** xref:traits:service.adoc[Service]
+** xref:traits:telemetry.adoc[Telemetry]
 ** xref:traits:toleration.adoc[Toleration]
 ** xref:traits:tracing.adoc[Tracing]
 // End of autogenerated code - DO NOT EDIT! (trait-nav)
diff --git a/docs/modules/traits/pages/telemetry.adoc b/docs/modules/traits/pages/telemetry.adoc
new file mode 100644
index 000000000..6adacbaa8
--- /dev/null
+++ b/docs/modules/traits/pages/telemetry.adoc
@@ -0,0 +1,82 @@
+= Telemetry Trait
+
+// Start of autogenerated code - DO NOT EDIT! (description)
+The Telemetry trait can be used to automatically publish tracing information to an OTLP compatible collector.
+
+The trait is able to automatically discover the telemetry OTLP endpoint available in the namespace (supports **Jaerger** in version 1.35+).
+
+The Telemetry trait is disabled by default.
+
+WARNING: The Telemetry trait can't be enabled at the same time as the Tracing trait.
+
+
+This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**.
+
+// End of autogenerated code - DO NOT EDIT! (description)
+// Start of autogenerated code - DO NOT EDIT! (configuration)
+== Configuration
+
+Trait properties can be specified when running any integration with the CLI:
+[source,console]
+----
+$ kamel run --trait telemetry.[key]=[value] --trait telemetry.[key2]=[value2] integration.groovy
+----
+The following configuration options are available:
+
+[cols="2m,1m,5a"]
+|===
+|Property | Type | Description
+
+| telemetry.enabled
+| bool
+| Can be used to enable or disable a trait. All traits share this common property.
+
+| telemetry.auto
+| bool
+| Enables automatic configuration of the trait, including automatic discovery of the telemetry endpoint.
+
+| telemetry.service-name
+| string
+| The name of the service that publishes telemetry data (defaults to the integration name)
+
+| telemetry.endpoint
+| string
+| The target endpoint of the Telemetry service (automatically discovered by default)
+
+| telemetry.sampler
+| string
+| The sampler of the telemetry used for tracing (default "on")
+
+| telemetry.sampler-ratio
+| string
+| The sampler ratio of the telemetry used for tracing
+
+| telemetry.sampler-parent-based
+| bool
+| The sampler of the telemetry used for tracing is parent based (default "true")
+
+|===
+
+// End of autogenerated code - DO NOT EDIT! (configuration)
+
+== Examples
+
+* To activate tracing to a deployed OTLP API Jaeger through discovery: 
++
+[source,console]
+$ kamel run -t telemetry.enable=true ...
+
+* To define a specific deployed OTLP gRPC reciever: 
++
+[source,console]
+$ kamel run -t telemetry.enable=true -t telemetry.endpoint=http://instance-collector:4317 ...
+
+* To define another sampler service name: 
++
+[source,console]
+$ kamel run -t telemetry.enable=true -t telemetry.service-name=tracer_myintegration ...
+
+* To use a ratio sampler with a sampling ratio of 1 to every 1,000 : 
++
+[source,console]
+$ kamel run -t telemetry.enable=true -t telemetry.sampler=ratio -t telemetry.sampler-ratio=0.001 ...
diff --git a/docs/modules/traits/pages/tracing.adoc b/docs/modules/traits/pages/tracing.adoc
index 735f624d4..549910fed 100755
--- a/docs/modules/traits/pages/tracing.adoc
+++ b/docs/modules/traits/pages/tracing.adoc
@@ -1,13 +1,16 @@
 = Tracing Trait
 
 // Start of autogenerated code - DO NOT EDIT! (description)
-The Tracing trait can be used to automatically publish tracing information to an
-OpenTracing compatible collector.
+WARNING: The Tracing trait has been **deprecated** in favor of the xref:traits:telemetry.adoc[Telemetry] trait.
+
+The Tracing trait can be used to automatically publish tracing information to an OpenTracing compatible collector.
 
 The trait is able to automatically discover the tracing endpoint available in the namespace (supports **Jaeger**).
 
 The Tracing trait is disabled by default.
 
+WARNING: The Tracing trait can't be enabled at the same time as the Telemetry trait.
+
 
 This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**.
 
diff --git a/e2e/namespace/install/cli/duplicate_parameters_test.go b/e2e/namespace/install/cli/duplicate_parameters_test.go
index b3a114e1b..7e03e1d48 100644
--- a/e2e/namespace/install/cli/duplicate_parameters_test.go
+++ b/e2e/namespace/install/cli/duplicate_parameters_test.go
@@ -39,10 +39,10 @@ func TestDuplicateParameters(t *testing.T) {
 	defer cancel()
 
 	// run kamel to output the traits/configuration structure in json format to check the processed values
-	// the tracing.enabled is false inside JavaDuplicateParams.java, so we can check the output of this trait as true.
+	// the telemetry.enabled is false inside JavaDuplicateParams.java, so we can check the output of this trait as true.
 	cmdParams := []string{"kamel", "run", "files/JavaDuplicateParams.java",
 		"-o", "json",
-		"-t", "tracing.enabled=true", "--trait", "pull-secret.enabled=true",
+		"-t", "telemetry.enabled=true", "--trait", "pull-secret.enabled=true",
 		"--property", "prop1=true", "-p", "prop2=true",
 		"--force"}
 	comm, _, _ := cmd.NewKamelWithModelineCommand(ctx, cmdParams)
@@ -51,6 +51,6 @@ func TestDuplicateParameters(t *testing.T) {
 	commOutput := GetOutputString(comm)
 
 	outParams :=
-		`"traits":{"affinity":{"enabled":true},"camel":{"properties":["prop1 = true","prop2 = true","foo = bar"]},"pull-secret":{"enabled":true},"addons":{"tracing":{"enabled":true}}}`
+		`"traits":{"affinity":{"enabled":true},"camel":{"properties":["prop1 = true","prop2 = true","foo = bar"]},"pull-secret":{"enabled":true},"addons":{"telemetry":{"enabled":true}}}`
 	Expect(commOutput).To(ContainSubstring(outParams))
 }
diff --git a/e2e/namespace/install/cli/files/JavaDuplicateParams.java b/e2e/namespace/install/cli/files/JavaDuplicateParams.java
index 95b73b1ac..ef267c31a 100644
--- a/e2e/namespace/install/cli/files/JavaDuplicateParams.java
+++ b/e2e/namespace/install/cli/files/JavaDuplicateParams.java
@@ -1,4 +1,4 @@
-// camel-k: language=java trait=tracing.enabled=false trait=affinity.enabled=true property=prop1=false property=foo=bar
+// camel-k: language=java trait=telemetry.enabled=false trait=affinity.enabled=true property=prop1=false property=foo=bar
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/pkg/apis/camel/v1/common_types.go b/pkg/apis/camel/v1/common_types.go
index c30be28de..33eec9f89 100644
--- a/pkg/apis/camel/v1/common_types.go
+++ b/pkg/apis/camel/v1/common_types.go
@@ -294,6 +294,8 @@ const (
 	CapabilityCircuitBreaker = "circuit-breaker"
 	// CapabilityTracing defines the tracing (opentracing) capability
 	CapabilityTracing = "tracing"
+	// CapabilityTelemetry defines the telemetry (opentelemetry) capability
+	CapabilityTelemetry = "telemetry"
 	// CapabilityMaster defines the master capability
 	CapabilityMaster = "master"
 	// CapabilityResumeKafka defines the resume capability
diff --git a/pkg/apis/camel/v1/common_types_support_test.go b/pkg/apis/camel/v1/common_types_support_test.go
index e46455493..dd424a33d 100644
--- a/pkg/apis/camel/v1/common_types_support_test.go
+++ b/pkg/apis/camel/v1/common_types_support_test.go
@@ -47,7 +47,7 @@ func TestTraitsMerge(t *testing.T) {
 			"master": toAddonTrait(t, map[string]interface{}{
 				"resourceName": "test-lock",
 			}),
-			"tracing": toAddonTrait(t, map[string]interface{}{
+			"telemetry": toAddonTrait(t, map[string]interface{}{
 				"enabled": true,
 			}),
 		},
@@ -66,7 +66,7 @@ func TestTraitsMerge(t *testing.T) {
 			Level: "DEBUG",
 		},
 		Addons: map[string]AddonTrait{
-			"tracing": toAddonTrait(t, map[string]interface{}{
+			"telemetry": toAddonTrait(t, map[string]interface{}{
 				"serviceName": "test-integration",
 			}),
 		},
@@ -103,7 +103,7 @@ func TestTraitsMerge(t *testing.T) {
 			"enabled":     true,
 			"serviceName": "test-integration",
 		}),
-		t1.Addons["tracing"])
+		t1.Addons["telemetry"])
 }
 
 func configurationFromMap(t *testing.T, configMap map[string]interface{}) *trait.Configuration {
diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index 61fa2f5b9..121603906 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -611,9 +611,9 @@ var assets = func() http.FileSystem {
 		"/traits.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "traits.yaml",
 			modTime:          time.Time{},
-			uncompressedSize: 56648,
+			uncompressedSize: 58334,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x7b\x73\x1b\x39\x92\x20\xfe\x7f\x7f\x0a\x84\xf6\xb7\x21\xc9\x41\x52\xee\x9e\x9d\xd9\x5e\xfd\xce\x3b\xa7\xb6\xdd\x33\xea\xf6\x43\x67\xa9\x7b\x76\xc2\xe7\x18\x82\x55\x20\x09\xb3\x0a\xa8\x06\x50\x92\xd8\x37\xf7\xdd\x2f\x90\x99\x78\x54\xb1\x28\x52\xb6\xd5\x31\xba\xb9\xe9\x88\xb1\x48\x56\x25\x12\x89\x44\x22\x91\x4f\x67\xb8\x74\xf6\xf4\xab\x31\x53\xbc\x16\xa7\xec\x77\xb6\xe0\x95\xf8\x8a\xb1\xa6\xe2\x6e\xae\x4d\x7d\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\xfd\x73\x1c\x37\x92\x20\xfa\xbb\xfe\x0a\x04\xf7\x6d\x90\xd4\xeb\x6e\xca\x9e\xf5\xac\x97\xef\x69\xe7\x68\x59\x9e\xa1\xad\x0f\x9e\x48\x7b\x76\x42\xa7\x98\x46\x57\xa1\xbb\xa1\xae\x02\x6a\x00\x14\xc9\xf6\xed\xfd\xef\x17\xc8\x4c\x7c\x54\x75\x35\xbb\x29\x89\xbe\xe1\xcd\xee\x44\xac\x45\xb2\x90\x48\x24\x12\x89\x44\x7e\x3a\xc3\xa5\xb3\xa7\x4f\xc6\x4c\xf1\x5a\x9c\xb2\xdf\xd9\x82\x57\xe2\x09\x63\x4d\xc5\xdd\x5c\x9b\xfa\x [...]
 		},
 	}
 	fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
diff --git a/pkg/trait/util_test.go b/pkg/trait/util_test.go
index 7c19d9332..63b973a1d 100644
--- a/pkg/trait/util_test.go
+++ b/pkg/trait/util_test.go
@@ -53,7 +53,7 @@ func TestToTraitMap(t *testing.T) {
 			},
 		},
 		Addons: map[string]v1.AddonTrait{
-			"tracing": ToAddonTrait(t, map[string]interface{}{
+			"telemetry": ToAddonTrait(t, map[string]interface{}{
 				"enabled": true,
 			}),
 		},
@@ -76,7 +76,7 @@ func TestToTraitMap(t *testing.T) {
 			"enabled": true,
 		},
 		"addons": {
-			"tracing": map[string]interface{}{
+			"telemetry": map[string]interface{}{
 				"enabled": true,
 			},
 		},
diff --git a/pkg/util/defaults/defaults.go b/pkg/util/defaults/defaults.go
index f2a39043d..3297388a4 100644
--- a/pkg/util/defaults/defaults.go
+++ b/pkg/util/defaults/defaults.go
@@ -47,5 +47,5 @@ const (
 	installDefaultKamelets = true
 )
 
-// GitCommit must be provided during application build
+//GitCommit must be provided during application build
 var GitCommit string
diff --git a/resources/traits.yaml b/resources/traits.yaml
index 156bf380a..a5fef3a9f 100755
--- a/resources/traits.yaml
+++ b/resources/traits.yaml
@@ -1289,6 +1289,44 @@ traits:
   - name: services
     type: '[]string'
     description: List of Services in the form [[apigroup/]version:]kind:[namespace/]name
+- name: telemetry
+  platform: false
+  profiles:
+  - Kubernetes
+  - Knative
+  - OpenShift
+  description: 'The Telemetry trait can be used to automatically publish tracing information
+    to an OTLP compatible collector. The trait is able to automatically discover the
+    telemetry OTLP endpoint available in the namespace (supports **Jaerger** in version
+    1.35+). The Telemetry trait is disabled by default. WARNING: The Telemetry trait
+    can''t be enabled at the same time as the Tracing trait.'
+  properties:
+  - name: enabled
+    type: bool
+    description: Can be used to enable or disable a trait. All traits share this common
+      property.
+  - name: auto
+    type: bool
+    description: Enables automatic configuration of the trait, including automatic
+      discovery of the telemetry endpoint.
+  - name: service-name
+    type: string
+    description: The name of the service that publishes telemetry data (defaults to
+      the integration name)
+  - name: endpoint
+    type: string
+    description: The target endpoint of the Telemetry service (automatically discovered
+      by default)
+  - name: sampler
+    type: string
+    description: The sampler of the telemetry used for tracing (default "on")
+  - name: sampler-ratio
+    type: string
+    description: The sampler ratio of the telemetry used for tracing
+  - name: sampler-parent-based
+    type: bool
+    description: The sampler of the telemetry used for tracing is parent based (default
+      "true")
 - name: toleration
   platform: false
   profiles:
@@ -1316,10 +1354,13 @@ traits:
   - Kubernetes
   - Knative
   - OpenShift
-  description: The Tracing trait can be used to automatically publish tracing information
-    to an OpenTracing compatible collector. The trait is able to automatically discover
-    the tracing endpoint available in the namespace (supports **Jaeger**). The Tracing
-    trait is disabled by default.
+  description: 'WARNING: The Tracing trait has been **deprecated** in favor of the
+    xref:traits:telemetry.adoc[Telemetry] trait. The Tracing trait can be used to
+    automatically publish tracing information to an OpenTracing compatible collector.
+    The trait is able to automatically discover the tracing endpoint available in
+    the namespace (supports **Jaeger**). The Tracing trait is disabled by default.
+    WARNING: The Tracing trait can''t be enabled at the same time as the Telemetry
+    trait.'
   properties:
   - name: enabled
     type: bool
diff --git a/script/gen_doc.sh b/script/gen_doc.sh
index 523d0cdc7..76982a18b 100755
--- a/script/gen_doc.sh
+++ b/script/gen_doc.sh
@@ -31,6 +31,7 @@ go run ./cmd/util/doc-gen \
   --input-dirs github.com/apache/camel-k/addons/resume \
   --input-dirs github.com/apache/camel-k/addons/threescale \
   --input-dirs github.com/apache/camel-k/addons/tracing \
+  --input-dirs github.com/apache/camel-k/addons/telemetry \
   --input-dirs github.com/apache/camel-k/addons/vault/aws \
   --input-dirs github.com/apache/camel-k/addons/vault/gcp \
   --input-dirs github.com/apache/camel-k/addons/vault/azure


[camel-k] 02/02: feat(e2e): Add Telemetry e2e test

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 69d8d7302e976e7ebe96b58d42d2506e1ec8338f
Author: Gaelle Fournier <ga...@gmail.com>
AuthorDate: Wed Jan 11 18:06:23 2023 +0100

    feat(e2e): Add Telemetry e2e test
    
    * Add specific github action
    * Add opentelemetry basic config collector in telemetry e2e env
---
 .github/actions/e2e-telemetry/action.yml           | 137 ++++++++++++++++++++
 .github/actions/e2e-telemetry/exec-tests.sh        | 141 +++++++++++++++++++++
 .github/actions/kamel-cleanup/action.yaml          |   7 +
 .../kamel-cleanup/clean-telemetry-resources.sh     |  26 ++++
 .../kamel-install-otlp-collector/action.yml        | 117 +++++++++++++++++
 .github/workflows/telemetry.yml                    |  94 ++++++++++++++
 e2e/global/telemetry/files/rest-consumer.yaml      |  29 +++++
 e2e/global/telemetry/files/rest-producer.yaml      |  24 ++++
 e2e/global/telemetry/telemetry_test.go             |  73 +++++++++++
 e2e/support/test_support.go                        |  34 +++++
 script/Makefile                                    |   4 +
 11 files changed, 686 insertions(+)

diff --git a/.github/actions/e2e-telemetry/action.yml b/.github/actions/e2e-telemetry/action.yml
new file mode 100644
index 000000000..000ddde2d
--- /dev/null
+++ b/.github/actions/e2e-telemetry/action.yml
@@ -0,0 +1,137 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+name: e2e-telemetry
+description: 'End-to-End tests for telemetry use-cases'
+
+inputs:
+  cluster-config-data:
+    description: 'The configuration of the underlying cluster (if cluster-type is custom)'
+    required: false
+  cluster-kube-config-data:
+    description: 'Base16 encoded kube config - required for custom cluster type only'
+    required: false
+
+runs:
+  using: "composite"
+
+  steps:
+  - id: prepare-env
+    name: Prepare Test Environment
+    uses: ./.github/actions/kamel-prepare-env
+
+  - id: config-cluster
+    name: Configure Platform
+    uses: ./.github/actions/kamel-config-cluster
+    with:
+      cluster-config-data: ${{ inputs.cluster-config-data }}
+      cluster-kube-config-data: ${{ inputs.cluster-kube-config-data }}
+  #
+  # Try and ensure the cluster is in a vanilla state before
+  # starting in on an installation
+  #
+  - id: pre-clean-cluster
+    name: Pre Clean Cluster
+    uses: ./.github/actions/kamel-cleanup
+    if: ${{ always() }}
+    with:
+      catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }}
+      catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
+      image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
+      global-operator-namespace: ${{ steps.config-cluster.outputs.cluster-global-operator-namespace }}
+
+  - id: build-kamel
+    name: Build Kamel
+    uses: ./.github/actions/kamel-build
+    with:
+      image-registry-push-host: ${{ steps.config-cluster.outputs.cluster-image-registry-push-host }}
+      image-registry-pull-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+      image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
+      # Builds the bundle if an OLM is available - depends on cluster being tested
+      build-bundle: ${{ steps.config-cluster.outputs.cluster-has-olm }}
+      # Both can be empty and so catalog source will not be created
+      catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }}
+      catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
+
+  - id: install-kamel-cluster-setup
+    name: Install Kamel Cluster Setup
+    uses: ./.github/actions/kamel-install-cluster-setup
+    with:
+      kube-admin-user-ctx: ${{ steps.config-cluster.outputs.cluster-kube-admin-user-ctx }}
+
+  - id: preflight-test
+    name: Preflight Check Test
+    uses: ./.github/actions/kamel-preflight-test
+    with:
+      catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }}
+      catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
+      image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
+      image-registry-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+      image-name: ${{ steps.build-kamel.outputs.build-binary-local-image-name }}
+      image-registry-insecure: ${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
+      image-version: ${{ steps.build-kamel.outputs.build-binary-local-image-version }}
+
+  - id: install-global-operator
+    name: "Install Global Operator"
+    if: ${{ steps.config-cluster.outputs.cluster-global-operator-namespace }}
+    uses: ./.github/actions/kamel-install-global-operator
+    with:
+      global-operator-namespace: ${{ steps.config-cluster.outputs.cluster-global-operator-namespace }}
+      catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }}
+      catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
+      image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
+      image-registry-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+      image-name: ${{ steps.build-kamel.outputs.build-binary-local-image-name }}
+      image-registry-insecure: ${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
+      image-version: ${{ steps.build-kamel.outputs.build-binary-local-image-version }}
+
+  - name: Install OTLP Collector
+    uses: ./.github/actions/kamel-install-otlp-collector
+    with:
+      otlp-collector-image-name: otel/opentelemetry-collector
+      otlp-collector-image-version: 0.68.0
+
+  - id: report-problematic
+    name: List Tests Marked As Problematic
+    uses: ./.github/actions/kamel-report-problematic
+    with:
+      test-suite: global/common
+
+  - id: run-it
+    name: Run IT
+    shell: bash
+    run: |
+      ./.github/actions/e2e-telemetry/exec-tests.sh \
+        -b "${{ steps.config-cluster.outputs.cluster-catalog-source-name }}" \
+        -c "${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}" \
+        -g "${{ steps.config-cluster.outputs.cluster-global-operator-namespace }}" \
+        -i "${{ steps.config-cluster.outputs.cluster-image-namespace }}" \
+        -l "${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}" \
+        -n "${{ steps.build-kamel.outputs.build-binary-local-image-name }}" \
+        -q "${{ env.CAMEL_K_LOG_LEVEL }}" \
+        -s "${{steps.config-cluster.outputs.cluster-image-registry-insecure }}" \
+        -v "${{ steps.build-kamel.outputs.build-binary-local-image-version }}" \
+        -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}"
+
+  - name: Cleanup
+    uses: ./.github/actions/kamel-cleanup
+    if: ${{ always() }}
+    with:
+      catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }}
+      catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
+      image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
+      global-operator-namespace: ${{ steps.config-cluster.outputs.cluster-global-operator-namespace }}
diff --git a/.github/actions/e2e-telemetry/exec-tests.sh b/.github/actions/e2e-telemetry/exec-tests.sh
new file mode 100755
index 000000000..92ba0a7c4
--- /dev/null
+++ b/.github/actions/e2e-telemetry/exec-tests.sh
@@ -0,0 +1,141 @@
+#!/bin/bash
+
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+####
+#
+# Execute the telemetry tests
+#
+####
+
+set -e
+
+while getopts ":b:c:g:i:l:n:q:s:v:x:" opt; do
+  case "${opt}" in
+    b)
+      BUILD_CATALOG_SOURCE_NAME=${OPTARG}
+      ;;
+    c)
+      BUILD_CATALOG_SOURCE_NAMESPACE=${OPTARG}
+      ;;
+    g)
+      GLOBAL_OPERATOR_NAMESPACE=${OPTARG}
+      ;;
+    i)
+      IMAGE_NAMESPACE=${OPTARG}
+      ;;
+    l)
+      REGISTRY_PULL_HOST=${OPTARG}
+      ;;
+    n)
+      IMAGE_NAME=${OPTARG}
+      ;;
+    q)
+      LOG_LEVEL=${OPTARG}
+      ;;
+    s)
+      REGISTRY_INSECURE=${OPTARG}
+      ;;
+    v)
+      IMAGE_VERSION=${OPTARG}
+      ;;
+    x)
+      SAVE_FAILED_TEST_NS=${OPTARG}
+      ;;
+    :)
+      echo "ERROR: Option -$OPTARG requires an argument"
+      exit 1
+      ;;
+    \?)
+      echo "ERROR: Invalid option -$OPTARG"
+      exit 1
+      ;;
+  esac
+done
+shift $((OPTIND-1))
+
+if [ -z "${IMAGE_NAME}" ]; then
+  echo "Error: local-image-name not defined"
+  exit 1
+fi
+
+if [ -z "${IMAGE_VERSION}" ]; then
+  echo "Error: local-image-version not defined"
+  exit 1
+fi
+
+if [ -z "${IMAGE_NAMESPACE}" ]; then
+  echo "Error: image-namespace not defined"
+  exit 1
+fi
+
+if [ -z "${REGISTRY_PULL_HOST}" ]; then
+  echo "Error: image-registry-pull-host not defined"
+  exit 1
+fi
+
+if [ -z "${REGISTRY_INSECURE}" ]; then
+  echo "Error: image-registry-insecure not defined"
+  exit 1
+fi
+
+# Cluster environment
+export CUSTOM_IMAGE=${IMAGE_NAME}
+export CUSTOM_VERSION=${IMAGE_VERSION}
+
+#
+# If bundle has been built and installed then use it
+#
+if [ -n "${BUILD_CATALOG_SOURCE_NAMESPACE}" ]; then
+  export KAMEL_INSTALL_OLM_SOURCE=${BUILD_CATALOG_SOURCE_NAME}
+  export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${BUILD_CATALOG_SOURCE_NAMESPACE}
+  export KAMEL_INSTALL_OLM_CHANNEL="${NEW_XY_CHANNEL}"
+fi
+
+export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+export KAMEL_INSTALL_REGISTRY=${REGISTRY_PULL_HOST}
+export KAMEL_INSTALL_REGISTRY_INSECURE=${REGISTRY_INSECURE}
+export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
+
+# Will only have an effect if olm=false
+# since, for OLM, the csv determines the policy
+# (see kamel-build-bundle/build-bundle-image.sh)
+export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
+
+export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}"
+if [ "${LOG_LEVEL}" == "debug" ]; then
+  export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}"
+fi
+export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
+export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
+export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS}
+
+if [ -n "${GLOBAL_OPERATOR_NAMESPACE}" ]; then
+  echo "Info: Tests being run using global operator"
+  export CAMEL_K_FORCE_GLOBAL_TEST=true
+  export CAMEL_K_GLOBAL_OPERATOR_NS="${GLOBAL_OPERATOR_NAMESPACE}"
+fi
+
+# Then run all integration telemetry test rather than ending on first failure
+set -e
+exit_code=0
+DO_TEST_PREBUILD=false make test-telemetry || exit_code=1
+set +e
+
+echo "Tests completed with exit code: ${exit_code}"
+exit ${exit_code}
diff --git a/.github/actions/kamel-cleanup/action.yaml b/.github/actions/kamel-cleanup/action.yaml
index f54c4407e..3a937787f 100644
--- a/.github/actions/kamel-cleanup/action.yaml
+++ b/.github/actions/kamel-cleanup/action.yaml
@@ -57,6 +57,13 @@ runs:
       run: |
         ./.github/actions/kamel-cleanup/clean-operator-groups.sh
 
+    - id: remove-telemetry-resources
+      name: Remove Installed Telemetry Resources
+      shell: bash
+      if: ${{ always() }}
+      run: |
+        ./.github/actions/kamel-cleanup/clean-telemetry-resources.sh
+
     - id: remove-installed-kamel
       name: Remove Installed Kamel
       shell: bash
diff --git a/.github/actions/kamel-cleanup/clean-telemetry-resources.sh b/.github/actions/kamel-cleanup/clean-telemetry-resources.sh
new file mode 100755
index 000000000..619dbe528
--- /dev/null
+++ b/.github/actions/kamel-cleanup/clean-telemetry-resources.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+#
+# Remove any telemetry groups resources that might have been deployed for tests.
+# All the telemetry resources are deployed in otlp namespace.
+#
+
+set +e
+
+#
+# Find if the namespace containing telemetry resources exists
+#
+namespace_otlp=$(kubectl --ignore-not-found=true get namespaces otlp)
+if [ -z "${namespace_otlp}" ]; then
+  echo "No telemetry resource installed"
+  exit 0
+fi
+
+echo "Telemetry namespace exists: ${namespace_otlp}"
+
+#
+# Delete telemetry resources namespace
+#
+kubectl delete --now --timeout=600s namespace ${namespace_otlp} 1> /dev/null
+
+echo "Telemetry resources deleted"
\ No newline at end of file
diff --git a/.github/actions/kamel-install-otlp-collector/action.yml b/.github/actions/kamel-install-otlp-collector/action.yml
new file mode 100644
index 000000000..b16310457
--- /dev/null
+++ b/.github/actions/kamel-install-otlp-collector/action.yml
@@ -0,0 +1,117 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+name: kamel-install-otlp-collector
+description: 'Install opentelemetry OTLP collector'
+
+
+inputs:
+  otlp-collector-image-name:
+    description: "The OTLP collector image name"
+    required: true
+  otlp-collector-image-version:
+    description: "The OTLP collector image version"
+    required: true
+runs:
+  using: "composite"
+  steps:
+    - id: install-otlp-collector
+      name: Install opentelemetry OTLP Collector
+      shell: bash
+      run: |
+        # Create namespace otlp
+        cat <<EOF | kubectl apply -f -
+        apiVersion: v1
+        kind: Namespace
+        metadata:
+          name: otlp
+        EOF
+
+        # Add collector configuration : basic otlp grpc reciever to logging
+        cat <<EOF | kubectl apply -n otlp -f -
+        kind: ConfigMap
+        apiVersion: v1
+        metadata:
+          name: collector-config
+        data:
+          collector.yaml: |
+            receivers:
+              otlp:
+                protocols: 
+                  grpc:
+            processors:
+              batch:
+            exporters:
+              logging:
+                verbosity: detailed
+            service:
+              pipelines:
+                traces:
+                  receivers: [otlp]
+                  processors: [batch]
+                  exporters: [logging]
+        EOF
+
+        # Deployment for opentelemetry collector
+        cat <<EOF | kubectl apply -n otlp -f -
+        kind: Deployment
+        apiVersion: apps/v1
+        metadata:
+          name: opentelemetrycollector
+        spec:
+          replicas: 1
+          selector:
+            matchLabels:
+              app.kubernetes.io/name: opentelemetrycollector
+          template:
+            metadata:
+              labels:
+                app.kubernetes.io/name: opentelemetrycollector
+            spec:
+              containers:
+              - name: otelcol
+                args:
+                - --config=/conf/collector.yaml
+                image: ${{ inputs.otlp-collector-image-name }}:${{ inputs.otlp-collector-image-version }}
+                volumeMounts:
+                - mountPath: /conf
+                  name: collector-config
+              volumes:
+              - configMap:
+                  items:
+                  - key: collector.yaml
+                    path: collector.yaml
+                  name: collector-config
+                name: collector-config
+        EOF
+
+        # Add service with grpc access for opentelemetry collector
+        cat <<EOF | kubectl apply -n otlp -f -
+        kind: Service
+        apiVersion: v1
+        metadata:
+          name: opentelemetrycollector
+        spec:
+          ports:
+          - name: grpc-otlp
+            port: 4317
+            protocol: TCP
+            targetPort: 4317
+          selector:
+            app.kubernetes.io/name: opentelemetrycollector
+          type: ClusterIP
+        EOF
diff --git a/.github/workflows/telemetry.yml b/.github/workflows/telemetry.yml
new file mode 100644
index 000000000..d227faba3
--- /dev/null
+++ b/.github/workflows/telemetry.yml
@@ -0,0 +1,94 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+name: telemetry
+
+env:
+  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+on:
+  pull_request:
+    branches:
+      - main
+      - "release-*"
+    paths-ignore:
+      - 'docs/**'
+      - 'proposals/**'
+      - '**.adoc'
+      - '**.md'
+      - 'KEYS'
+      - 'LICENSE'
+      - 'NOTICE'
+  push:
+    branches:
+      - main
+      - "release-*"
+    paths-ignore:
+      - 'docs/**'
+      - 'proposals/**'
+      - '**.adoc'
+      - '**.md'
+      - 'KEYS'
+      - 'LICENSE'
+      - 'NOTICE'
+  workflow_dispatch:
+    inputs:
+      log-level:
+        description: 'Set the operator log level (info or debug)'
+        required: false
+      pre-built-kamel-image:
+        description: 'Kamel image url for skipping building of kamel stages. Used for debugging'
+        required: false
+      skip-problematic:
+        description: 'Whether tests marked as problematic should be skipped - false by default (sets CAMEL_K_TEST_SKIP_PROBLEMATIC)'
+        required: false
+        default: false
+      test-filters:
+        description: |
+          Filter the tests in this test suite by assigning the test pattern to TEST_TELEMETRY_RUN,
+          eg. TEST_TELEMETRY_RUN=TestBasic will only run tests prefixed with 'TestBasic'
+        required: false
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
+jobs:
+  telemetry-it:
+
+    runs-on: ubuntu-20.04
+
+    steps:
+    - name: Checkout code
+      uses: actions/checkout@v2
+      with:
+        persist-credentials: false
+        submodules: recursive
+    - name: Convert input parameters to env vars
+      shell: bash
+      run: |
+        ./.github/workflows/manual-exec-process-inputs.sh \
+          -i "${{ github.event.inputs.pre-built-kamel-image }}" \
+          -p "${{ github.event.inputs.skip-problematic }}" \
+          -q "${{ github.event.inputs.log-level }}" \
+          -t "${{ github.event.inputs.test-filters }}"
+
+    - name: Execute Tests
+      uses: ./.github/actions/e2e-telemetry
+      with:
+        cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
+        cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }}
diff --git a/e2e/global/telemetry/files/rest-consumer.yaml b/e2e/global/telemetry/files/rest-consumer.yaml
new file mode 100644
index 000000000..b7b8e26bb
--- /dev/null
+++ b/e2e/global/telemetry/files/rest-consumer.yaml
@@ -0,0 +1,29 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+- rest:
+    get:
+      - to: "direct:start"
+        path: "/customers/{name}"
+
+- from:
+    uri: "direct:start"
+    steps:
+      - log:
+          message: "get ${header.name}"
+      - set-body:
+          simple: "${header.name} Doe"
diff --git a/e2e/global/telemetry/files/rest-producer.yaml b/e2e/global/telemetry/files/rest-producer.yaml
new file mode 100644
index 000000000..1693bee72
--- /dev/null
+++ b/e2e/global/telemetry/files/rest-producer.yaml
@@ -0,0 +1,24 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+- from:
+    uri: "timer:tick"
+    steps:
+      - to:
+          uri: "http:{{serviceName}}/customers/{{name}}"
+      - log:
+          message: "${body}"
diff --git a/e2e/global/telemetry/telemetry_test.go b/e2e/global/telemetry/telemetry_test.go
new file mode 100644
index 000000000..50623f72e
--- /dev/null
+++ b/e2e/global/telemetry/telemetry_test.go
@@ -0,0 +1,73 @@
+//go:build integration
+// +build integration
+
+// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
+
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package telemetry
+
+import (
+	"fmt"
+	"testing"
+
+	. "github.com/onsi/gomega"
+
+	corev1 "k8s.io/api/core/v1"
+
+	. "github.com/apache/camel-k/e2e/support"
+)
+
+func TestTelemetryTrait(t *testing.T) {
+	WithNewTestNamespace(t, func(ns string) {
+		operatorID := "camel-k-trait-telemetry"
+		Expect(KamelInstallWithID(operatorID, ns).Execute()).To(Succeed())
+
+		// Check service is available
+		Eventually(ServicesByType("otlp", corev1.ServiceTypeClusterIP), TestTimeoutLong).ShouldNot(BeEmpty())
+
+		// Create integration and activate traces by telemetry trait
+
+		Expect(KamelRunWithID(operatorID, ns, "files/rest-consumer.yaml",
+			"--name", "rest-consumer",
+			"-t", "telemetry.enabled=true",
+			"-t", "telemetry.endpoint=http://opentelemetrycollector.otlp.svc.cluster.local:4317").Execute()).To(Succeed())
+		Eventually(IntegrationPodPhase(ns, "rest-consumer"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+
+		name := "Bob"
+		Expect(KamelRunWithID(operatorID, ns, "files/rest-producer.yaml",
+			"-p", "serviceName=rest-consumer",
+			"-p", "name="+name,
+			"--name", "rest-producer").Execute()).To(Succeed())
+		Eventually(IntegrationPodPhase(ns, "rest-producer"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+		Eventually(IntegrationLogs(ns, "rest-consumer"), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("get %s", name)))
+		Eventually(IntegrationLogs(ns, "rest-producer"), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("%s Doe", name)))
+
+		// Find opentelemetrycollector pod : the exporter is configured to log traces with detailed verborsity.
+		pod, err := Pod("otlp", "opentelemetrycollector")()
+		Expect(err).To(BeNil())
+		Expect(pod).NotTo(BeNil())
+
+		// Ensured logs in opentelemetrycollector pod are present
+		Eventually(TailedLogs(pod.Namespace, pod.Name, 100), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("http.target: Str(/customers/%s)", name)))
+		Eventually(TailedLogs(pod.Namespace, pod.Name, 100), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("http.url: Str(http://rest-consumer/customers/%s)", name)))
+
+		// Clean up
+		Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
+	})
+}
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 21c565c04..e4bee4913 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -445,6 +445,17 @@ func IntegrationLogs(ns, name string) func() string {
 	}
 }
 
+// Retrieve the Logs from the Pod defined by its name in the given namespace ns. The number of lines numLines from the end of the logs to show.
+func TailedLogs(ns, name string, numLines int64) func() string {
+	return func() string {
+		options := corev1.PodLogOptions{
+			TailLines: pointer.Int64(numLines),
+		}
+
+		return Logs(ns, name, options)()
+	}
+}
+
 func Logs(ns, podName string, options corev1.PodLogOptions) func() string {
 	return func() string {
 		byteReader, err := TestClient().CoreV1().Pods(ns).GetLogs(podName, &options).Stream(TestContext)
@@ -1679,6 +1690,29 @@ func OperatorPod(ns string) func() *corev1.Pod {
 	}
 }
 
+// Find one Pod filtered by namespace ns and label app.kubernetes.io/name value appName.
+func Pod(ns string, appName string) func() (*corev1.Pod, error) {
+	return func() (*corev1.Pod, error) {
+		lst := corev1.PodList{
+			TypeMeta: metav1.TypeMeta{
+				Kind:       "Pod",
+				APIVersion: v1.SchemeGroupVersion.String(),
+			},
+		}
+		if err := TestClient().List(TestContext, &lst,
+			ctrl.InNamespace(ns),
+			ctrl.MatchingLabels{
+				"app.kubernetes.io/name": appName,
+			}); err != nil {
+			return nil, err
+		}
+		if len(lst.Items) == 0 {
+			return nil, nil
+		}
+		return &lst.Items[0], nil
+	}
+}
+
 func OperatorTryPodForceKill(ns string, timeSeconds int) {
 	pod := OperatorPod(ns)()
 	if pod != nil {
diff --git a/script/Makefile b/script/Makefile
index 7aa12f790..6ee04db5a 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -289,6 +289,10 @@ test-service-binding: do-build
 	STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
 	go test -timeout 90m -v ./e2e/global/service-binding -tags=integration $(TEST_SERVICE_RUN) -json 2>&1 | gotestfmt
 
+test-telemetry: do-build
+	STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
+	go test -timeout 90m -v ./e2e/global/telemetry -tags=integration $(TEST_TELEMETRY_RUN) -json 2>&1 | gotestfmt
+
 test-local: do-build
 	STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
 	RUNTIME_VERSION="$(RUNTIME_VERSION)" \