Skip to content

[refactor] Return chunk of traces from remote storage api v2 #6830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions internal/storage/v2/grpc/trace_storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ message FindTraceIDsResponse {
repeated FoundTraceID trace_ids = 1;
}

// TracesChunk is the payload type used in streaming responses that contain traces.
//
// It consists of a batch of trace data, where each TracesData object contains spans
// belonging to a single trace. Multiple traces may be included within a single TracesChunk.
//
// Chunking requirements:
// - Each TracesData object within TracesChunk MUST NOT contain spans from multiple traces.
// - Large individual traces MAY be split across multiple, *consecutive* TracesData objects.
// - Each TracesData object MUST NOT be empty.
message TracesChunk {
repeated opentelemetry.proto.trace.v1.TracesData traces = 1;
}

// TraceReader is a service that allows reading traces from storage.
// Note that if you implement this service, you should also implement
// OTEL's TraceService in package opentelemetry.proto.collector.trace.v1
Expand All @@ -137,15 +150,10 @@ message FindTraceIDsResponse {
service TraceReader {
// GetTraces returns a stream that retrieves all traces with given IDs.
//
// Chunking requirements:
// - A single TracesData chunk MUST NOT contain spans from multiple traces.
// - Large traces MAY be split across multiple, *consecutive* TracesData chunks.
// - Each returned TracesData object MUST NOT be empty.
//
// Edge cases:
// - If no spans are found for any given trace ID, the ID is ignored.
// - If none of the trace IDs are found in the storage, an empty response is returned.
rpc GetTraces(GetTracesRequest) returns (stream opentelemetry.proto.trace.v1.TracesData) {}
rpc GetTraces(GetTracesRequest) returns (stream TracesChunk) {}

// GetServices returns all service names known to the backend from traces
// within its retention period.
Expand All @@ -157,10 +165,8 @@ service TraceReader {

// FindTraces returns a stream that retrieves traces matching query parameters.
//
// The chunking rules are the same as for GetTraces.
//
// If no matching traces are found, an empty stream is returned.
rpc FindTraces(FindTracesRequest) returns (stream opentelemetry.proto.trace.v1.TracesData) {}
rpc FindTraces(FindTracesRequest) returns (stream TracesChunk) {}

// FindTraceIDs returns a stream that retrieves IDs of traces matching query parameters.
//
Expand Down
Loading
Loading