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 bae41bc14490d8f390e5886a35edfc72f1132529
Author: Pranjul Kalsi <[email protected]>
AuthorDate: Fri Dec 12 15:23:56 2025 +0530

    chore(trait): deprecate telemetry trait in favor of properties configuration
---
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc |  8 ++++++++
 docs/modules/traits/pages/telemetry.adoc          | 10 +++++++++
 pkg/apis/camel/v1/trait/telemetry.go              |  9 ++++++++
 pkg/trait/telemetry.go                            | 10 ++++++++-
 pkg/trait/telemetry_test.go                       | 25 ++++++++++++++++++++---
 5 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc 
b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index 3c1ed57e3..511522034 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -9268,6 +9268,14 @@ The trait is able to automatically discover the 
telemetry OTLP endpoint availabl
 
 The Telemetry trait is disabled by default.
 
+WARNING: The Telemetry trait is **deprecated** and will be removed in future 
release versions.
+The same behavior can be achieved via properties and dependencies 
configuration.
+
+Migration example:
+
+       Before: --trait telemetry.endpoint=http://jaeger:4317
+       After:  -p quarkus.otel.exporter.otlp.traces.endpoint=http://jaeger:4317
+
 WARNING: The Telemetry trait can't be enabled at the same time as the Tracing 
trait.
 
 
diff --git a/docs/modules/traits/pages/telemetry.adoc 
b/docs/modules/traits/pages/telemetry.adoc
index 44f54204e..70abecc87 100644
--- a/docs/modules/traits/pages/telemetry.adoc
+++ b/docs/modules/traits/pages/telemetry.adoc
@@ -1,6 +1,8 @@
 = Telemetry Trait
 
 // Start of autogenerated code - DO NOT EDIT! (badges)
+[.badges]
+[.badge-key]##Deprecated since##[.badge-unsupported]##2.9.0##
 // End of autogenerated code - DO NOT EDIT! (badges)
 // Start of autogenerated code - DO NOT EDIT! (description)
 The Telemetry trait can be used to automatically publish tracing information 
to an OTLP compatible collector.
@@ -9,6 +11,14 @@ The trait is able to automatically discover the telemetry 
OTLP endpoint availabl
 
 The Telemetry trait is disabled by default.
 
+WARNING: The Telemetry trait is **deprecated** and will be removed in future 
release versions.
+The same behavior can be achieved via properties and dependencies 
configuration.
+
+Migration example:
+
+       Before: --trait telemetry.endpoint=http://jaeger:4317
+       After:  -p quarkus.otel.exporter.otlp.traces.endpoint=http://jaeger:4317
+
 WARNING: The Telemetry trait can't be enabled at the same time as the Tracing 
trait.
 
 
diff --git a/pkg/apis/camel/v1/trait/telemetry.go 
b/pkg/apis/camel/v1/trait/telemetry.go
index 1109a2708..7aa023fab 100644
--- a/pkg/apis/camel/v1/trait/telemetry.go
+++ b/pkg/apis/camel/v1/trait/telemetry.go
@@ -23,9 +23,18 @@ package trait
 //
 // The Telemetry trait is disabled by default.
 //
+// WARNING: The Telemetry trait is **deprecated** and will be removed in 
future release versions.
+// The same behavior can be achieved via properties and dependencies 
configuration.
+//
+// Migration example:
+//
+//     Before: --trait telemetry.endpoint=http://jaeger:4317
+//     After:  -p quarkus.otel.exporter.otlp.traces.endpoint=http://jaeger:4317
+//
 // WARNING: The Telemetry trait can't be enabled at the same time as the 
Tracing trait.
 //
 // +camel-k:trait=telemetry.
+// +camel-k:deprecated=2.9.0.
 type TelemetryTrait struct {
        Trait `json:",inline" property:",squash"`
 
diff --git a/pkg/trait/telemetry.go b/pkg/trait/telemetry.go
index 6a82d63b4..39f363726 100644
--- a/pkg/trait/telemetry.go
+++ b/pkg/trait/telemetry.go
@@ -73,7 +73,15 @@ func (t *telemetryTrait) Configure(e *Environment) (bool, 
*TraitCondition, error
                return false, nil, nil
        }
 
-       var condition *TraitCondition
+       // Deprecation warning
+       condition := NewIntegrationCondition(
+               "Telemetry",
+               v1.IntegrationConditionTraitInfo,
+               corev1.ConditionTrue,
+               TraitConfigurationReason,
+               "Telemetry trait is deprecated and may be removed in future 
versions. "+
+                       "Use properties and dependencies configuration 
instead.",
+       )
 
        if !ptr.Deref(t.Auto, true) {
                return true, condition, nil
diff --git a/pkg/trait/telemetry_test.go b/pkg/trait/telemetry_test.go
index d06dd60e4..5155544df 100644
--- a/pkg/trait/telemetry_test.go
+++ b/pkg/trait/telemetry_test.go
@@ -38,7 +38,8 @@ func TestTelemetryTraitOnDefaultQuarkus(t *testing.T) {
        ok, condition, err := telemetry.Configure(e)
        require.NoError(t, err)
        assert.True(t, ok)
-       assert.Nil(t, condition)
+       assert.NotNil(t, condition)
+       assert.Contains(t, condition.message, "Telemetry trait is deprecated")
 
        err = telemetry.Apply(e)
        require.NoError(t, err)
@@ -69,7 +70,8 @@ func TestTelemetryTraitWithValues(t *testing.T) {
        ok, condition, err := telemetry.Configure(e)
        require.NoError(t, err)
        assert.True(t, ok)
-       assert.Nil(t, condition)
+       assert.NotNil(t, condition)
+       assert.Contains(t, condition.message, "Telemetry trait is deprecated")
 
        err = telemetry.Apply(e)
        require.NoError(t, err)
@@ -102,7 +104,8 @@ func TestTelemetryForSelfManagedBuild(t *testing.T) {
        ok, condition, err := telemetry.Configure(e)
        require.NoError(t, err)
        assert.True(t, ok)
-       assert.Nil(t, condition)
+       assert.NotNil(t, condition)
+       assert.Contains(t, condition.message, "Telemetry trait is deprecated")
 
        err = telemetry.Apply(e)
        require.NoError(t, err)
@@ -137,3 +140,19 @@ func createTelemetryEnvironment(t *testing.T, catalogGen 
func() (*camel.RuntimeC
        e.Integration = &it
        return &e
 }
+
+func TestTelemetryTraitDeprecationWarning(t *testing.T) {
+       e := createTelemetryEnvironment(t, camel.QuarkusCatalog)
+       telemetry := NewTelemetryTrait()
+       tt, _ := telemetry.(*telemetryTrait)
+       tt.Enabled = ptr.To(true)
+       tt.Auto = ptr.To(false)
+
+       configured, condition, err := telemetry.Configure(e)
+
+       require.NoError(t, err)
+       assert.True(t, configured)
+       assert.NotNil(t, condition)
+       assert.Contains(t, condition.message, "Telemetry trait is deprecated")
+       assert.Contains(t, condition.message, "properties and dependencies")
+}

Reply via email to