// Copyright 2025 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

///////////////////////////////////////////////////////////////////////////////
// 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨
//
// This protocol is under active development, and will change in backwards
// incompatible ways in the future.
//
// DO NOT take a dependency on this without contacting the gRPC authors
// (who will advise against taking such a dependency in as strong a fashion
// as they are able)
//
// 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨
///////////////////////////////////////////////////////////////////////////////

package grpc.channelz.v2;

import "src/proto/grpc/channelz/v2/property_list.proto";

message LatentSeeTrace {
  message FlowBegin {
    int64 id = 1;
  }
  message FlowEnd {
    int64 id = 1;
  }
  message Mark {
    PropertyList properties = 1;
  }
  message Span {
    int64 duration_ns = 1;
  }

  string name = 1;
  int64 tid = 2;
  int64 timestamp_ns = 3;
  oneof kind {
    FlowBegin flow_begin = 4;
    FlowEnd flow_end = 5;
    Mark mark = 6;
    Span span = 7;
  }
}

message GetTraceRequest {
  double sample_time = 1;
}

// LatentSee is a service exposed by gRPC servers that provides high fidelity
// trace information.
service LatentSee {
  // Query for a trace. Note that no traces will be returned until sample_time
  // expires, and so the deadline for this request must be greater than that.
  rpc GetTrace(GetTraceRequest) returns (stream LatentSeeTrace);
}
