Skip to content

Commit

Permalink
implement thrift-gen
Browse files Browse the repository at this point in the history
  • Loading branch information
Joonsoo Won committed Jan 3, 2025
1 parent 7ec077e commit 16d41ad
Show file tree
Hide file tree
Showing 20 changed files with 7,968 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "pkg/translator/jaeger/idl"]
path = pkg/translator/jaeger/idl
url = https://github.com/jaegertracing/jaeger-idl.git
branch = main
1 change: 1 addition & 0 deletions pkg/translator/jaeger/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include ../../../Makefile.Common
include Makefile.Thrift.mk
27 changes: 27 additions & 0 deletions pkg/translator/jaeger/Makefile.Thrift.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (c) 2023 The Jaeger Authors.
# SPDX-License-Identifier: Apache-2.0

THRIFT_VER=0.19
THRIFT_IMG=jaegertracing/thrift:$(THRIFT_VER)
THRIFT=docker run --rm -u ${shell id -u} -v "${PWD}:/data" $(THRIFT_IMG) thrift
THRIFT_GO_ARGS=thrift_import="github.com/apache/thrift/lib/go/thrift"
THRIFT_GEN_DIR=thrift-gen

.PHONY: thrift-image
thrift-image:
$(THRIFT) -version

.PHONY: thrift
thrift: idl/thrift/jaeger.thrift thrift-image
[ -d $(THRIFT_GEN_DIR) ] || mkdir $(THRIFT_GEN_DIR)
$(THRIFT) -o /data --gen go:$(THRIFT_GO_ARGS) --out /data/$(THRIFT_GEN_DIR) /data/idl/thrift/agent.thrift
$(SED) -i.bak 's|"zipkincore"|"$(JAEGER_IMPORT_PATH)/thrift-gen/zipkincore"|g' $(THRIFT_GEN_DIR)/agent/*.go
$(SED) -i.bak 's|"jaeger"|"$(JAEGER_IMPORT_PATH)/thrift-gen/jaeger"|g' $(THRIFT_GEN_DIR)/agent/*.go
$(THRIFT) -o /data --gen go:$(THRIFT_GO_ARGS) --out /data/$(THRIFT_GEN_DIR) /data/idl/thrift/jaeger.thrift
$(THRIFT) -o /data --gen go:$(THRIFT_GO_ARGS) --out /data/$(THRIFT_GEN_DIR) /data/idl/thrift/sampling.thrift
$(THRIFT) -o /data --gen go:$(THRIFT_GO_ARGS) --out /data/$(THRIFT_GEN_DIR) /data/idl/thrift/baggage.thrift
$(THRIFT) -o /data --gen go:$(THRIFT_GO_ARGS) --out /data/$(THRIFT_GEN_DIR) /data/idl/thrift/zipkincore.thrift
rm -rf thrift-gen/*/*-remote thrift-gen/*/*.bak

idl/thrift/jaeger.thrift:
git submodule update --init --recursive
2 changes: 1 addition & 1 deletion pkg/translator/jaeger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/
go 1.22.0

require (
github.com/apache/thrift v0.21.0
github.com/jaegertracing/jaeger v1.62.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.116.0
github.com/stretchr/testify v1.10.0
Expand All @@ -12,7 +13,6 @@ require (
)

require (
github.com/apache/thrift v0.21.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand Down
1 change: 1 addition & 0 deletions pkg/translator/jaeger/idl
Submodule idl added at 5fc876

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

35 changes: 35 additions & 0 deletions pkg/translator/jaeger/thrift-gen/agent/agent-consts.go

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

Loading

0 comments on commit 16d41ad

Please sign in to comment.