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

package lightstep.collector;

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

import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

message SpanContext {
    uint64 trace_id = 1 [jstype=JS_STRING];
    uint64 span_id = 2 [jstype=JS_STRING];
    map<string, string> baggage = 3;
}

// Represent both tags and log fields.
message KeyValue {
    string key = 1;
    oneof value {
        // Holds arbitrary string data; well-formed JSON strings should go in
        // json_value.
        string string_value = 2;
        int64 int_value = 3 [jstype=JS_STRING];
        double double_value = 4;
        bool bool_value = 5;
        // Must be a well-formed JSON value. Truncated JSON should go in
        // string_value. Should not be used for tags.
        string json_value = 6;
    }
}

message Log {
    google.protobuf.Timestamp timestamp = 1;
    repeated KeyValue fields = 2;
}

message Reference {
    enum Relationship {
        CHILD_OF = 0;
        FOLLOWS_FROM = 1;
    }
    Relationship relationship = 1;
    SpanContext span_context = 2;
}

message Span {
    SpanContext span_context = 1;
    string operation_name = 2;
    repeated Reference references = 3;
    google.protobuf.Timestamp start_timestamp = 4;
    uint64 duration_micros = 5 [jstype=JS_STRING];
    repeated KeyValue tags = 6;
    repeated Log logs = 7;
}

message Reporter {
    uint64 reporter_id = 1 [jstype=JS_STRING];
    repeated KeyValue tags = 4;
}

message MetricsSample {
    string name = 1;
    oneof value {
        int64 int_value = 2 [jstype=JS_STRING];
        double double_value = 3;
    }
}

message InternalMetrics {
    google.protobuf.Timestamp start_timestamp = 1;
    uint64 duration_micros = 2 [jstype=JS_STRING];
    repeated Log logs = 3;
    repeated MetricsSample counts = 4;
    repeated MetricsSample gauges = 5;
}

message Auth {
    string access_token = 1;
}

message ReportRequest {
    Reporter reporter = 1;
    Auth auth = 2;
    repeated Span spans = 3;
    int64 timestamp_offset_micros = 5 [jstype=JS_STRING];
    InternalMetrics internal_metrics = 6;
}

message Command {
    bool disable = 1;
    bool dev_mode = 2;
}

message ReportResponse {
    repeated Command commands = 1;
    google.protobuf.Timestamp receive_timestamp = 2;
    google.protobuf.Timestamp transmit_timestamp = 3;
    repeated string errors = 4;
    repeated string warnings = 5;
    repeated string infos = 6;
}

service CollectorService {
    rpc Report(ReportRequest) returns (ReportResponse) {
       option (google.api.http) = {
          post: "/api/v2/reports"
          body: "*"
          additional_bindings {
             get: "/api/v2/reports"
          }
       };
    }
}
