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-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org