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 proto definition for GetTraces rpc #6730

Merged
merged 10 commits into from
Feb 15, 2025
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
Loading