istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pilot/pkg/features/telemetry.go (about)

     1  // Copyright Istio Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package features
    16  
    17  import (
    18  	"time"
    19  
    20  	"istio.io/istio/pkg/env"
    21  	"istio.io/istio/pkg/log"
    22  )
    23  
    24  // Define telemetry related features here.
    25  var (
    26  	traceSamplingVar = env.Register(
    27  		"PILOT_TRACE_SAMPLING",
    28  		1.0,
    29  		"Sets the mesh-wide trace sampling percentage. Should be 0.0 - 100.0. Precision to 0.01. "+
    30  			"Default is 1.0.",
    31  	)
    32  
    33  	TraceSampling = func() float64 {
    34  		f := traceSamplingVar.Get()
    35  		if f < 0.0 || f > 100.0 {
    36  			log.Warnf("PILOT_TRACE_SAMPLING out of range: %v", f)
    37  			return 1.0
    38  		}
    39  		return f
    40  	}()
    41  
    42  	EnableTelemetryLabel = env.Register("PILOT_ENABLE_TELEMETRY_LABEL", true,
    43  		"If true, pilot will add telemetry related metadata to cluster and endpoint resources, which will be consumed by telemetry filter.",
    44  	).Get()
    45  
    46  	EndpointTelemetryLabel = env.Register("PILOT_ENDPOINT_TELEMETRY_LABEL", true,
    47  		"If true, pilot will add telemetry related metadata to Endpoint resource, which will be consumed by telemetry filter.",
    48  	).Get()
    49  
    50  	MetadataExchange = env.Register("PILOT_ENABLE_METADATA_EXCHANGE", true,
    51  		"If true, pilot will add metadata exchange filters, which will be consumed by telemetry filter.",
    52  	).Get()
    53  
    54  	// This is an experimental feature flag, can be removed once it became stable, and should introduced to Telemetry API.
    55  	MetricRotationInterval = env.Register("METRIC_ROTATION_INTERVAL", 0*time.Second,
    56  		"Metric scope rotation interval, set to 0 to disable the metric scope rotation").Get()
    57  	MetricGracefulDeletionInterval = env.Register("METRIC_GRACEFUL_DELETION_INTERVAL", 5*time.Minute,
    58  		"Metric expiry graceful deletion interval. No-op if METRIC_ROTATION_INTERVAL is disabled.").Get()
    59  
    60  	EnableControllerQueueMetrics = env.Register("ISTIO_ENABLE_CONTROLLER_QUEUE_METRICS", false,
    61  		"If enabled, publishes metrics for queue depth, latency and processing times.").Get()
    62  
    63  	// User should not rely on builtin resource labels, this flag will be removed in future releases(1.20).
    64  	EnableOTELBuiltinResourceLabels = env.Register("ENABLE_OTEL_BUILTIN_RESOURCE_LABELS", false,
    65  		"If enabled, envoy will send builtin labels(e.g. node_name) via OTel sink.").Get()
    66  
    67  	StackdriverAuditLog = env.Register("STACKDRIVER_AUDIT_LOG", false, ""+
    68  		"If enabled, StackDriver audit logging will be enabled.").Get()
    69  )