Skip to content

Commit

Permalink
Fixing protobuf generation and InstrumentationScope (#665)
Browse files Browse the repository at this point in the history
* updating proto generation
switching over to using opentelemetry-proto's own mechanism for generating protobuf interfaces, and
updating interfaces to latest version

* downgrade protobuf interfaces to 0.14.0
this is the latest version that seems to work with out grpc exporter, further
investigation required for 0.15.0+

* tidy up script

* renaming InstrumentationLibrary to InstrumentationScope and bumping protobuf
InstrumentationLibrary is now deprecated in favour of InstrumentationScope. Making this change
resolves issues with grpc+protobuf exports being ignored by the otel collector, so we now
can update the proto interfaces to latest.

* rename collector docker-compose file
  • Loading branch information
brettmc committed Apr 27, 2022
1 parent 9138d78 commit 4e32645
Show file tree
Hide file tree
Showing 103 changed files with 2,000 additions and 923 deletions.
4 changes: 3 additions & 1 deletion .phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,12 @@
// your application should be included in this list.
'directory_list' => [
'src',
'proto',
'proto/otel/GPBMetadata',
'proto/otel/Opentelemetry',
'thrift',
'vendor/packaged/thrift',
'vendor/composer',
'vendor/grpc/grpc/src/lib',
'vendor/guzzlehttp',
'vendor/psr',
'vendor/php-http',
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ psalm:
psalm-info:
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/psalm --show-info=true --threads=1
phpstan:
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/phpstan analyse
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/phpstan analyse --memory-limit=256M
benchmark:
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/phpbench run --report=default
phpmetrics:
Expand All @@ -39,9 +39,9 @@ trace examples: FORCE
docker-compose run -e NEW_RELIC_ENDPOINT -e NEW_RELIC_INSERT_KEY --rm php php ./examples/AlwaysOnZipkinToNewrelicExample.php
docker-compose stop
collector:
docker-compose -f docker-compose-collector.yaml up -d --remove-orphans
docker-compose -f docker-compose-collector.yaml run -e OTEL_EXPORTER_OTLP_ENDPOINT=otel-collector:4317 --rm php php ./examples/AlwaysOnOTLPGrpcExample2.php
docker-compose -f docker-compose-collector.yaml stop
docker-compose -f docker-compose.collector.yaml up -d --remove-orphans
docker-compose -f docker-compose.collector.yaml run -e OTEL_EXPORTER_OTLP_ENDPOINT=collector:4317 --rm php php ./examples/AlwaysOnOTLPGrpcExample.php
docker-compose -f docker-compose.collector.yaml stop

fiber-ffi-example:
@docker-compose -f docker-compose.fiber-ffi.yaml -p opentelemetry-php_fiber-ffi-example up -d web
Expand All @@ -51,7 +51,7 @@ metrics-prometheus-example:
stop-prometheus:
@docker-compose -f docker-compose.prometheus.yaml -p opentelemetry-php_metrics-prometheus-example stop
protobuf:
@docker-compose -f docker-compose.proto.yaml up proto
./script/proto_gen.sh
thrift:
./script/thrift_gen.sh
bash:
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,8 @@ To generate protobuf files for use with this repository, you can run the followi
make protobuf
```

Change into the root of this directory. This will create a `/proto` folder in the root
directory of the
repository.
This will replace `proto/otel/Opentelemetry` and `proto/otel/GPBMetadata` with freshly generated code based on the latest
tag from `opentelemetry-proto`, which can then be committed.


## Semantic Conventions Generation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
volumes:
- ./:/usr/src/myapp
depends_on:
- otel-collector
- collector
zipkin:
image: openzipkin/zipkin-slim
ports:
Expand All @@ -19,8 +19,7 @@ services:
ports:
- 9412:9412
- 16686:16686
otel-collector:
platform: linux/amd64
collector:
image: otel/opentelemetry-collector-contrib
command: ["--config=/etc/otel-collector-config.yml"]
volumes:
Expand Down
7 changes: 0 additions & 7 deletions docker-compose.proto.yaml

This file was deleted.

1 change: 1 addition & 0 deletions proto/otel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
opentelemetry-proto
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified proto/otel/GPBMetadata/Opentelemetry/Proto/Common/V1/Common.php
Binary file not shown.
Binary file modified proto/otel/GPBMetadata/Opentelemetry/Proto/Logs/V1/Logs.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
23 changes: 10 additions & 13 deletions proto/otel/GPBMetadata/Opentelemetry/Proto/Resource/V1/Resource.php

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

Binary file modified proto/otel/GPBMetadata/Opentelemetry/Proto/Trace/V1/Trace.php
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function __construct($hostname, $opts, $channel = null) {
* @param \Opentelemetry\Proto\Collector\Logs\V1\ExportLogsServiceRequest $argument input argument
* @param array $metadata metadata
* @param array $options call options
* @return \Grpc\UnaryCall
*/
public function Export(\Opentelemetry\Proto\Collector\Logs\V1\ExportLogsServiceRequest $argument,
$metadata = [], $options = []) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function __construct($hostname, $opts, $channel = null) {
* @param \Opentelemetry\Proto\Collector\Metrics\V1\ExportMetricsServiceRequest $argument input argument
* @param array $metadata metadata
* @param array $options call options
* @return \Grpc\UnaryCall
*/
public function Export(\Opentelemetry\Proto\Collector\Metrics\V1\ExportMetricsServiceRequest $argument,
$metadata = [], $options = []) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function __construct($hostname, $opts, $channel = null) {
* @param \Opentelemetry\Proto\Collector\Trace\V1\ExportTraceServiceRequest $argument input argument
* @param array $metadata metadata
* @param array $options call options
* @return \Grpc\UnaryCall
*/
public function Export(\Opentelemetry\Proto\Collector\Trace\V1\ExportTraceServiceRequest $argument,
$metadata = [], $options = []) {
Expand Down
39 changes: 37 additions & 2 deletions proto/otel/Opentelemetry/Proto/Common/V1/AnyValue.php

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

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

95 changes: 95 additions & 0 deletions proto/otel/Opentelemetry/Proto/Common/V1/InstrumentationScope.php

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

0 comments on commit 4e32645

Please sign in to comment.