// Copyright 2025 Envoy Project Authors
//
// Licensed 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.

syntax = "proto3";

package envoy.config.trace.v3;

import "google/protobuf/duration.proto";

import "udpa/annotations/migrate.proto";
import "udpa/annotations/status.proto";
import "udpa/annotations/versioning.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.config.trace.v3";
option java_outer_classname = "DatadogProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/config/trace/v3;tracev3";
option (udpa.annotations.file_migrate).move_to_package = "envoy.extensions.tracers.datadog.v4alpha";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Datadog tracer]

// Configuration for the Remote Configuration feature.
message DatadogRemoteConfig {
  // Frequency at which new configuration updates are queried.
  // If no value is provided, the default value is delegated to the Datadog tracing library.
  google.protobuf.Duration polling_interval = 1;
}

// Configuration for the Datadog tracer.
// [#extension: envoy.tracers.datadog]
message DatadogConfig {
  option (udpa.annotations.versioning).previous_message_type =
      "envoy.config.trace.v2.DatadogConfig";

  // The cluster to use for submitting traces to the Datadog agent.
  string collector_cluster = 1 [(validate.rules).string = {min_len: 1}];

  // The name used for the service when traces are generated by envoy.
  string service_name = 2 [(validate.rules).string = {min_len: 1}];

  // Optional hostname to use when sending spans to the collector_cluster. Useful for collectors
  // that require a specific hostname. Defaults to :ref:`collector_cluster <envoy_v3_api_field_config.trace.v3.DatadogConfig.collector_cluster>` above.
  string collector_hostname = 3;

  // Enables and configures remote configuration.
  // Remote Configuration allows to configure the tracer from Datadog's user interface.
  // This feature can drastically increase the number of connections to the Datadog Agent.
  // Each tracer regularly polls for configuration updates, and the number of tracers is the product
  // of the number of listeners and worker threads.
  DatadogRemoteConfig remote_config = 4;
}
