syntax = "proto3";

package envoy.extensions.tracers.fluentd.v3;

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

import "google/protobuf/duration.proto";
import "google/protobuf/wrappers.proto";

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

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

// [#protodoc-title: Fluentd tracer]

// Configuration for the Fluentd tracer.
// This tracer extension will send the emitted traces over a TCP connection to an upstream that is accepting
// the Fluentd Forward Protocol as described in: `Fluentd Forward Protocol Specification
// <https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1>`_.
// [#extension: envoy.tracers.fluentd]
// [#next-free-field: 7]
message FluentdConfig {
  // The upstream cluster to connect to for streaming the Fluentd messages.
  string cluster = 1 [(validate.rules).string = {min_len: 1}];

  // A tag is a string separated with ``.`` (e.g. ``log.type``) to categorize events.
  // See: https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1#message-modes
  string tag = 2 [(validate.rules).string = {min_len: 1}];

  // The prefix to use when emitting tracer stats.
  string stat_prefix = 3 [(validate.rules).string = {min_len: 1}];

  // Interval for flushing traces to the TCP stream. Tracer will flush requests every time
  // this interval is elapsed, or when batch size limit is hit, whichever comes first. Defaults to
  // 1 second.
  google.protobuf.Duration buffer_flush_interval = 4 [(validate.rules).duration = {gt {}}];

  // Soft size limit in bytes for access log entries buffer. The logger will buffer requests until
  // this limit it hit, or every time flush interval is elapsed, whichever comes first. When the buffer
  // limit is hit, the logger will immediately flush the buffer contents. Setting it to zero effectively
  // disables the batching. Defaults to 16384.
  google.protobuf.UInt32Value buffer_size_bytes = 5;

  // Optional retry, in case upstream connection has failed. If this field is not set, the default values will be applied.
  config.core.v3.RetryPolicy retry_policy = 6;
}
