You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2023/01/10 14:59:47 UTC

[GitHub] [camel-k] gansheer opened a new pull request, #3970: feat(trait): Add telemetry trait

gansheer opened a new pull request, #3970:
URL: https://github.com/apache/camel-k/pull/3970

   
   Resolves: #3519
   
   ## Motivation
   
   Add a new addon/trait `telemetry` to provide new default way of for tracing. The current tracing trait based on opentracing is deprecated both in camel-quarkus and quarkus and will be deprecated.
   
   ## Description
   
   The new telemetry trait has been added with the basic configuration:
   * enable : disabled by default
   * auto : Jaeger discovery for OTLP API (more can be added with OTLP compatibility like Opentelemetry or Grafana Tempo)
   * service-name : default to integration name
   * sampler: default to on (alwaysOn), other values from OTLP protocol documentation
   * sampler-ratio: only used in case of `ratio` sampler
   * sampler-parent-bases: if sampler is parent based
   
   Existing e2e test using tracing have been updated to use telemetry.
   
   **Next step** : deprecate tracing trait
   
   
   **Release Note**
   ```release-note
   feat(trait): Add telemetry trait as the new default tracing feature.
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] squakez merged pull request #3970: feat(trait): Add telemetry trait

Posted by GitBox <gi...@apache.org>.
squakez merged PR #3970:
URL: https://github.com/apache/camel-k/pull/3970


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] tadayosi commented on a diff in pull request #3970: feat(trait): Add telemetry trait

Posted by GitBox <gi...@apache.org>.
tadayosi commented on code in PR #3970:
URL: https://github.com/apache/camel-k/pull/3970#discussion_r1066596554


##########
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]

Review Comment:
   It should be `3scale` (small 's'). FYI https://www.3scale.net/



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

Review Comment:
   nitpick: let's write some meaningful comment for new code.
   
   Ideally, we should rewrite every comment like this `// xxxxx --.` from the codebase.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] squakez commented on a diff in pull request #3970: feat(trait): Add telemetry trait

Posted by GitBox <gi...@apache.org>.
squakez commented on code in PR #3970:
URL: https://github.com/apache/camel-k/pull/3970#discussion_r1066715492


##########
addons/tracing/tracing.go:
##########
@@ -27,13 +27,14 @@ import (
 	"github.com/apache/camel-k/pkg/util"
 )
 
-// The Tracing trait can be used to automatically publish tracing information to an
-// OpenTracing compatible collector.
+// 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.

Review Comment:
   I'd take the opportunity and add a deprecation notice at least here, reminding to use Telemetry trait.



##########
docs/modules/traits/pages/telemetry.adoc:
##########
@@ -0,0 +1,60 @@
+= 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)

Review Comment:
   After this autogenerated code (or even in the trait comment section) we could add some example how to use the trait. We did in other traits if you want to have a look https://camel.apache.org/camel-k/1.11.x/traits/toleration.html#_examples



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] squakez commented on a diff in pull request #3970: feat(trait): Add telemetry trait

Posted by GitBox <gi...@apache.org>.
squakez commented on code in PR #3970:
URL: https://github.com/apache/camel-k/pull/3970#discussion_r1066718893


##########
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]

Review Comment:
   If that was autogenerated, I'd suggest to keep it the way it was and report an issue to fix the autogeneration later



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] gansheer commented on pull request #3970: feat(trait): Add telemetry trait

Posted by GitBox <gi...@apache.org>.
gansheer commented on PR #3970:
URL: https://github.com/apache/camel-k/pull/3970#issuecomment-1384992007

   @squakez it's ready on my side. Don't hesitate to take the time to check the e2e test.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] gansheer commented on a diff in pull request #3970: feat(trait): Add telemetry trait

Posted by GitBox <gi...@apache.org>.
gansheer commented on code in PR #3970:
URL: https://github.com/apache/camel-k/pull/3970#discussion_r1066784659


##########
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]

Review Comment:
   Issue created #3972 . 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] gansheer commented on a diff in pull request #3970: feat(trait): Add telemetry trait

Posted by GitBox <gi...@apache.org>.
gansheer commented on code in PR #3970:
URL: https://github.com/apache/camel-k/pull/3970#discussion_r1066701429


##########
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]

Review Comment:
   I changed it back, but that means there's a small bug in the generation script.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] gansheer commented on pull request #3970: feat(trait): Add telemetry trait

Posted by GitBox <gi...@apache.org>.
gansheer commented on PR #3970:
URL: https://github.com/apache/camel-k/pull/3970#issuecomment-1380740670

   > Very nice job! +1 for the new telemetry test suite, it opens the door to further refined testing on observability. Let us know when this is ready to merge as for me it looks already great!
   
   I need to actually he actual testing code (with trace verification) before :sweat_smile: 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org