-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Go code generated for api_v2 (#116)
## Which problem is this PR solving? - Part 1 and 2 of jaegertracing/jaeger#6494 for api_v2 ## Description of the changes - Create makefile for compiling and generating code from .proto files present - All locations of proto files, as well as generated code are inspired from main jaeger repo. (Since no other alteranative was suggested in issue.) - Add all the generated code from the proto files as well. - Create ci-lint file for same. ## 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 - [ ] I have added unit tests for the new functionality - [ ] 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: adityachopra29 <[email protected]>
- Loading branch information
1 parent
5fc8765
commit c003366
Showing
6 changed files
with
6,136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Lint Checks | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
pull_request: | ||
branches: [main] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
# See https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions | ||
permissions: # added using https://github.com/step-security/secure-workflows | ||
contents: read | ||
|
||
jobs: | ||
generated-files-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | ||
with: | ||
egress-policy: audit # TODO: change to 'egress-policy: block' after a couple of runs | ||
|
||
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | ||
with: | ||
go-version: 1.23.x | ||
|
||
- name: Verify Protobuf types are up to date | ||
run: make new-proto && git diff --name-status --exit-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Copyright (c) 2023 The Jaeger Authors. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Generate gogo, swagger, go-validators, gRPC-storage-plugin output. | ||
# | ||
# -I declares import folders, in order of importance. This is how proto resolves the protofile imports. | ||
# It will check for the protofile relative to each of thesefolders and use the first one it finds. | ||
# | ||
# --gogo_out generates GoGo Protobuf output with gRPC plugin enabled. | ||
# --govalidators_out generates Go validation files for our messages types, if specified. | ||
# | ||
# The lines starting with Mgoogle/... are proto import replacements, | ||
# which cause the generated file to import the specified packages | ||
# instead of the go_package's declared by the imported protof files. | ||
# | ||
|
||
DOCKER_PROTOBUF_VERSION=0.5.0 | ||
DOCKER_PROTOBUF=jaegertracing/protobuf:$(DOCKER_PROTOBUF_VERSION) | ||
# PROTOC := ${DOCKER} run --rm -u ${shell id -u} -v${PWD}:${PWD} -w${PWD} ${DOCKER_PROTOBUF} --proto_path=${PWD} | ||
|
||
PATCHED_OTEL_PROTO_DIR = proto-gen/.patched-otel-proto | ||
|
||
# The source directory for OTLP Protobufs from the sub-sub-module. | ||
OTEL_PROTO_SRC_DIR=opentelemetry-proto/opentelemetry/proto | ||
|
||
# Find all OTEL .proto files, remove leading path (only keep relevant namespace dirs). | ||
OTEL_PROTO_FILES=$(subst $(OTEL_PROTO_SRC_DIR)/,,\ | ||
$(shell ls $(OTEL_PROTO_SRC_DIR)/{common,resource,trace}/v1/*.proto)) | ||
|
||
# Macro to execute a command passed as argument. | ||
# DO NOT DELETE EMPTY LINE at the end of the macro, it's required to separate commands. | ||
define exec-command | ||
$(1) | ||
|
||
endef | ||
|
||
# DO NOT DELETE EMPTY LINE at the end of the macro, it's required to separate commands. | ||
define print_caption | ||
@echo "🏗️ " | ||
@echo "🏗️ " $1 | ||
@echo "🏗️ " | ||
|
||
endef | ||
|
||
# Macro to compile Protobuf $(2) into directory $(1). $(3) can provide additional flags. | ||
# DO NOT DELETE EMPTY LINE at the end of the macro, it's required to separate commands. | ||
# Arguments: | ||
# $(1) - output directory | ||
# $(2) - path to the .proto file | ||
# $(3) - additional flags to pass to protoc, e.g. extra -Ixxx | ||
# $(4) - additional options to pass to gogo plugin | ||
define proto_compile | ||
$(call print_caption, "Processing $(2) --> $(1)") | ||
|
||
$(PROTOC) \ | ||
$(PROTO_INCLUDES) \ | ||
--gogo_out=plugins=grpc,$(strip $(4)),$(PROTO_GOGO_MAPPINGS):$(PWD)/$(strip $(1)) \ | ||
$(3) $(2) | ||
|
||
endef | ||
|
||
.PHONY: new-proto | ||
new-proto: new-proto-api-v2 | ||
|
||
.PHONY: new-proto-api-v2 | ||
new-proto-api-v2: | ||
mkdir -p proto-gen/api_v2 | ||
$(call proto_compile, proto-gen/api_v2, proto/api_v2/query.proto) | ||
$(call proto_compile, proto-gen/api_v2, proto/api_v2/collector.proto) | ||
$(call proto_compile, proto-gen/api_v2, proto/api_v2/sampling.proto) |
Oops, something went wrong.