syntax = "proto3";

package envoy.config.trace.v3;

import "envoy/config/core/v3/grpc_service.proto";

import "google/protobuf/wrappers.proto";

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

option java_package = "io.envoyproxy.envoy.config.trace.v3";
option java_outer_classname = "SkywalkingProto";
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.skywalking.v4alpha";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: SkyWalking tracer]

// Configuration for the SkyWalking tracer. Please note that if SkyWalking tracer is used as the
// provider of http tracer, then
// :ref:`start_child_span <envoy_v3_api_field_extensions.filters.http.router.v3.Router.start_child_span>`
// in the router must be set to true to get the correct topology and tracing data. Moreover, SkyWalking
// Tracer does not support SkyWalking extension header (``sw8-x``) temporarily.
// [#extension: envoy.tracers.skywalking]
message SkyWalkingConfig {
  // SkyWalking collector service.
  core.v3.GrpcService grpc_service = 1 [(validate.rules).message = {required: true}];

  ClientConfig client_config = 2;
}

// Client config for SkyWalking tracer.
message ClientConfig {
  // Service name for SkyWalking tracer. If this field is empty, then local service cluster name
  // that configured by :ref:`Bootstrap node <envoy_v3_api_field_config.bootstrap.v3.Bootstrap.node>`
  // message's :ref:`cluster <envoy_v3_api_field_config.core.v3.Node.cluster>` field or command line
  // option :option:`--service-cluster` will be used. If both this field and local service cluster
  // name are empty, ``EnvoyProxy`` is used as the service name by default.
  string service_name = 1;

  // Service instance name for SkyWalking tracer. If this field is empty, then local service node
  // that configured by :ref:`Bootstrap node <envoy_v3_api_field_config.bootstrap.v3.Bootstrap.node>`
  // message's :ref:`id <envoy_v3_api_field_config.core.v3.Node.id>` field or command line  option
  // :option:`--service-node` will be used. If both this field and local service node are empty,
  // ``EnvoyProxy`` is used as the instance name by default.
  string instance_name = 2;

  // Authentication token config for SkyWalking. SkyWalking can use token authentication to secure
  // that monitoring application data can be trusted. In current version, Token is considered as a
  // simple string.
  // [#comment:TODO(wbpcode): Get backend token through the SDS API.]
  oneof backend_token_specifier {
    // Inline authentication token string.
    string backend_token = 3 [(udpa.annotations.sensitive) = true];
  }

  // Envoy caches the segment in memory when the SkyWalking backend service is temporarily unavailable.
  // This field specifies the maximum number of segments that can be cached. If not specified, the
  // default is 1024.
  google.protobuf.UInt32Value max_cache_size = 4;
}
