Skip to content

Commit

Permalink
Auto-generate gogo annotations for api_v3
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <[email protected]>
  • Loading branch information
yurishkuro committed Nov 21, 2024
1 parent a420fd9 commit b670f8a
Show file tree
Hide file tree
Showing 8 changed files with 2,572 additions and 221 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ cmd/tracegen/tracegen-*
crossdock/crossdock-*

run-crossdock.log
proto-gen/.patched-otel-proto/
__pycache__
.asset-manifest.json
deploy/
Expand Down
15 changes: 12 additions & 3 deletions Makefile.Protobuf.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ PATCHED_OTEL_PROTO_DIR = proto-gen/.patched-otel-proto

PROTO_INCLUDES := \
-Iidl/proto/api_v2 \
-Iidl/proto/api_v3 \
-Imodel/proto/metrics \
-I/usr/include/github.com/gogo/protobuf

Expand Down Expand Up @@ -127,9 +126,19 @@ proto-zipkin:
# Note that the .pb.go types must be generated into the same internal package $(API_V3_PATH)
# where a manually defined traces.go file is located.
API_V3_PATH=cmd/query/app/internal/api_v3
API_V3_PATCHED_DIR=proto-gen/.patched/api_v3
API_V3_PATCHED=$(API_V3_PATCHED_DIR)/query_service.proto
.PHONY: patch-api-v3
patch-api-v3:
mkdir -p $(API_V3_PATCHED_DIR)
cat idl/proto/api_v3/query_service.proto | \
$(SED) -f ./proto-gen/patch-api-v3.sed \
> $(API_V3_PATCHED)

.PHONY: proto-api-v3
proto-api-v3:
$(call proto_compile, $(API_V3_PATH), idl/proto/api_v3/query_service.proto, -Iidl/opentelemetry-proto)
proto-api-v3: patch-api-v3
$(call proto_compile, $(API_V3_PATH), $(API_V3_PATCHED), -I$(API_V3_PATCHED_DIR) -Iidl/opentelemetry-proto)
#$(call proto_compile, $(API_V3_PATH), query_service.proto, -I$(API_V3_PATCHED_DIR) -Iidl/opentelemetry-proto)
@echo "🏗️ replace TracesData with internal custom type"
$(SED) -i 's/v1.TracesData/TracesData/g' $(API_V3_PATH)/query_service.pb.go
@echo "🏗️ remove OTEL import because we're not using any other OTLP types"
Expand Down
2 changes: 1 addition & 1 deletion cmd/query/app/apiv3/grpc_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (h *Handler) FindTraces(request *api_v3.FindTracesRequest, stream api_v3.Qu
ServiceName: query.GetServiceName(),
OperationName: query.GetOperationName(),
Tags: query.GetAttributes(),
NumTraces: int(query.GetNumTraces()),
NumTraces: int(query.GetSearchDepth()),
}
if query.GetStartTimeMin() != nil {
startTimeMin, err := types.TimestampFromProto(query.GetStartTimeMin())
Expand Down
Loading

0 comments on commit b670f8a

Please sign in to comment.