envoy: Enable zipkin tracing (#737)

- Update envoy bootstrap config to protobufs
- Reorganize tracing config to avoid cyclic import
- Push down zipkin config to Envoy
- Update tracing options to provide sample rate
This commit is contained in:
Travis Groth 2020-05-21 11:50:07 -04:00 committed by GitHub
parent 38c1b5ec65
commit 3e17befff7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 434 additions and 120 deletions

View file

@ -4,6 +4,7 @@ import (
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"regexp"
"testing"
)
@ -27,8 +28,8 @@ envoy_server_initialization_time_ms_bucket{le="1000"} 1
}
}
func getMetrics(t *testing.T) []byte {
h, err := PrometheusHandler()
func getMetrics(t *testing.T, envoyURL *url.URL) []byte {
h, err := PrometheusHandler(envoyURL)
if err != nil {
t.Fatal(err)
}
@ -48,7 +49,7 @@ func getMetrics(t *testing.T) []byte {
func Test_PrometheusHandler(t *testing.T) {
t.Run("no envoy", func(t *testing.T) {
b := getMetrics(t)
b := getMetrics(t, &url.URL{})
if m, _ := regexp.Match(`(?m)^# HELP .*`, b); !m {
t.Errorf("Metrics endpoint did not contain any help messages: %s", b)
@ -57,8 +58,8 @@ func Test_PrometheusHandler(t *testing.T) {
t.Run("with envoy", func(t *testing.T) {
fakeEnvoyMetricsServer := httptest.NewServer(newEnvoyMetricsHandler())
envoyURL = fakeEnvoyMetricsServer.URL
b := getMetrics(t)
envoyURL, _ := url.Parse(fakeEnvoyMetricsServer.URL)
b := getMetrics(t, envoyURL)
if m, _ := regexp.Match(`(?m)^go_.*`, b); !m {
t.Errorf("Metrics endpoint did not contain internal metrics: %s", b)