grafeas / voucher

🎟 Voucher creates attestations for Binary Authorization
Apache License 2.0
73 stars 20 forks source link

OpenTelemetry metrics #65

Closed thepwagner closed 1 year ago

thepwagner commented 2 years ago

Add support for https://github.com/open-telemetry/opentelemetry-go metrics, with the configuration supporting otlp over http and grpc.

RFC: Configuration schema

The initial version of this PR slapped the configuration into the existing [statsd] section, but since opentelemetry != statsd we opted to make configuration changes:

Thanks _rxbchen for the feedback on this layout!

Testing instructions

To test this, I started from Shopify's configuration:

$ go run ./cmd/voucher_server -c .../config/staging/config.toml

Within that configuration, I tweaked the [statsd] section:

[statsd]
backend = "otel"
addr = "http://localhost:4318"
# OR: addr = "grpc://localhost:4317"
insecure = true # needed for http and grpc vs Shopify's test collector
tags = ["voucher_env:staging"]

Then I used voucher_client to trigger attestations and verify the metrics.

thepwagner commented 1 year ago

cc @Owen-Cummings

rxbchen commented 1 year ago

imo I like the idea of renaming statsd to metrics. Also having an extra section called [opentelemetry] and [statsd] would make it more clear as to what sorts of metrics we are trying to configure. Just my opinion though!

thepwagner commented 1 year ago

I like the idea of renaming statsd to metrics.

I dig it!

I've updated the documentation to say that [metrics] is now "the way" to specify the backend. The [statsd] section is still supported, so that we're not breaking any existing configs!

(addr looks like it might be shared here - but it does nothing when `backend = "datadog").

I've updated the PR description, this is ready for another review - PTAL!