@@ -38,17 +38,6 @@ message GetTraceRequest {
3838 ];
3939}
4040
41- // Response object with spans.
42- message SpansResponseChunk {
43- // A list of OpenTelemetry ResourceSpans.
44- // In case of JSON format the ids (trace_id, span_id, parent_id) are encoded in base64 even though OpenTelemetry specification
45- // mandates to use hex encoding [2].
46- // Base64 is chosen to keep compatibility with JSONPb codec.
47- // [1]: https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto
48- // [2]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md#otlphttp
49- repeated opentelemetry.proto.trace.v1.ResourceSpans resource_spans = 1 ;
50- }
51-
5241// Query parameters to find traces. Except for num_traces, all fields should be treated
5342// as forming a conjunction, e.g., "service_name='X' AND operation_name='Y' AND ...".
5443// All fields are matched against individual spans, not at the trace level.
@@ -118,11 +107,11 @@ service QueryService {
118107 // It means that the JSON response cannot be directly unmarshalled using JSONPb.
119108 // This can be fixed by first parsing into user-defined envelope with standard JSON library
120109 // or string manipulation to remove the envelope. Alternatively generate objects using OpenAPI.
121- rpc GetTrace (GetTraceRequest ) returns (stream SpansResponseChunk ) {}
110+ rpc GetTrace (GetTraceRequest ) returns (stream opentelemetry.proto.trace.v1.TracesData ) {}
122111
123112 // FindTraces searches for traces.
124113 // See GetTrace for JSON unmarshalling.
125- rpc FindTraces (FindTracesRequest ) returns (stream SpansResponseChunk ) {}
114+ rpc FindTraces (FindTracesRequest ) returns (stream opentelemetry.proto.trace.v1.TracesData ) {}
126115
127116 // GetServices returns service names.
128117 rpc GetServices (GetServicesRequest ) returns (GetServicesResponse ) {}
@@ -131,10 +120,9 @@ service QueryService {
131120 rpc GetOperations (GetOperationsRequest ) returns (GetOperationsResponse ) {}
132121}
133122
134- // Below are some helper types when using APIv3 via HTTP endpoints implemented via grpc-gateway .
123+ // Below are some helper types when using APIv3 via HTTP endpoints.
135124
136125// GRPCGatewayError is the type returned when GRPC server returns an error.
137- // Note that for streaming responses it would be wrapped in GRPCGatewayWrapper below.
138126// Example: {"error":{"grpcCode":2,"httpCode":500,"message":"...","httpStatus":"text..."}}.
139127message GRPCGatewayError {
140128 message GRPCGatewayErrorDetails {
@@ -147,13 +135,17 @@ message GRPCGatewayError {
147135 GRPCGatewayErrorDetails error = 1 ;
148136}
149137
150- // GRPCGatewayWrapper is a type returned when GRPC service returns a stream.
151- // For some unknown reason grpc-gateway/v1 wraps chunk responses in {"result": {actual output}}.
138+ // GRPCGatewayWrapper wraps streaming responses from GetTrace/FindTraces for HTTP.
139+ // Today there is always only one response because internally the HTTP server gets
140+ // data from QueryService that does not support multiple responses. But in the
141+ // future the server may return multiple responeses using Transfer-Encoding: chunked.
142+ // In case of errors, GRPCGatewayError above is used.
143+ //
144+ // Example:
145+ // {"result": {"resourceSpans": ...}}
146+ //
152147// See https://github.com/grpc-ecosystem/grpc-gateway/issues/2189
153- // TODO: it's not clear what happens when the server returns more than one chunk.
154- // The gateway will presumably combine then into a single HTTP response.
155- // Currently this is not possible because even though APIv3 GRPC Service is using output stream,
156- // its implementation reads all spans from QueryService at once and forms only a single chunk.
148+ //
157149message GRPCGatewayWrapper {
158- SpansResponseChunk result = 1 ;
150+ opentelemetry.proto.trace.v1.TracesData result = 1 ;
159151}
0 commit comments