Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/modules/ROOT/partials/apis/camel-k-crds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9260,6 +9260,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.


Expand Down
85 changes: 85 additions & 0 deletions docs/modules/traits/pages/telemetry.adoc
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
= 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)

[WARNING]
====
The Telemetry trait is *deprecated* as of version 2.9.0 and will be removed in a future release.

The same behavior can be achieved via properties and dependencies configuration. See the <<migration-guide>> section below for details.
====

// 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 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.


Expand Down Expand Up @@ -82,3 +100,70 @@ $ kamel run -t telemetry.enable=true -t telemetry.service-name=tracer_myintegrat
+
[source,console]
$ kamel run -t telemetry.enable=true -t telemetry.sampler=ratio -t telemetry.sampler-ratio=0.001 ...

[[migration-guide]]
== Migration Guide

The Telemetry trait is deprecated. The same behavior can be achieved via properties and dependencies configuration.

=== Property Mapping

The following table shows how to map Telemetry trait properties to application properties:

[cols="2m,2m,3a"]
|===
|Telemetry Trait | Application Property | Example

| telemetry.endpoint=http://jaeger:4317
| quarkus.otel.exporter.otlp.traces.endpoint=http://jaeger:4317
| `kamel run -p quarkus.otel.exporter.otlp.traces.endpoint=http://jaeger:4317 MyRoute.java`

| telemetry.service-name=my-service
| quarkus.otel.resource.attributes=service.name=my-service
| `kamel run -p quarkus.otel.resource.attributes=service.name=my-service MyRoute.java`

| telemetry.sampler=ratio
| quarkus.otel.traces.sampler=ratio
| `kamel run -p quarkus.otel.traces.sampler=ratio MyRoute.java`

| telemetry.sampler-ratio=0.001
| quarkus.otel.traces.sampler.ratio=0.001
| `kamel run -p quarkus.otel.traces.sampler.ratio=0.001 MyRoute.java`

| telemetry.sampler-parent-based=true
| quarkus.otel.traces.sampler.parent-based=true
| `kamel run -p quarkus.otel.traces.sampler.parent-based=true MyRoute.java`

|===

=== Migration Examples

**Before (deprecated):**

[source,console]
----
$ kamel run -t telemetry.enabled=true \
-t telemetry.endpoint=http://jaeger:4317 \
-t telemetry.service-name=my-integration \
MyRoute.java
----

**After (recommended):**

[source,console]
----
$ kamel run \
--dependency camel:opentelemetry \
-p quarkus.otel.exporter.otlp.traces.endpoint=http://jaeger:4317 \
-p quarkus.otel.resource.attributes=service.name=my-integration \
MyRoute.java
----

NOTE: The `--dependency camel:opentelemetry` is required. Previously, the telemetry trait automatically added this dependency via the `camel-k:telemetry` capability. With direct configuration, you must explicitly include the OpenTelemetry dependency.

=== Benefits of Direct Configuration

Using properties and dependencies configuration directly provides more flexibility, including:

* Full access to all Quarkus OpenTelemetry options: https://quarkus.io/guides/opentelemetry
* Custom telemetry dependencies can be added as needed
2 changes: 1 addition & 1 deletion e2e/common/cli/files/JavaDuplicateParams.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// camel-k: language=java trait=telemetry.enabled=false trait=affinity.enabled=true property=prop1=false property=foo=bar
// camel-k: language=java trait=container.enabled=true trait=affinity.enabled=true property=prop1=false property=foo=bar

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
Expand Down
6 changes: 3 additions & 3 deletions e2e/telemetry/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ func TestTelemetryTrait(t *testing.T) {
// Check service is available
g.Eventually(ServicesByType(t, ctx, "otlp", corev1.ServiceTypeClusterIP), TestTimeoutLong).ShouldNot(BeEmpty())

// Create integration and activate traces by telemetry trait
// Create integration and activate traces using OpenTelemetry properties and dependency
g.Expect(KamelRun(t, ctx, ns,
"files/rest-consumer.yaml", "--name", "rest-consumer",
"-t", "telemetry.enabled=true",
"-t", "telemetry.endpoint=http://opentelemetrycollector.otlp:4317").Execute()).To(Succeed())
"--dependency", "camel:opentelemetry",
"-p", "quarkus.otel.exporter.otlp.traces.endpoint=http://opentelemetrycollector.otlp:4317").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, "rest-consumer"), TestTimeoutLong).Should(Equal(corev1.PodRunning))

name := "Bob"
Expand Down
9 changes: 9 additions & 0 deletions pkg/apis/camel/v1/trait/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand Down
10 changes: 9 additions & 1 deletion pkg/trait/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 22 additions & 3 deletions pkg/trait/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
}
Loading