From ed07a9e13b0422d283275d677269d1cae4df614b Mon Sep 17 00:00:00 2001 From: Ritick Gautam <41835832+riticksingh@users.noreply.github.com> Date: Wed, 18 Nov 2020 19:54:42 +0530 Subject: [PATCH] Adding Proto folder to opentelemetry-php (#214) * Adding Proto to opentelemetry-php Signed-off-by:Ritick Gautam * Updated the script for generating proto folder in root * Moved shell file in script folder updated .gitignore * Removed opentelemetry-proto * Bug fixed * added docker-compose.proto.yaml updated script file updated Makefile * Update docker-compose.proto.yaml * Updated README.md --- .gitignore | 1 + Makefile | 2 ++ README.md | 7 +++++++ docker-compose.proto.yaml | 7 +++++++ script/proto_gen.sh | 6 ++++++ 5 files changed, 23 insertions(+) create mode 100644 docker-compose.proto.yaml create mode 100755 script/proto_gen.sh diff --git a/.gitignore b/.gitignore index d905bd3d..c73ec39a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ vendor coverage.clover tests/coverage .php_cs.cache +proto/* \ No newline at end of file diff --git a/Makefile b/Makefile index ac11082c..c39202c8 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,8 @@ metrics-prometheus-example: @docker-compose -f docker-compose.prometheus.yaml run php-prometheus php /var/www/public/examples/prometheus/PrometheusMetricsExample.php stop-prometheus: @docker-compose -f docker-compose.prometheus.yaml stop +proto: + @docker-compose -f docker-compose.proto.yaml up proto bash: $(DC_RUN_PHP) bash style: diff --git a/README.md b/README.md index 808feeb5..45116f7d 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,13 @@ We use docker and docker-compose to perform a lot of our static analysis and tes If you're planning to develop for this library, it'll help to install `docker engine` and `docker-compose`. You can find installation instructions for these packages can be found [here](https://docs.docker.com/install/), under the `Docker Engine` and `Docker Compose` submenus respectively. +##Proto Generation +In order to generate proto files for use with this repository, we can perform a + +`make proto` + +From the root directory. This wil create a `/proto` folder in the root directory of the repository. + ## Styling We use [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) for our code linting and standards fixer. The associated configuration for this standards fixer can be found in the root of the repository [here](https://github.com/open-telemetry/opentelemetry-php/blob/master/.php_cs) diff --git a/docker-compose.proto.yaml b/docker-compose.proto.yaml new file mode 100644 index 00000000..803de76d --- /dev/null +++ b/docker-compose.proto.yaml @@ -0,0 +1,7 @@ +version: '3.7' +services: + proto: + image: socialpoint/protobuf-tools + volumes: + - ./:/mnt + command: sh -c "/mnt/script/proto_gen.sh" diff --git a/script/proto_gen.sh b/script/proto_gen.sh new file mode 100755 index 00000000..75c786d2 --- /dev/null +++ b/script/proto_gen.sh @@ -0,0 +1,6 @@ +apk update && apk add git + +mkdir /mnt/proto +git clone https://github.com/open-telemetry/opentelemetry-proto + +protoc --proto_path=opentelemetry-proto/ --php_out=/mnt/proto --grpc_out=/mnt/proto --plugin=protoc-gen-grpc=usr/local/bin/grpc_php_plugin $(find opentelemetry-proto/opentelemetry -iname "*.proto")