syntax = "proto3";

package envoy.extensions.stat_sinks.open_telemetry.v3;

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

import "google/protobuf/wrappers.proto";

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

option java_package = "io.envoyproxy.envoy.extensions.stat_sinks.open_telemetry.v3";
option java_outer_classname = "OpenTelemetryProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/stat_sinks/open_telemetry/v3;open_telemetryv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Open Telemetry Stats Sink]
// Stats configuration proto schema for ``envoy.stat_sinks.open_telemetry`` sink.
// [#extension: envoy.stat_sinks.open_telemetry]

// [#next-free-field: 7]
message SinkConfig {
  oneof protocol_specifier {
    option (validate.required) = true;

    // The upstream gRPC cluster that implements the OTLP/gRPC collector.
    config.core.v3.GrpcService grpc_service = 1 [(validate.rules).message = {required: true}];
  }

  // If set to true, counters will be emitted as deltas, and the OTLP message will have
  // ``AGGREGATION_TEMPORALITY_DELTA`` set as AggregationTemporality.
  bool report_counters_as_deltas = 2;

  // If set to true, histograms will be emitted as deltas, and the OTLP message will have
  // ``AGGREGATION_TEMPORALITY_DELTA`` set as AggregationTemporality.
  bool report_histograms_as_deltas = 3;

  // If set to true, metrics will have their tags emitted as OTLP attributes, which may
  // contain values used by the tag extractor or additional tags added during stats creation.
  // Otherwise, no attributes will be associated with the export message. Default value is true.
  google.protobuf.BoolValue emit_tags_as_attributes = 4;

  // If set to true, metric names will be represented as the tag extracted name instead
  // of the full metric name. Default value is true.
  google.protobuf.BoolValue use_tag_extracted_name = 5;

  // If set, emitted stats names will be prepended with a prefix, so full stat name will be
  // <prefix>.<stats_name>. For example, if the stat name is "foo.bar" and prefix is
  // "pre", the full stat name will be "pre.foo.bar". If this field is not set, there is no
  // prefix added. According to the example, the full stat name will remain "foo.bar".
  string prefix = 6;
}
