Skip to content
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

[remote-storage][v2] Add complete IDL for trace storage #6737

Merged
merged 16 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from 10 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
69 changes: 69 additions & 0 deletions internal/storage/v2/grpc/trace_storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ syntax = "proto3";
package jaeger.storage.v2;

import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "opentelemetry/proto/collector/trace/v1/trace_service.proto";
import "opentelemetry/proto/trace/v1/trace.proto";

option go_package = "storage";
Expand Down Expand Up @@ -62,6 +64,44 @@ message GetOperationsResponse {
repeated Operation operations = 1;
}

// TraceQueryParameters contains query paramters to find traces. For a detailed
// definition of each field in this message, refer to `TraceQueryParameters` in
// `jaeger.api_v3`.
message TraceQueryParameters {
string service_name = 1;
string operation_name = 2;
map<string, string> attributes = 3;
google.protobuf.Timestamp start_time_min = 4 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
google.protobuf.Timestamp start_time_max = 5 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
google.protobuf.Duration duration_min = 6 [
(gogoproto.stdduration) = true,
(gogoproto.nullable) = false
];
google.protobuf.Duration duration_max = 7 [
(gogoproto.stdduration) = true,
(gogoproto.nullable) = false
];
// max_traces is the maximum number of traces to return. If the number of traces
// matching the query is greater than this number, only the first max_traces
// traces will be returned.
int32 max_traces = 8;
}

// FindTracesRequest represents a request to find traces.
message FindTracesRequest {
TraceQueryParameters query = 1;
}

message FindTraceIDsResponse {
repeated bytes trace_ids = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized - shouldn't we be returning IDs with timestamps? We can do in a follow up PR, as it needs a change in storage API.

}

service TraceReader {
// GetTraces returns a stream that retrieves all traces with given IDs.
//
Expand All @@ -83,4 +123,33 @@ service TraceReader {
// GetOperations returns all operation names for a given service
// known to the backend from traces within its retention period.
rpc GetOperations(GetOperationsRequest) returns (GetOperationsResponse) {}

// 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.
// If an error is encountered, the iterator returns the error and stops.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yurishkuro How should we handle error cases?

//
// There's currently an implementation-dependent ambiguity whether all query filters
// (such as multiple tags) must apply to the same span within a trace, or can be satisfied
// by different spans.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the api_v3 it's actually stated unambiguously

rpc FindTraces(FindTracesRequest) returns (stream opentelemetry.proto.trace.v1.TracesData) {}

// FindTraceIDs returns a stream that retrieves IDs of traces matching query parameters.
//
// If no matching traces are found, an empty stream is returned.
// If an error is encountered, the stream returns the error and stops.
//
// This call behaves identically to FindTraces, except that it returns only the list
// of matching trace IDs. This is useful in some contexts, such as batch jobs, where a
// large list of trace IDs may be queried first and then the full traces are loaded
// in batches.
rpc FindTraceIDs(FindTracesRequest) returns (FindTraceIDsResponse) {}
}

// The TraceWriter is used for pushing a batch of traces to the storage backend.
// This service is comptaible with OTEL's TraceService.
service TraceWriter {
rpc Export(opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest) returns (opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse) {}
}
Loading
Loading