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
Changes from 1 commit
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
64 changes: 64 additions & 0 deletions internal/storage/v2/grpc/trace_storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package jaeger.storage.v2;

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

Expand Down Expand Up @@ -62,6 +63,46 @@ message GetOperationsResponse {
repeated Operation operations = 1;
}

message TraceQueryParams {
// service_name is a filter for traces that have been generated by a specific service.
string service_name = 1;
// operation_name is a filter for traces that have been generated by a specific operation.
string operation_name = 2;
// attributes contains a map of key-value pairs where the key is the name of the attribute
// and the value is the string-representation of the attribute value.
// Attributes are matched against the attributes of the resources and spans.
// At least one span in a trace must match all specified attributes.
map<string, string> attributes = 3;
// start_time is the start of the time interval for the query. All the returned traces
// will contain spans that have started after this time.
google.protobuf.Timestamp start_time = 4 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
// end_time is the end of the time interval for the query. All the returned traces
// will contain spans that have started before this time.
google.protobuf.Timestamp end_time = 5 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
// min_duration is the minimum duration of the trace in nanoseconds. All the returned traces
// will have spans that lasted alteast this long.
google.protobuf.Duration min_duration = 6 [
(gogoproto.stdduration) = true,
(gogoproto.nullable) = false
];
// max_duration is the maximum duration of the trace in nanoseconds. All the returned traces
// will have spans that lasted at most this long.
google.protobuf.Duration max_duration = 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.
int max_traces = 8;
}

service TraceReader {
// GetTraces returns a stream that retrieves all traces with given IDs.
//
Expand All @@ -83,4 +124,27 @@ 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(TraceQueryParams) 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(TraceQueryParams) returns (stream bytes) {}
}
Loading