Skip to content

Commit

Permalink
[remote-storage][v2] Add proto definition for GetTraces rpc (#6730)
Browse files Browse the repository at this point in the history
<!--
!! Please DELETE this comment before posting.
We appreciate your contribution to the Jaeger project! 👋🎉
-->

## Which problem is this PR solving?
- Towards #6629

## Description of the changes
- This PR creates a protobuf definition in `traces_storage.proto` that
will contain the API for all methods pertaining to the traces storage.

## 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 15, 2025
1 parent 9266f00 commit 23d2254
Show file tree
Hide file tree
Showing 3 changed files with 347 additions and 1 deletion.
49 changes: 49 additions & 0 deletions internal/storage/v2/grpc/trace_storage.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
syntax = "proto3";

package jaeger.storage.v2;

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

option go_package = "storage";

// GetTraceParams represents the query for a single trace from the storage backend.
message GetTraceParams {
// trace_id is a 16 byte array containing the unique identifier for the trace to query.
bytes trace_id = 1;

// start_time is the start of the time interval to search for the trace_id.
//
// This field is optional.
google.protobuf.Timestamp start_time = 2 [
(gogoproto.stdtime) = true
];

// end_time is the end of the time interval to search for the trace_id.
//
// This field is optional.
google.protobuf.Timestamp end_time = 3 [
(gogoproto.stdtime) = true
];
}

// GetTracesRequest represents a request to retrieve multiple traces.
message GetTracesRequest {
repeated GetTraceParams query = 1;
}

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.
// - If an error is encountered, the stream returns the error and stops.
rpc GetTraces(GetTracesRequest) returns (stream opentelemetry.proto.trace.v1.TracesData) {}
}
291 changes: 291 additions & 0 deletions proto-gen/storage/v2/trace_storage.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion scripts/makefiles/Protobuf.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ PATCHED_OTEL_PROTO_DIR = proto-gen/.patched-otel-proto
PROTO_INCLUDES := \
-Iidl/proto/api_v2 \
-Imodel/proto/metrics \
-I/usr/include/github.com/gogo/protobuf
-I/usr/include/github.com/gogo/protobuf \
-Iidl/opentelemetry-proto

# Remapping of std types to gogo types (must not contain spaces)
PROTO_GOGO_MAPPINGS := $(shell echo \
Expand Down Expand Up @@ -79,6 +80,7 @@ endef

.PHONY: proto
proto: proto-storage-v1 \
proto-storage-v2 \
proto-hotrod \
proto-zipkin \
proto-openmetrics \
Expand Down Expand Up @@ -107,6 +109,10 @@ proto-storage-v1:
--go_out=$(PWD)/internal/storage/v1/grpc/proto/ \
internal/storage/v1/grpc/proto/storage_test.proto

.PHONY: proto-storage-v2
proto-storage-v2:
$(call proto_compile, proto-gen/storage/v2, internal/storage/v2/grpc/trace_storage.proto, -Iinternal/storage/v2/grpc/)

.PHONY: proto-hotrod
proto-hotrod:
$(call proto_compile, , examples/hotrod/services/driver/driver.proto)
Expand Down

0 comments on commit 23d2254

Please sign in to comment.