// DO NOT EDIT; THIS FILE IS AUTOGENERATED FROM ../../../metrics.proto
syntax = "proto3";

package lightstep.metrics;

option go_package = "metricspb";
option objc_class_prefix = "LSPB";
option java_multiple_files = true;
option java_package = "com.lightstep.tracer.grpc";

import "github.com/lightstep/lightstep-tracer-common/golang/protobuf/collectorpb/collector.proto";
import "google/api/annotations.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

// MetricKind indicates the semantics of the points (i.e. how to interpret values
// relative to each other).
enum MetricKind {
    // InvalidMetricKind is the default value for the MetricKind. Some languages' proto compilers
    // (e.g. Go) return the default if no value is set. The default is marked invalid here to
    // avoid a common mistake where a field is left unset and appears to be set to the default.
    INVALID_METRIC_KIND = 0;

    // Counter metrics measure change over an interval.
    // When aggregated, counter metrics are usually added.
    COUNTER = 1;

    // Gauge metrics measure the value at a point in time.
    // When aggregated, intermediate values are often dropped for the latest value.
    GAUGE = 2;
}

// MetricPoint is an update to a single measure.
message MetricPoint {
    // Kind indicates the semantics of this point. Kind should always be the same for a given metric
    // name (e.g. "cpu.usage" should always have the same kind)
    MetricKind kind = 1;

    // MetricName indicates the metric being emitted.
    string metric_name = 2;

    // Start of the interval for which the points represent.
    // - All Counter points will be assumed to represent the entire interval.
    // - All Gauge points will be assumed to be instantaneous at the start of the interval.
    google.protobuf.Timestamp start = 3;

    // Duration of the interval for which the points represent. The end of the interval is start + duration.
    // We expect this value to be unset or zero for Gauge points.
    google.protobuf.Duration duration = 4;

    // Labels contain labels specific to this point.
    repeated collector.KeyValue labels = 5;

    // Value represents the update being emitted. Values can be one of two types: uint64 or double.
    // The type of the value should always be the same for a given metric name (e.g. "cpu.usage"
    // should always have value type double).
    oneof value {
        uint64 uint64_value = 6;

        double double_value = 7;
    }
}

// IngestRequest is an update to one or more measures.
message IngestRequest {
    // IdempotencyKey is a random string that should uniquely identify this report.
    // It should be generated once and used for all retries. The server will use it
    // to de-duplicate requests.
    string idempotency_key = 1;

    // Reporter contains information to identify the specific originator of this report.
    lightstep.collector.Reporter reporter = 2;

    // Points contain the individual updates.
    repeated MetricPoint points = 3;
}

// IngestResponse is reserved for future use.
message IngestResponse {}

service MetricsService {
    rpc Report(IngestRequest) returns (IngestResponse) {
        option (google.api.http) = {
            post: "/metrics"
            body: "*"
        };
    }
}
