Skip to content

Commit

Permalink
[remote-storage][v2] Add complete IDL for trace storage (#6737)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
- Towards #6629 

## Description of the changes
- This PR completes out the interface in `trace_storage.proto` by adding
the remaining `FindTraces` and `FindTraceIDs` RPCs for the `TraceReader`
service, along with the `Export` rpc for the `TraceWriter` service.

## How was this change tested?
- CI

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `npm run lint` and `npm run test`

---------

Signed-off-by: Mahad Zaryab <[email protected]>
  • Loading branch information
mahadzaryab1 authored Feb 21, 2025
1 parent 57b4037 commit e65cf00
Show file tree
Hide file tree
Showing 2 changed files with 416 additions and 35 deletions.
63 changes: 62 additions & 1 deletion 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/common/v1/common.proto";
import "opentelemetry/proto/trace/v1/trace.proto";

option go_package = "storage";
Expand Down Expand Up @@ -62,6 +64,49 @@ 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`
// (https://github.com/jaegertracing/jaeger-idl/blob/main/proto/api_v3/query_service.proto).
message TraceQueryParameters {
string service_name = 1;
string operation_name = 2;
repeated opentelemetry.proto.common.v1.KeyValue 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
];
int32 search_depth = 8;
}

// FindTracesRequest represents a request to find traces.
// It can be used to retrieve the traces (FindTraces) or simply
// the trace IDs (FindTraceIDs).
message FindTracesRequest {
TraceQueryParameters query = 1;
}

// FindTraceIDsResponse represents the response for FindTracesRequest.
message FindTraceIDsResponse {
repeated bytes trace_ids = 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
// to allow pushing traces to the storage backend
// (https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/collector/trace/v1/trace_service.proto)
service TraceReader {
// GetTraces returns a stream that retrieves all traces with given IDs.
//
Expand All @@ -73,7 +118,6 @@ service TraceReader {
// 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.
// - If an error is encountered, the stream returns the error and stops.
rpc GetTraces(GetTracesRequest) returns (stream opentelemetry.proto.trace.v1.TracesData) {}

// GetServices returns all service names known to the backend from traces
Expand All @@ -83,4 +127,21 @@ 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.
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.
//
// 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) {}
}
Loading

0 comments on commit e65cf00

Please sign in to comment.