At Gusto, our OpenTelemetry endpoint is accessible via http only. This PR makes the protocol configurable via the SCOPE_OTEL_PROTOCOL environment variable.
The change was mostly a noop, except the omission of the with_metadata call on the HttpExporterBuilder. It looks like with_metadata is only available on the gRPC builder.
❯ ./target/debug/scope --help
...
Options:
...
--otel-collector <OTEL_COLLECTOR>
When set metrics will be sent to an otel collector at the endpoint provided
[env: SCOPE_OTEL_ENDPOINT=]
--otel-protocol <OTEL_PROTOCOL>
[env: SCOPE_OTEL_PROTOCOL=]
[default: grpc]
[possible values: http, grpc]
...
Testing
Correct protocol
```
❯ SCOPE_OTEL_ENDPOINT=https://devotel.uw2.staging.zp-int.com SCOPE_OTEL_PROTOCOL=http ./target/debug/scope list
Name Description Path
Name Description
- analyze Analyze for known errors
- doctor Run checks that will "checkup" your machine
- intercept External sub-command, run `scope intercept` for help
- lint Validate inputs, providing recommendations about configuration
- list List the found config files, and resources detected
- report Generate a bug report based from a command that was ran
- version Print version info and exit
```
Incorrect protocol
```
❯ SCOPE_OTEL_ENDPOINT=https://devotel.uw2.staging.zp-int.com SCOPE_OTEL_PROTOCOL=grpc ./target/debug/scope list
Name Description Path
Name Description
- analyze Analyze for known errors
- doctor Run checks that will "checkup" your machine
- intercept External sub-command, run `scope intercept` for help
- lint Validate inputs, providing recommendations about configuration
- list List the found config files, and resources detected
- report Generate a bug report based from a command that was ran
- version Print version info and exit
OpenTelemetry trace error occurred. Exporter otlp encountered the following error(s): the grpc server returns error (Unknown error): , detailed error message: transport error
```
At Gusto, our OpenTelemetry endpoint is accessible via http only. This PR makes the protocol configurable via the
SCOPE_OTEL_PROTOCOL
environment variable.The change was mostly a noop, except the omission of the
with_metadata
call on theHttpExporterBuilder
. It looks likewith_metadata
is only available on the gRPC builder.Testing
Correct protocol
``` ❯ SCOPE_OTEL_ENDPOINT=https://devotel.uw2.staging.zp-int.com SCOPE_OTEL_PROTOCOL=http ./target/debug/scope list Name Description Path Name Description - analyze Analyze for known errors - doctor Run checks that will "checkup" your machine - intercept External sub-command, run `scope intercept` for help - lint Validate inputs, providing recommendations about configuration - list List the found config files, and resources detected - report Generate a bug report based from a command that was ran - version Print version info and exit ```Incorrect protocol
``` ❯ SCOPE_OTEL_ENDPOINT=https://devotel.uw2.staging.zp-int.com SCOPE_OTEL_PROTOCOL=grpc ./target/debug/scope list Name Description Path Name Description - analyze Analyze for known errors - doctor Run checks that will "checkup" your machine - intercept External sub-command, run `scope intercept` for help - lint Validate inputs, providing recommendations about configuration - list List the found config files, and resources detected - report Generate a bug report based from a command that was ran - version Print version info and exit OpenTelemetry trace error occurred. Exporter otlp encountered the following error(s): the grpc server returns error (Unknown error): , detailed error message: transport error ```