From fb15fe7c1a28984df20b0da44ecc28d312781f64 Mon Sep 17 00:00:00 2001 From: Kevin Lingerfelt Date: Fri, 13 Apr 2018 11:21:29 -0700 Subject: [PATCH] Remove the telemetry service (#757) * Remove the telemetry service The telemetry service is no longer needed, now that prometheus scrapes metrics directly from proxies, and the public-api talks directly to prometheus. In this branch I'm removing the service itself as well as all of the telemetry protobuf, and updating the conduit install command to no longer install the service. I'm also removing the old version of the stat command, which required the telemetry service, and renaming the statsummary command to stat. * Fix time window tests * Remove deprecated controller scrape config Signed-off-by: Kevin Lingerfelt --- .prometheus.dev.yml | 1 - BUILD.md | 8 - bin/protoc-go.sh | 3 - cli/cmd/stat.go | 214 ------ cli/cmd/stat_summary.go | 55 +- cli/cmd/stat_test.go | 234 ------ cli/cmd/testdata/install_default.golden | 30 - cli/cmd/testdata/install_output.golden | 30 - cli/install/template.go | 29 - controller/api/proxy/client.go | 15 - controller/api/proxy/server.go | 20 +- controller/api/public/client.go | 6 - controller/api/public/client_test.go | 58 +- controller/api/public/grpc_server.go | 577 -------------- controller/api/public/grpc_server_test.go | 246 ------ controller/api/public/http_server.go | 27 - controller/api/public/http_server_test.go | 26 +- controller/api/public/proto_over_http_test.go | 19 +- controller/api/public/stat_summary_test.go | 2 - controller/api/public/test_helper.go | 5 - controller/api/util/api_utils.go | 27 - controller/api/util/api_utils_test.go | 82 -- controller/cmd/proxy-api/main.go | 9 +- controller/cmd/public-api/main.go | 9 - controller/cmd/telemetry/main.go | 54 -- .../gen/controller/telemetry/telemetry.pb.go | 299 -------- .../gen/proxy/telemetry/telemetry.pb.go | 702 ------------------ controller/gen/public/api.pb.go | 681 +++-------------- controller/telemetry/client.go | 15 - controller/telemetry/server.go | 453 ----------- controller/telemetry/server_test.go | 156 ---- docker-compose.yml | 20 - proto/controller/telemetry/telemetry.proto | 45 -- proto/proxy/telemetry/telemetry.proto | 106 --- proto/public/api.proto | 67 -- web/app/js/components/ServiceMesh.jsx | 2 - web/app/js/components/util/ApiHelpers.jsx | 2 +- web/app/test/ApiHelpersTest.jsx | 17 +- 38 files changed, 183 insertions(+), 4168 deletions(-) delete mode 100644 cli/cmd/stat.go delete mode 100644 cli/cmd/stat_test.go delete mode 100644 controller/api/proxy/client.go delete mode 100644 controller/cmd/telemetry/main.go delete mode 100644 controller/gen/controller/telemetry/telemetry.pb.go delete mode 100644 controller/gen/proxy/telemetry/telemetry.pb.go delete mode 100644 controller/telemetry/client.go delete mode 100644 controller/telemetry/server.go delete mode 100644 controller/telemetry/server_test.go delete mode 100644 proto/controller/telemetry/telemetry.proto delete mode 100644 proto/proxy/telemetry/telemetry.proto diff --git a/.prometheus.dev.yml b/.prometheus.dev.yml index 5d2f6defd5489..8900e99c8e53e 100644 --- a/.prometheus.dev.yml +++ b/.prometheus.dev.yml @@ -12,7 +12,6 @@ scrape_configs: - 'proxy-api:9996' - 'public-api:9995' - 'tap:9998' - - 'telemetry:9997' - 'web:9994' relabel_configs: - action: labelmap diff --git a/BUILD.md b/BUILD.md index d40f7de9d1f76..b4266fa0c0b41 100644 --- a/BUILD.md +++ b/BUILD.md @@ -41,8 +41,6 @@ written in Go. The dashboard UI is a React application. clients such as `cli` and `web`, provides access to and control of the conduit service mesh. - [`tap`](controller/tap): Provides a live pipeline of requests. - - [`telemetry`](controller/telemetry): Collects and aggregates - metrics from `proxy` componenets. - [`proxy-init`](proxy-init): Adds a Kubernetes pod to join the Conduit Service Mesh. - [`web`](web): Provides a UI dashboard to view and drive the control plane. @@ -70,7 +68,6 @@ conduit_components "proxy-api" [color=lightblue]; "public-api" [color=lightblue]; "tap" [color=lightblue]; - "telemetry" [color=lightblue]; "web" [color=lightblue]; "proxy" [color=orange]; @@ -83,16 +80,11 @@ conduit_components "proxy" -> "proxy-api"; "proxy-api" -> "destination"; - "proxy-api" -> "telemetry"; "public-api" -> "tap"; - "public-api" -> "telemetry"; "tap" -> "kubernetes"; "tap" -> "proxy"; - - "telemetry" -> "kubernetes"; - "telemetry" -> "prometheus"; } conduit_components diff --git a/bin/protoc-go.sh b/bin/protoc-go.sh index eedf2716db6b2..5d575313120f6 100755 --- a/bin/protoc-go.sh +++ b/bin/protoc-go.sh @@ -9,10 +9,8 @@ mkdir controller/gen bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/public/api.proto bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/common/common.proto bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/common/healthcheck/healthcheck.proto -bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/proxy/telemetry/telemetry.proto bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/proxy/destination/destination.proto bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/proxy/tap/tap.proto -bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/controller/telemetry/telemetry.proto bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/controller/tap/tap.proto # Manually fix imports @@ -22,4 +20,3 @@ find controller/gen -type f -exec sed -i.bak 's:"proxy/tap":"github.com\/runcond find controller/gen -type f -exec sed -i.bak 's:"controller/tap":"github.com\/runconduit\/conduit\/controller\/gen\/controller\/tap":g' {} + find controller/gen -type f -exec sed -i.bak 's:"public":"github.com\/runconduit\/conduit\/controller\/gen\/public":g' {} + find controller/gen -name '*.bak' -delete - diff --git a/cli/cmd/stat.go b/cli/cmd/stat.go deleted file mode 100644 index f558c05e1ba72..0000000000000 --- a/cli/cmd/stat.go +++ /dev/null @@ -1,214 +0,0 @@ -package cmd - -import ( - "bytes" - "context" - "errors" - "fmt" - "sort" - "strings" - "text/tabwriter" - - "github.com/runconduit/conduit/controller/api/util" - pb "github.com/runconduit/conduit/controller/gen/public" - "github.com/runconduit/conduit/pkg/k8s" - "github.com/spf13/cobra" -) - -const ConduitPaths = "paths" - -var target string -var timeWindow string - -var statCmd = &cobra.Command{ - Use: "stat [flags] deployment [TARGET]", - Short: "Display runtime statistics about mesh resources", - Long: `Display runtime statistics about mesh resources. - -Only deployment resources (aka deployments, deploy) are supported. - -The optional [TARGET] argument can be used to target a specific deployment.`, - Example: ` # get stats for all deployments - conduit stat deployments - - # get stats for the web deployment in the default namespace - conduit stat deploy default/web`, - RunE: func(cmd *cobra.Command, args []string) error { - var friendlyNameForResourceType string - - switch len(args) { - case 1: - friendlyNameForResourceType = args[0] - case 2: - friendlyNameForResourceType = args[0] - target = args[1] - default: - return errors.New("please specify a resource type") - } - - validatedResourceType, err := k8s.CanonicalKubernetesNameFromFriendlyName(friendlyNameForResourceType) - if err != nil { - return fmt.Errorf("invalid resource type %s, only %v are allowed as resource types", friendlyNameForResourceType, []string{k8s.KubernetesDeployments}) - } else { - switch friendlyNameForResourceType { - case "pods", "pod", "po", "paths", "path", "pa": - return fmt.Errorf("invalid resource type %s, only %v are allowed as resource types", friendlyNameForResourceType, []string{k8s.KubernetesDeployments}) - default: - } - } - client, err := newPublicAPIClient() - if err != nil { - return fmt.Errorf("error creating api client while making stats request: %v", err) - } - - output, err := requestStatsFromApi(client, validatedResourceType) - if err != nil { - return err - } - - _, err = fmt.Print(output) - - return err - }, -} - -func init() { - RootCmd.AddCommand(statCmd) - statCmd.PersistentFlags().StringVarP(&timeWindow, "time-window", "t", "1m", "Stat window (one of: \"10s\", \"1m\", \"10m\", \"1h\")") -} - -var resourceTypeToAggregationType = map[string]pb.AggregationType{ - k8s.KubernetesDeployments: pb.AggregationType_TARGET_DEPLOY, -} - -func requestStatsFromApi(client pb.ApiClient, resourceType string) (string, error) { - aggType := resourceTypeToAggregationType[resourceType] - req, err := buildMetricRequest(aggType) - if err != nil { - return "", fmt.Errorf("error creating metrics request while making stats request: %v", err) - } - - resp, err := client.Stat(context.Background(), req) - if err != nil { - return "", fmt.Errorf("error calling stat with request: %v", err) - } - - return renderStats(resp) -} - -func renderStats(resp *pb.MetricResponse) (string, error) { - var buffer bytes.Buffer - w := tabwriter.NewWriter(&buffer, 0, 0, padding, ' ', tabwriter.AlignRight) - writeStatsToBuffer(resp, w) - w.Flush() - - // strip left padding on the first column - out := string(buffer.Bytes()[padding:]) - out = strings.Replace(out, "\n"+strings.Repeat(" ", padding), "\n", -1) - - return out, nil -} - -const padding = 3 - -type row struct { - requestRate float64 - successRate float64 - latencyP50 int64 - latencyP99 int64 -} - -func writeStatsToBuffer(resp *pb.MetricResponse, w *tabwriter.Writer) { - nameHeader := "NAME" - maxNameLength := len(nameHeader) - - stats := make(map[string]*row) - for _, metric := range resp.Metrics { - if len(metric.Datapoints) == 0 { - continue - } - - metadata := *metric.Metadata - var name string - if metadata.TargetDeploy != "" { - name = metadata.TargetDeploy - } - - if len(name) > maxNameLength { - maxNameLength = len(name) - } - - if _, ok := stats[name]; !ok { - stats[name] = &row{} - } - - switch metric.Name { - case pb.MetricName_REQUEST_RATE: - stats[name].requestRate = metric.Datapoints[0].Value.GetGauge() - case pb.MetricName_SUCCESS_RATE: - stats[name].successRate = metric.Datapoints[0].Value.GetGauge() - case pb.MetricName_LATENCY: - for _, v := range metric.Datapoints[0].Value.GetHistogram().Values { - switch v.Label { - case pb.HistogramLabel_P50: - stats[name].latencyP50 = v.Value - case pb.HistogramLabel_P99: - stats[name].latencyP99 = v.Value - } - } - } - } - - fmt.Fprintln(w, strings.Join([]string{ - nameHeader + strings.Repeat(" ", maxNameLength-len(nameHeader)), - "REQUEST_RATE", - "SUCCESS_RATE", - "P50_LATENCY", - "P99_LATENCY\t", // trailing \t is required to format last column - }, "\t")) - - sortedNames := sortStatsKeys(stats) - for _, name := range sortedNames { - fmt.Fprintf( - w, - "%s\t%.1frps\t%.2f%%\t%dms\t%dms\t\n", - name+strings.Repeat(" ", maxNameLength-len(name)), - stats[name].requestRate, - stats[name].successRate*100, - stats[name].latencyP50, - stats[name].latencyP99, - ) - } -} - -func buildMetricRequest(aggregationType pb.AggregationType) (*pb.MetricRequest, error) { - var filterBy pb.MetricMetadata - window, err := util.GetWindow(timeWindow) - if err != nil { - return nil, err - } - if target != "all" && aggregationType == pb.AggregationType_TARGET_DEPLOY { - filterBy.TargetDeploy = target - } - - return &pb.MetricRequest{ - Metrics: []pb.MetricName{ - pb.MetricName_REQUEST_RATE, - pb.MetricName_SUCCESS_RATE, - pb.MetricName_LATENCY, - }, - Window: window, - FilterBy: &filterBy, - GroupBy: aggregationType, - Summarize: true, - }, nil -} - -func sortStatsKeys(stats map[string]*row) []string { - var sortedKeys []string - for key, _ := range stats { - sortedKeys = append(sortedKeys, key) - } - sort.Strings(sortedKeys) - return sortedKeys -} diff --git a/cli/cmd/stat_summary.go b/cli/cmd/stat_summary.go index 9b0cf37236f8a..95d1c9c1e6eab 100644 --- a/cli/cmd/stat_summary.go +++ b/cli/cmd/stat_summary.go @@ -17,13 +17,13 @@ import ( "k8s.io/api/core/v1" ) -var namespace, resourceType, resourceName string +var timeWindow, namespace, resourceType, resourceName string var outToNamespace, outToType, outToName string var outFromNamespace, outFromType, outFromName string var allNamespaces bool -var statSummaryCommand = &cobra.Command{ - Use: "statsummary [flags] RESOURCETYPE [RESOURCENAME]", +var statCmd = &cobra.Command{ + Use: "stat [flags] RESOURCETYPE [RESOURCENAME]", Short: "Display traffic stats about one or many resources", Long: `Display traffic stats about one or many resources. @@ -34,10 +34,10 @@ Valid resource types include: This command will hide resources that have completed, such as pods that are in the Succeeded or Failed phases. If no resource name is specified, displays stats about all resources of the specified RESOURCETYPE`, Example: ` # Get all deployments in the test namespace. - conduit statsummary deployments -n test + conduit stat deployments -n test # Get the hello1 deployment in the test namespace. - conduit statsummary deployments hello1 -n test`, + conduit stat deployments hello1 -n test`, Args: cobra.RangeArgs(1, 2), ValidArgs: []string{"deployment"}, RunE: func(cmd *cobra.Command, args []string) error { @@ -56,7 +56,7 @@ If no resource name is specified, displays stats about all resources of the spec return fmt.Errorf("error creating api client while making stats request: %v", err) } - output, err := requestStatSummaryFromAPI(client) + output, err := requestStatsFromApi(client) if err != nil { return err } @@ -68,19 +68,19 @@ If no resource name is specified, displays stats about all resources of the spec } func init() { - RootCmd.AddCommand(statSummaryCommand) - statSummaryCommand.PersistentFlags().StringVarP(&namespace, "namespace", "n", "default", "Namespace of the specified resource") - statSummaryCommand.PersistentFlags().StringVarP(&timeWindow, "time-window", "t", "1m", "Stat window (one of: \"10s\", \"1m\", \"10m\", \"1h\")") - statSummaryCommand.PersistentFlags().StringVar(&outToName, "out-to", "", "If present, restricts outbound stats to the specified resource name") - statSummaryCommand.PersistentFlags().StringVar(&outToNamespace, "out-to-namespace", "", "Sets the namespace used to lookup the \"--out-to\" resource; by default the current \"--namespace\" is used") - statSummaryCommand.PersistentFlags().StringVar(&outToType, "out-to-resource", "", "If present, restricts outbound stats to the specified resource type") - statSummaryCommand.PersistentFlags().StringVar(&outFromName, "out-from", "", "If present, restricts outbound stats to the specified resource name") - statSummaryCommand.PersistentFlags().StringVar(&outFromNamespace, "out-from-namespace", "", "Sets the namespace used to lookup the \"--out-from\" resource; by default the current \"--namespace\" is used") - statSummaryCommand.PersistentFlags().StringVar(&outFromType, "out-from-resource", "", "If present, restricts outbound stats to the specified resource type") - statSummaryCommand.PersistentFlags().BoolVar(&allNamespaces, "all-namespaces", false, "If present, returns stats across all namespaces, ignoring the \"--namespace\" flag") + RootCmd.AddCommand(statCmd) + statCmd.PersistentFlags().StringVarP(&namespace, "namespace", "n", "default", "Namespace of the specified resource") + statCmd.PersistentFlags().StringVarP(&timeWindow, "time-window", "t", "1m", "Stat window (one of: \"10s\", \"1m\", \"10m\", \"1h\")") + statCmd.PersistentFlags().StringVar(&outToName, "out-to", "", "If present, restricts outbound stats to the specified resource name") + statCmd.PersistentFlags().StringVar(&outToNamespace, "out-to-namespace", "", "Sets the namespace used to lookup the \"--out-to\" resource; by default the current \"--namespace\" is used") + statCmd.PersistentFlags().StringVar(&outToType, "out-to-resource", "", "If present, restricts outbound stats to the specified resource type") + statCmd.PersistentFlags().StringVar(&outFromName, "out-from", "", "If present, restricts outbound stats to the specified resource name") + statCmd.PersistentFlags().StringVar(&outFromNamespace, "out-from-namespace", "", "Sets the namespace used to lookup the \"--out-from\" resource; by default the current \"--namespace\" is used") + statCmd.PersistentFlags().StringVar(&outFromType, "out-from-resource", "", "If present, restricts outbound stats to the specified resource type") + statCmd.PersistentFlags().BoolVar(&allNamespaces, "all-namespaces", false, "If present, returns stats across all namespaces, ignoring the \"--namespace\" flag") } -func requestStatSummaryFromAPI(client pb.ApiClient) (string, error) { +func requestStatsFromApi(client pb.ApiClient) (string, error) { req, err := buildStatSummaryRequest() if err != nil { @@ -92,14 +92,13 @@ func requestStatSummaryFromAPI(client pb.ApiClient) (string, error) { return "", fmt.Errorf("error calling stat with request: %v", err) } - return renderStatSummary(resp), nil + return renderStats(resp), nil } -func renderStatSummary(resp *pb.StatSummaryResponse) string { +func renderStats(resp *pb.StatSummaryResponse) string { var buffer bytes.Buffer w := tabwriter.NewWriter(&buffer, 0, 0, padding, ' ', tabwriter.AlignRight) - - writeStatTableToBuffer(resp, w) + writeStatsToBuffer(resp, w) w.Flush() // strip left padding on the first column @@ -109,7 +108,9 @@ func renderStatSummary(resp *pb.StatSummaryResponse) string { return out } -type summaryRow struct { +const padding = 3 + +type row struct { meshed string requestRate float64 successRate float64 @@ -118,13 +119,13 @@ type summaryRow struct { latencyP99 uint64 } -func writeStatTableToBuffer(resp *pb.StatSummaryResponse, w *tabwriter.Writer) { +func writeStatsToBuffer(resp *pb.StatSummaryResponse, w *tabwriter.Writer) { nameHeader := "NAME" maxNameLength := len(nameHeader) namespaceHeader := "NAMESPACE" maxNamespaceLength := len(namespaceHeader) - stats := make(map[string]*summaryRow) + stats := make(map[string]*row) for _, statTable := range resp.GetOk().StatTables { table := statTable.GetPodGroup() @@ -141,7 +142,7 @@ func writeStatTableToBuffer(resp *pb.StatSummaryResponse, w *tabwriter.Writer) { maxNamespaceLength = len(namespace) } - stats[key] = &summaryRow{ + stats[key] = &row{ meshed: fmt.Sprintf("%d/%d", r.MeshedPodCount, r.TotalPodCount), } @@ -171,7 +172,7 @@ func writeStatTableToBuffer(resp *pb.StatSummaryResponse, w *tabwriter.Writer) { }...) fmt.Fprintln(w, strings.Join(headers, "\t")) - sortedKeys := sortStatSummaryKeys(stats) + sortedKeys := sortStatsKeys(stats) for _, key := range sortedKeys { parts := strings.Split(key, "/") namespace := parts[0] @@ -249,7 +250,7 @@ func getSuccessRate(r pb.StatTable_PodGroup_Row) float64 { return float64(success) / float64(success+failure) } -func sortStatSummaryKeys(stats map[string]*summaryRow) []string { +func sortStatsKeys(stats map[string]*row) []string { var sortedKeys []string for key := range stats { sortedKeys = append(sortedKeys, key) diff --git a/cli/cmd/stat_test.go b/cli/cmd/stat_test.go deleted file mode 100644 index 773fb8df3e191..0000000000000 --- a/cli/cmd/stat_test.go +++ /dev/null @@ -1,234 +0,0 @@ -package cmd - -import ( - "errors" - "fmt" - "io/ioutil" - "math/rand" - "strings" - "testing" - - "github.com/runconduit/conduit/controller/api/public" - pb "github.com/runconduit/conduit/controller/gen/public" - "github.com/runconduit/conduit/pkg/k8s" - "github.com/stretchr/testify/assert" -) - -func TestRequestStatsFromApi(t *testing.T) { - t.Run("Returns string output containing the data returned by the API", func(t *testing.T) { - mockClient := &public.MockConduitApiClient{} - - deployName := "deployment-1" - metricDatapoints := []*pb.MetricDatapoint{ - { - Value: &pb.MetricValue{ - Value: &pb.MetricValue_Counter{ - Counter: 666, - }, - }, - }, - } - series := []*pb.MetricSeries{ - { - Name: pb.MetricName_SUCCESS_RATE, - Metadata: &pb.MetricMetadata{ - TargetDeploy: deployName, - }, - Datapoints: metricDatapoints, - }, - } - mockClient.MetricResponseToReturn = &pb.MetricResponse{ - Metrics: series, - } - - stats, err := requestStatsFromApi(mockClient, k8s.KubernetesDeployments) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - - if !strings.Contains(stats, deployName) { - t.Fatalf("Expected response to contain [%s], but was [%s]", deployName, stats) - } - }) - - t.Run("Returns error if API call failed", func(t *testing.T) { - mockClient := &public.MockConduitApiClient{} - mockClient.ErrorToReturn = errors.New("Expected") - output, err := requestStatsFromApi(mockClient, k8s.KubernetesPods) - - if err == nil { - t.Fatalf("Expected error, got nothing but the output [%s]", output) - } - }) -} - -func TestRenderStats(t *testing.T) { - t.Run("Prints stats correctly for example with one entry", func(t *testing.T) { - allSeries := make([]*pb.MetricSeries, 0) - seriesForPodX := generateMetricSeriesFor(fmt.Sprintf("deployment-%d", 66), int64(10)) - allSeries = append(allSeries, seriesForPodX...) - - //shuffles - for i := range allSeries { - j := rand.Intn(i + 1) - allSeries[i], allSeries[j] = allSeries[j], allSeries[i] - } - - response := &pb.MetricResponse{ - Metrics: allSeries, - } - - renderedStats, err := renderStats(response) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - - goldenFileBytes, err := ioutil.ReadFile("testdata/stat_one_output.golden") - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - - expectedContent := string(goldenFileBytes) - - if expectedContent != renderedStats { - t.Fatalf("Expected function to render:\n%s\bbut got:\n%s", expectedContent, renderedStats) - } - }) - - t.Run("Prints stats correctly for busy example", func(t *testing.T) { - allSeries := make([]*pb.MetricSeries, 0) - for i := 0; i < 10; i++ { - seriesForDeployX := generateMetricSeriesFor(fmt.Sprintf("deployment-%d", i), int64(i)) - allSeries = append(allSeries, seriesForDeployX...) - } - - //shuffles - for i := range allSeries { - j := rand.Intn(i + 1) - allSeries[i], allSeries[j] = allSeries[j], allSeries[i] - } - - response := &pb.MetricResponse{ - Metrics: allSeries, - } - - renderedStats, err := renderStats(response) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - - goldenFileBytes, err := ioutil.ReadFile("testdata/stat_busy_output.golden") - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - - expectedContent := string(goldenFileBytes) - - if expectedContent != renderedStats { - t.Fatalf("Expected function to render:\n%s\bbut got:\n%s", expectedContent, renderedStats) - } - }) - - t.Run("Prints stats correctly for empty example", func(t *testing.T) { - response := &pb.MetricResponse{ - Metrics: make([]*pb.MetricSeries, 0), - } - - renderedStats, err := renderStats(response) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - - goldenFileBytes, err := ioutil.ReadFile("testdata/stat_empty_output.golden") - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - - expectedContent := string(goldenFileBytes) - - if expectedContent != renderedStats { - t.Fatalf("Expected function to render:\n%s\bbut got:\n%s", expectedContent, renderedStats) - } - }) -} - -func TestSortStatsKeys(t *testing.T) { - t.Run("Sorts the keys alphabetically", func(t *testing.T) { - unsorted := map[string]*row{ - "kube-system/heapster-v1.4.3": {0.008091, 24.137931, 516666, 990333}, - "test/backend4": {0.066121, 38.818565, 494553, 989891}, - "test/hello10": {0.000000, 0.000000, 0, 0}, - "test/world-deploy1": {0.051893, 33.870968, 510526, 990210}, - "test/world-deploy2": {2.504800, 33.749165, 497249, 989944}, - "kube-system/kubernetes-dashboard": {0.017856, 39.062500, 520000, 990400}, - "other/grafana": {0.060557, 35.944212, 518960, 990379}, - "kube-system/l7-default-backend": {0.020371, 31.508049, 516923, 990338}, - } - - expected := []string{"kube-system/heapster-v1.4.3", "kube-system/kubernetes-dashboard", "kube-system/l7-default-backend", - "other/grafana", "test/backend4", "test/hello10", "test/world-deploy1", "test/world-deploy2"} - - sorted := sortStatsKeys(unsorted) - assert.Equal(t, expected, sorted, "Not Sorted!") - }) -} - -func generateMetricSeriesFor(deployName string, seed int64) []*pb.MetricSeries { - metricDatapoints := []*pb.MetricDatapoint{ - { - Value: &pb.MetricValue{ - Value: &pb.MetricValue_Gauge{ - Gauge: float64(seed) / 10, - }, - }, - }, - } - latencyHistogram := []*pb.MetricDatapoint{ - { - Value: &pb.MetricValue{ - Value: &pb.MetricValue_Histogram{ - Histogram: &pb.Histogram{ - Values: []*pb.HistogramValue{ - { - Label: pb.HistogramLabel_P50, - Value: 1 + seed, - }, - { - Label: pb.HistogramLabel_P99, - Value: 9 + seed, - }, - { - Label: pb.HistogramLabel_P95, - Value: 5 + seed, - }, - }, - }, - }, - }, - }, - } - series := []*pb.MetricSeries{ - { - Name: pb.MetricName_REQUEST_RATE, - Metadata: &pb.MetricMetadata{ - TargetDeploy: deployName, - }, - Datapoints: metricDatapoints, - }, - { - Name: pb.MetricName_SUCCESS_RATE, - Metadata: &pb.MetricMetadata{ - TargetDeploy: deployName, - }, - Datapoints: metricDatapoints, - }, - { - Name: pb.MetricName_LATENCY, - Metadata: &pb.MetricMetadata{ - TargetDeploy: deployName, - }, - Datapoints: latencyHistogram, - }, - } - return series -} diff --git a/cli/cmd/testdata/install_default.golden b/cli/cmd/testdata/install_default.golden index f99b7a3d0cb16..345042c8f9898 100755 --- a/cli/cmd/testdata/install_default.golden +++ b/cli/cmd/testdata/install_default.golden @@ -194,21 +194,6 @@ spec: - containerPort: 9998 name: admin-http resources: {} - - args: - - telemetry - - -ignore-namespaces=kube-system - - -prometheus-url=http://prometheus.conduit.svc.cluster.local:9090 - - -log-level=info - - -logtostderr=true - image: gcr.io/runconduit/controller:undefined - imagePullPolicy: IfNotPresent - name: telemetry - ports: - - containerPort: 8087 - name: grpc - - containerPort: 9997 - name: admin-http - resources: {} - env: - name: CONDUIT_PROXY_LOG value: warn,conduit_proxy=info @@ -527,21 +512,6 @@ data: static_configs: - targets: ['localhost:9090'] - - job_name: 'controller' - kubernetes_sd_configs: - - role: pod - namespaces: - names: ['conduit'] - relabel_configs: - - source_labels: [__meta_kubernetes_pod_container_port_name] - action: keep - regex: ^admin-http$ - - source_labels: [__meta_kubernetes_pod_container_name] - action: replace - target_label: job - - # Double collect control-plane pods, In #499 we will remove the - # "controller" job above in favor of these two below. - job_name: 'conduit-controller' kubernetes_sd_configs: - role: pod diff --git a/cli/cmd/testdata/install_output.golden b/cli/cmd/testdata/install_output.golden index c7b12a902f687..22ecf7e4221c7 100644 --- a/cli/cmd/testdata/install_output.golden +++ b/cli/cmd/testdata/install_output.golden @@ -195,21 +195,6 @@ spec: - containerPort: 9998 name: admin-http resources: {} - - args: - - telemetry - - -ignore-namespaces=kube-system - - -prometheus-url=http://prometheus.Namespace.svc.cluster.local:9090 - - -log-level=ControllerLogLevel - - -logtostderr=true - image: ControllerImage - imagePullPolicy: ImagePullPolicy - name: telemetry - ports: - - containerPort: 8087 - name: grpc - - containerPort: 9997 - name: admin-http - resources: {} - env: - name: CONDUIT_PROXY_LOG value: warn,conduit_proxy=info @@ -530,21 +515,6 @@ data: static_configs: - targets: ['localhost:9090'] - - job_name: 'controller' - kubernetes_sd_configs: - - role: pod - namespaces: - names: ['Namespace'] - relabel_configs: - - source_labels: [__meta_kubernetes_pod_container_port_name] - action: keep - regex: ^admin-http$ - - source_labels: [__meta_kubernetes_pod_container_name] - action: replace - target_label: job - - # Double collect control-plane pods, In #499 we will remove the - # "controller" job above in favor of these two below. - job_name: 'conduit-controller' kubernetes_sd_configs: - role: pod diff --git a/cli/install/template.go b/cli/install/template.go index b5e684af5e2a6..4f3b3d056fd6f 100644 --- a/cli/install/template.go +++ b/cli/install/template.go @@ -188,20 +188,6 @@ spec: - "tap" - "-log-level={{.ControllerLogLevel}}" - "-logtostderr=true" - - name: telemetry - ports: - - name: grpc - containerPort: 8087 - - name: admin-http - containerPort: 9997 - image: {{.ControllerImage}} - imagePullPolicy: {{.ImagePullPolicy}} - args: - - "telemetry" - - "-ignore-namespaces=kube-system" - - "-prometheus-url=http://prometheus.{{.Namespace}}.svc.cluster.local:9090" - - "-log-level={{.ControllerLogLevel}}" - - "-logtostderr=true" ### Web ### --- @@ -342,21 +328,6 @@ data: static_configs: - targets: ['localhost:9090'] - - job_name: 'controller' - kubernetes_sd_configs: - - role: pod - namespaces: - names: ['{{.Namespace}}'] - relabel_configs: - - source_labels: [__meta_kubernetes_pod_container_port_name] - action: keep - regex: ^admin-http$ - - source_labels: [__meta_kubernetes_pod_container_name] - action: replace - target_label: job - - # Double collect control-plane pods, In #499 we will remove the - # "controller" job above in favor of these two below. - job_name: 'conduit-controller' kubernetes_sd_configs: - role: pod diff --git a/controller/api/proxy/client.go b/controller/api/proxy/client.go deleted file mode 100644 index 6a3db2b09cb4f..0000000000000 --- a/controller/api/proxy/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package proxy - -import ( - pb "github.com/runconduit/conduit/controller/gen/proxy/telemetry" - "google.golang.org/grpc" -) - -func NewTelemetryClient(addr string) (pb.TelemetryClient, *grpc.ClientConn, error) { - conn, err := grpc.Dial(addr, grpc.WithInsecure()) - if err != nil { - return nil, nil, err - } - - return pb.NewTelemetryClient(conn), conn, nil -} diff --git a/controller/api/proxy/server.go b/controller/api/proxy/server.go index ea558d6d3f6e4..015b2973b5c5b 100644 --- a/controller/api/proxy/server.go +++ b/controller/api/proxy/server.go @@ -1,13 +1,11 @@ package proxy import ( - "context" "io" "net" common "github.com/runconduit/conduit/controller/gen/common" destination "github.com/runconduit/conduit/controller/gen/proxy/destination" - telemetry "github.com/runconduit/conduit/controller/gen/proxy/telemetry" "github.com/runconduit/conduit/controller/util" log "github.com/sirupsen/logrus" "google.golang.org/grpc" @@ -15,23 +13,10 @@ import ( type ( server struct { - telemetryClient telemetry.TelemetryClient destinationClient destination.DestinationClient } ) -func (s *server) Report(ctx context.Context, req *telemetry.ReportRequest) (*telemetry.ReportResponse, error) { - log.Debug("Report") - - resp, err := s.telemetryClient.Report(ctx, req) - if err != nil { - log.Errorf("Report: %v", err) - return nil, err - } - - return resp, nil -} - func (s *server) Get(dest *common.Destination, stream destination.Destination_GetServer) error { log := log.WithFields( log.Fields{ @@ -67,15 +52,14 @@ func (s *server) Get(dest *common.Destination, stream destination.Destination_Ge * The Proxy-API server accepts requests from proxy instances and forwards those * requests to the appropriate controller service. */ -func NewServer(addr string, telemetryClient telemetry.TelemetryClient, destinationClient destination.DestinationClient) (*grpc.Server, net.Listener, error) { +func NewServer(addr string, destinationClient destination.DestinationClient) (*grpc.Server, net.Listener, error) { lis, err := net.Listen("tcp", addr) if err != nil { return nil, nil, err } s := util.NewGrpcServer() - srv := server{telemetryClient: telemetryClient, destinationClient: destinationClient} - telemetry.RegisterTelemetryServer(s, &srv) + srv := server{destinationClient: destinationClient} destination.RegisterDestinationServer(s, &srv) return s, lis, nil diff --git a/controller/api/public/client.go b/controller/api/public/client.go index 56483ace62389..b9b58a0c3af96 100644 --- a/controller/api/public/client.go +++ b/controller/api/public/client.go @@ -30,12 +30,6 @@ type grpcOverHttpClient struct { httpClient *http.Client } -func (c *grpcOverHttpClient) Stat(ctx context.Context, req *pb.MetricRequest, _ ...grpc.CallOption) (*pb.MetricResponse, error) { - var msg pb.MetricResponse - err := c.apiRequest(ctx, "Stat", req, &msg) - return &msg, err -} - // TODO: This will replace Stat, once implemented func (c *grpcOverHttpClient) StatSummary(ctx context.Context, req *pb.StatSummaryRequest, _ ...grpc.CallOption) (*pb.StatSummaryResponse, error) { var msg pb.StatSummaryResponse diff --git a/controller/api/public/client_test.go b/controller/api/public/client_test.go index 98c3cd99af01f..71aa95f7f7d3c 100644 --- a/controller/api/public/client_test.go +++ b/controller/api/public/client_test.go @@ -4,11 +4,11 @@ import ( "bufio" "bytes" "context" + "fmt" "io/ioutil" "net/http" "net/url" "testing" - "time" "github.com/golang/protobuf/proto" pb "github.com/runconduit/conduit/controller/gen/public" @@ -79,32 +79,42 @@ func TestFromByteStreamToProtocolBuffers(t *testing.T) { }) t.Run("Correctly marshalls a large byte array", func(t *testing.T) { - series := pb.MetricSeries{ - Name: pb.MetricName_REQUEST_RATE, - Metadata: &pb.MetricMetadata{}, - Datapoints: make([]*pb.MetricDatapoint, 0), - } - - numberOfDatapointsInMessage := 400 - for i := 0; i < numberOfDatapointsInMessage; i++ { - datapoint := pb.MetricDatapoint{ - Value: &pb.MetricValue{Value: &pb.MetricValue_Gauge{Gauge: float64(i)}}, - TimestampMs: time.Now().UnixNano() / int64(time.Millisecond), - } - series.Datapoints = append(series.Datapoints, &datapoint) - } - reader := bufferedReader(t, &series) - - protobufMessageToBeFilledWithData := &pb.MetricSeries{} + rows := make([]*pb.StatTable_PodGroup_Row, 0) + + numberOfResourcesInMessage := 400 + for i := 0; i < numberOfResourcesInMessage; i++ { + rows = append(rows, &pb.StatTable_PodGroup_Row{ + Resource: &pb.Resource{ + Namespace: "default", + Name: fmt.Sprintf("deployment%d", i), + Type: "deployment", + }, + }) + } + + msg := pb.StatSummaryResponse{ + Response: &pb.StatSummaryResponse_Ok_{ + Ok: &pb.StatSummaryResponse_Ok{ + StatTables: []*pb.StatTable{ + &pb.StatTable{ + Table: &pb.StatTable_PodGroup_{ + PodGroup: &pb.StatTable_PodGroup{ + Rows: rows, + }, + }, + }, + }, + }, + }, + } + + reader := bufferedReader(t, &msg) + + protobufMessageToBeFilledWithData := &pb.StatSummaryResponse{} err := fromByteStreamToProtocolBuffers(reader, protobufMessageToBeFilledWithData) if err != nil { t.Fatalf("Unexpected error: %v", err) } - - actualNumberOfDatapointsMarshalled := len(protobufMessageToBeFilledWithData.Datapoints) - if actualNumberOfDatapointsMarshalled != numberOfDatapointsInMessage { - t.Fatalf("Expected marshalling to return [%d] datapoints, but got [%d]", numberOfDatapointsInMessage, actualNumberOfDatapointsMarshalled) - } }) t.Run("When byte array contains error, treats stream as regular protobuf object", func(t *testing.T) { @@ -133,7 +143,7 @@ func TestFromByteStreamToProtocolBuffers(t *testing.T) { reader := bufferedReader(t, versionInfo) - protobufMessageToBeFilledWithData := &pb.MetricSeries{} + protobufMessageToBeFilledWithData := &pb.StatSummaryResponse{} err := fromByteStreamToProtocolBuffers(reader, protobufMessageToBeFilledWithData) if err == nil { t.Fatal("Expecting error, got nothing") diff --git a/controller/api/public/grpc_server.go b/controller/api/public/grpc_server.go index 8ddf21588da93..207adfd364d98 100644 --- a/controller/api/public/grpc_server.go +++ b/controller/api/public/grpc_server.go @@ -3,18 +3,13 @@ package public import ( "context" "fmt" - "math" "runtime" - "sort" - "strings" "time" "github.com/golang/protobuf/ptypes/duration" promv1 "github.com/prometheus/client_golang/api/prometheus/v1" - "github.com/runconduit/conduit/controller/api/util" healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck" tapPb "github.com/runconduit/conduit/controller/gen/controller/tap" - telemPb "github.com/runconduit/conduit/controller/gen/controller/telemetry" pb "github.com/runconduit/conduit/controller/gen/public" pkgK8s "github.com/runconduit/conduit/pkg/k8s" "github.com/runconduit/conduit/pkg/version" @@ -28,7 +23,6 @@ import ( type ( grpcServer struct { prometheusAPI promv1.API - telemetryClient telemPb.TelemetryClient tapClient tapPb.TapClient deployLister applisters.DeploymentLister replicaSetLister applisters.ReplicaSetLister @@ -36,76 +30,18 @@ type ( controllerNamespace string ignoredNamespaces []string } - - successRate struct { - success float64 - failure float64 - } - - // these structs couple responses with an error, useful when returning results via channels - metricResult struct { - series []pb.MetricSeries - err error - } - queryResult struct { - res telemPb.QueryResponse - err error - } - queryResultWithLabel struct { - label pb.HistogramLabel - queryResult - } - - // sortable slice of unix ms timestamps - timestamps []int64 ) const ( podQuery = "sum(request_total) by (pod)" - countQuery = "sum(irate(responses_total{%s}[%s])) by (%s)" - countHttpQuery = "sum(irate(http_requests_total{%s}[%s])) by (%s)" - countGrpcQuery = "sum(irate(grpc_server_handled_total{%s}[%s])) by (%s)" - latencyQuery = "sum(irate(response_latency_ms_bucket{%s}[%s])) by (%s)" - quantileQuery = "histogram_quantile(%s, %s)" - defaultVectorRange = "30s" // 3x scrape_interval in prometheus config - targetPodLabel = "target" - targetDeployLabel = "target_deployment" - sourcePodLabel = "source" - sourceDeployLabel = "source_deployment" - jobLabel = "job" K8sClientSubsystemName = "kubernetes" K8sClientCheckDescription = "control plane can talk to Kubernetes" PromClientSubsystemName = "prometheus" PromClientCheckDescription = "control plane can talk to Prometheus" ) -var ( - quantileMap = map[string]pb.HistogramLabel{ - "0.5": pb.HistogramLabel_P50, - "0.95": pb.HistogramLabel_P95, - "0.99": pb.HistogramLabel_P99, - } - - stepMap = map[pb.TimeWindow]string{ - pb.TimeWindow_TEN_SEC: "10s", - pb.TimeWindow_ONE_MIN: "10s", - pb.TimeWindow_TEN_MIN: "10s", - pb.TimeWindow_ONE_HOUR: "1m", - } - - aggregationMap = map[pb.AggregationType]string{ - pb.AggregationType_TARGET_DEPLOY: targetDeployLabel, - pb.AggregationType_SOURCE_DEPLOY: sourceDeployLabel, - pb.AggregationType_MESH: jobLabel, - } - - emptyMetadata = pb.MetricMetadata{} - controlPlaneComponents = []string{"web", "controller", "prometheus", "grafana"} -) - func newGrpcServer( promAPI promv1.API, - telemetryClient telemPb.TelemetryClient, tapClient tapPb.TapClient, deployLister applisters.DeploymentLister, replicaSetLister applisters.ReplicaSetLister, @@ -115,7 +51,6 @@ func newGrpcServer( ) *grpcServer { return &grpcServer{ prometheusAPI: promAPI, - telemetryClient: telemetryClient, tapClient: tapClient, deployLister: deployLister, replicaSetLister: replicaSetLister, @@ -125,65 +60,6 @@ func newGrpcServer( } } -func (s *grpcServer) Stat(ctx context.Context, req *pb.MetricRequest) (*pb.MetricResponse, error) { - var err error - resultsCh := make(chan metricResult) - metrics := make([]*pb.MetricSeries, 0) - - // kick off requests - for _, metric := range req.Metrics { - go func(metric pb.MetricName) { resultsCh <- s.queryMetric(ctx, req, metric) }(metric) - } - - // process results - for _ = range req.Metrics { - result := <-resultsCh - if result.err != nil { - log.Errorf("Stat -> queryMetric failed with: %s", result.err) - err = result.err - } else { - for i := range result.series { - metrics = append(metrics, &result.series[i]) - } - } - } - - // if an error occurred, return the error, along with partial results - return &pb.MetricResponse{Metrics: metrics}, err -} - -func (s *grpcServer) queryMetric(ctx context.Context, req *pb.MetricRequest, metric pb.MetricName) metricResult { - - result := metricResult{} - - switch metric { - case pb.MetricName_REQUEST_RATE: - if req.GroupBy == pb.AggregationType_MESH { - result.series, result.err = s.requestRateMesh(ctx, req) - } else { - result.series, result.err = s.requestRate(ctx, req) - } - case pb.MetricName_SUCCESS_RATE: - if req.GroupBy == pb.AggregationType_MESH { - result.series, result.err = s.successRateMesh(ctx, req) - } else { - result.series, result.err = s.successRate(ctx, req) - } - case pb.MetricName_LATENCY: - if req.GroupBy == pb.AggregationType_MESH { - result.series = nil - result.err = fmt.Errorf("latency not supported for MESH queries") - } else { - result.series, result.err = s.latency(ctx, req) - } - default: - result.series = nil - result.err = fmt.Errorf("unsupported metric: %s", metric) - } - - return result -} - func (_ *grpcServer) Version(ctx context.Context, req *pb.Empty) (*pb.VersionInfo, error) { return &pb.VersionInfo{GoVersion: runtime.Version(), ReleaseVersion: version.Version, BuildDate: "1970-01-01T00:00:00Z"}, nil } @@ -315,223 +191,6 @@ func (s *grpcServer) Tap(req *pb.TapRequest, stream pb.Api_TapServer) error { } } -func (s *grpcServer) requestRate(ctx context.Context, req *pb.MetricRequest) ([]pb.MetricSeries, error) { - result := s.queryCount(ctx, req, countQuery, "") - if result.err != nil { - return nil, result.err - } - - return processRequestRate(result.res.Metrics, extractMetadata) -} - -func (s *grpcServer) requestRateMesh(ctx context.Context, req *pb.MetricRequest) ([]pb.MetricSeries, error) { - var err error - resultsCh := make(chan queryResult) - metrics := make([]*telemPb.Sample, 0) - - // kick off requests - go func() { resultsCh <- s.queryCount(ctx, req, countHttpQuery, "") }() - go func() { resultsCh <- s.queryCount(ctx, req, countGrpcQuery, "") }() - - // process results, loop twice, for countHttpQuery and countGrpcQuery - for i := 0; i < 2; i++ { - result := <-resultsCh - if result.err != nil { - log.Errorf("requestRateMesh -> queryCount failed with: %s", err) - err = result.err - } else { - metrics = append(metrics, result.res.Metrics...) - } - } - - // if any errors occurred, return no results - if err != nil { - return nil, err - } - - return processRequestRate(metrics, extractMetadataMesh) -} - -func (s *grpcServer) successRate(ctx context.Context, req *pb.MetricRequest) ([]pb.MetricSeries, error) { - result := s.queryCount(ctx, req, countQuery, "classification") - if result.err != nil { - return nil, result.err - } - - return processSuccessRate(result.res.Metrics, extractMetadata, isSuccess) -} - -func (s *grpcServer) successRateMesh(ctx context.Context, req *pb.MetricRequest) ([]pb.MetricSeries, error) { - var err error - resultsCh := make(chan queryResult) - metrics := make([]*telemPb.Sample, 0) - - // kick off requests - go func() { resultsCh <- s.queryCount(ctx, req, countHttpQuery, "code") }() - go func() { resultsCh <- s.queryCount(ctx, req, countGrpcQuery, "grpc_code") }() - - // process results, loop twice, for countHttpQuery and countGrpcQuery - for i := 0; i < 2; i++ { - result := <-resultsCh - if result.err != nil { - log.Errorf("successRateMesh -> queryCount failed with: %s", err) - err = result.err - } else { - metrics = append(metrics, result.res.Metrics...) - } - } - - // if any errors occurred, return no results - if err != nil { - return nil, err - } - - return processSuccessRate(metrics, extractMetadataMesh, isSuccessMesh) -} - -func (s *grpcServer) latency(ctx context.Context, req *pb.MetricRequest) ([]pb.MetricSeries, error) { - timestamps := make(map[int64]struct{}) - latencies := make(map[pb.MetricMetadata]map[int64][]*pb.HistogramValue) - series := make([]pb.MetricSeries, 0) - - queryRsps, err := s.queryLatency(ctx, req) - if err != nil { - return nil, err - } - - for label, queryRsp := range queryRsps { - for _, metric := range queryRsp.Metrics { - if len(metric.Values) == 0 { - continue - } - - metadata := extractMetadata(metric) - if metadata == emptyMetadata { - continue - } - - if _, ok := latencies[metadata]; !ok { - latencies[metadata] = make(map[int64][]*pb.HistogramValue) - } - - for _, value := range metric.Values { - if math.IsNaN(value.Value) { - continue - } - timestamp := value.TimestampMs - timestamps[timestamp] = struct{}{} - - if _, ok := latencies[metadata][timestamp]; !ok { - latencies[metadata][timestamp] = make([]*pb.HistogramValue, 0) - } - hv := &pb.HistogramValue{ - Label: label, - Value: int64(value.Value), - } - latencies[metadata][timestamp] = append(latencies[metadata][timestamp], hv) - } - } - } - - sortedTimestamps := sortTimestamps(timestamps) - - for metadata, latenciesByTime := range latencies { - m := metadata - datapoints := make([]*pb.MetricDatapoint, 0) - for _, ts := range sortedTimestamps { - if histogram, ok := latenciesByTime[ts]; ok { - datapoint := &pb.MetricDatapoint{ - Value: &pb.MetricValue{ - Value: &pb.MetricValue_Histogram{ - Histogram: &pb.Histogram{Values: histogram}, - }, - }, - TimestampMs: ts, - } - datapoints = append(datapoints, datapoint) - } - } - - s := pb.MetricSeries{ - Name: pb.MetricName_LATENCY, - Metadata: &m, - Datapoints: datapoints, - } - series = append(series, s) - } - - return series, nil -} - -func (s *grpcServer) queryCount(ctx context.Context, req *pb.MetricRequest, rawQuery, sumBy string) queryResult { - query, err := formatQuery(rawQuery, req, sumBy, s.controllerNamespace) - if err != nil { - return queryResult{res: telemPb.QueryResponse{}, err: err} - } - - queryReq, err := reqToQueryReq(req, query) - if err != nil { - return queryResult{res: telemPb.QueryResponse{}, err: err} - } - - return s.query(ctx, queryReq) -} - -func (s *grpcServer) queryLatency(ctx context.Context, req *pb.MetricRequest) (map[pb.HistogramLabel]telemPb.QueryResponse, error) { - queryRsps := make(map[pb.HistogramLabel]telemPb.QueryResponse) - - query, err := formatQuery(latencyQuery, req, "le", s.controllerNamespace) - if err != nil { - return nil, err - } - - // omit query string, we'll fill it in later - queryReq, err := reqToQueryReq(req, "") - if err != nil { - return nil, err - } - - results := make(chan queryResultWithLabel) - - // kick off requests - for quantile, label := range quantileMap { - go func(quantile string, label pb.HistogramLabel) { - // copy queryReq, gets us StartMS, EndMS, and Step - qr := queryReq - // insert our quantile-specific query - qr.Query = fmt.Sprintf(quantileQuery, quantile, query) - - results <- queryResultWithLabel{ - queryResult: s.query(ctx, qr), - label: label, - } - }(quantile, label) - } - - // process results - for _ = range quantileMap { - result := <-results - if result.err != nil { - log.Errorf("queryLatency -> query failed with: %s", err) - err = result.err - } else { - queryRsps[result.label] = result.res - } - } - - // if an error occurred, return the error, along with partial results - return queryRsps, err -} - -func (s *grpcServer) query(ctx context.Context, queryReq telemPb.QueryRequest) queryResult { - queryRsp, err := s.telemetryClient.Query(ctx, &queryReq) - if err != nil { - return queryResult{res: telemPb.QueryResponse{}, err: err} - } - - return queryResult{res: *queryRsp, err: nil} -} - func (s *grpcServer) shouldIgnore(pod *k8sV1.Pod) bool { for _, namespace := range s.ignoredNamespaces { if pod.Namespace == namespace { @@ -570,239 +229,3 @@ func (s *grpcServer) getDeploymentFor(pod *k8sV1.Pod) (string, error) { return "", fmt.Errorf("Pod %s owner is not a Deployment", pod.Name) } - -func reqToQueryReq(req *pb.MetricRequest, query string) (telemPb.QueryRequest, error) { - start, end, step, err := queryParams(req) - if err != nil { - return telemPb.QueryRequest{}, err - } - - // EndMs always required to ensure deterministic timestamps - queryReq := telemPb.QueryRequest{ - Query: query, - EndMs: end, - } - - if !req.Summarize { - queryReq.StartMs = start - queryReq.Step = step - } - - return queryReq, nil -} - -func formatQuery(query string, req *pb.MetricRequest, sumBy string, controlPlaneNamespace string) (string, error) { - sumLabels := make([]string, 0) - filterLabels := make([]string, 0) - - if str, ok := aggregationMap[req.GroupBy]; ok { - sumLabels = append(sumLabels, str) - } else { - return "", fmt.Errorf("unsupported AggregationType") - } - if sumBy != "" { - sumLabels = append(sumLabels, sumBy) - } - - if metadata := req.FilterBy; metadata != nil { - if metadata.TargetDeploy != "" { - filterLabels = append(filterLabels, fmt.Sprintf("%s=\"%s\"", targetDeployLabel, metadata.TargetDeploy)) - sumLabels = append(sumLabels, targetDeployLabel) - } - if metadata.SourceDeploy != "" { - filterLabels = append(filterLabels, fmt.Sprintf("%s=\"%s\"", sourceDeployLabel, metadata.SourceDeploy)) - sumLabels = append(sumLabels, sourceDeployLabel) - } - if metadata.Component != "" { - filterLabels = append(filterLabels, fmt.Sprintf("%s=\"%s\"", jobLabel, metadata.Component)) - sumLabels = append(sumLabels, jobLabel) - } - } - combinedComponentNames := strings.Join(controlPlaneComponents, "|") - filterLabels = append(filterLabels, fmt.Sprintf("%s!~\"%s/(%s)\"", targetDeployLabel, controlPlaneNamespace, combinedComponentNames)) - filterLabels = append(filterLabels, fmt.Sprintf("%s!~\"%s/(%s)\"", sourceDeployLabel, controlPlaneNamespace, combinedComponentNames)) - - return fmt.Sprintf( - query, - strings.Join(filterLabels, ","), - defaultVectorRange, - strings.Join(sumLabels, ","), - ), nil -} - -func queryParams(req *pb.MetricRequest) (int64, int64, string, error) { - durationStr, err := util.GetWindowString(req.Window) - if err != nil { - return 0, 0, "", err - } - - duration, err := time.ParseDuration(durationStr) - if err != nil { - return 0, 0, "", err - } - - end := time.Now() - start := end.Add(-1 * duration) - - step, ok := stepMap[req.Window] - if !ok { - return 0, 0, "", fmt.Errorf("unsupported Window") - } - - ms := int64(time.Millisecond) - return start.UnixNano() / ms, end.UnixNano() / ms, step, nil -} - -func extractMetadata(metric *telemPb.Sample) pb.MetricMetadata { - return pb.MetricMetadata{ - TargetDeploy: metric.Labels[targetDeployLabel], - SourceDeploy: metric.Labels[sourceDeployLabel], - } -} - -func extractMetadataMesh(metric *telemPb.Sample) pb.MetricMetadata { - return pb.MetricMetadata{ - Component: metric.Labels[jobLabel], - } -} - -func isSuccess(labels map[string]string) bool { - return labels["classification"] == "success" -} - -func isSuccessMesh(labels map[string]string) (success bool) { - // check to see if the http status code is anything but a 5xx error - if v, ok := labels["code"]; ok && !strings.HasPrefix(v, "5") { - success = true - } - // or check to see if the grpc status code is OK - if v, ok := labels["grpc_code"]; ok && v == "OK" { - success = true - } - return -} - -func processRequestRate( - metrics []*telemPb.Sample, - metadataFn func(*telemPb.Sample) pb.MetricMetadata, -) ([]pb.MetricSeries, error) { - series := make([]pb.MetricSeries, 0) - - for _, metric := range metrics { - if len(metric.Values) == 0 { - continue - } - - datapoints := make([]*pb.MetricDatapoint, 0) - for _, value := range metric.Values { - if value.Value == 0 { - continue - } - - datapoint := pb.MetricDatapoint{ - Value: &pb.MetricValue{ - Value: &pb.MetricValue_Gauge{Gauge: value.Value}, - }, - TimestampMs: value.TimestampMs, - } - datapoints = append(datapoints, &datapoint) - } - - metadata := metadataFn(metric) - if metadata == emptyMetadata { - continue - } - - s := pb.MetricSeries{ - Name: pb.MetricName_REQUEST_RATE, - Metadata: &metadata, - Datapoints: datapoints, - } - series = append(series, s) - } - - return series, nil -} - -func processSuccessRate( - metrics []*telemPb.Sample, - metadataFn func(*telemPb.Sample) pb.MetricMetadata, - successRateFn func(map[string]string) bool, -) ([]pb.MetricSeries, error) { - timestamps := make(map[int64]struct{}) - successRates := make(map[pb.MetricMetadata]map[int64]*successRate) - series := make([]pb.MetricSeries, 0) - - for _, metric := range metrics { - if len(metric.Values) == 0 { - continue - } - - isSuccess := successRateFn(metric.Labels) - metadata := metadataFn(metric) - if metadata == emptyMetadata { - continue - } - - if _, ok := successRates[metadata]; !ok { - successRates[metadata] = make(map[int64]*successRate) - } - - for _, value := range metric.Values { - timestamp := value.TimestampMs - timestamps[timestamp] = struct{}{} - - if _, ok := successRates[metadata][timestamp]; !ok { - successRates[metadata][timestamp] = &successRate{} - } - - if isSuccess { - successRates[metadata][timestamp].success += value.Value - } else { - successRates[metadata][timestamp].failure += value.Value - } - } - } - - sortedTimestamps := sortTimestamps(timestamps) - - for metadata, successRateByTime := range successRates { - m := metadata - datapoints := make([]*pb.MetricDatapoint, 0) - for _, ts := range sortedTimestamps { - if sr, ok := successRateByTime[ts]; ok { - if requests := sr.success + sr.failure; requests > 0 { - datapoint := &pb.MetricDatapoint{ - Value: &pb.MetricValue{ - Value: &pb.MetricValue_Gauge{Gauge: sr.success / requests}, - }, - TimestampMs: ts, - } - datapoints = append(datapoints, datapoint) - } - } - } - - s := pb.MetricSeries{ - Name: pb.MetricName_SUCCESS_RATE, - Metadata: &m, - Datapoints: datapoints, - } - series = append(series, s) - } - - return series, nil -} - -func (a timestamps) Len() int { return len(a) } -func (a timestamps) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a timestamps) Less(i, j int) bool { return a[i] < a[j] } - -func sortTimestamps(timestampMap map[int64]struct{}) timestamps { - sorted := make(timestamps, len(timestampMap)) - for t, _ := range timestampMap { - sorted = append(sorted, t) - } - sort.Sort(sorted) - return sorted -} diff --git a/controller/api/public/grpc_server_test.go b/controller/api/public/grpc_server_test.go index 58709cf52fb93..f7f2dff16f045 100644 --- a/controller/api/public/grpc_server_test.go +++ b/controller/api/public/grpc_server_test.go @@ -2,20 +2,14 @@ package public import ( "context" - "fmt" - "reflect" "sort" - "strings" - "sync/atomic" "testing" "time" "github.com/golang/protobuf/ptypes/duration" "github.com/prometheus/common/model" tap "github.com/runconduit/conduit/controller/gen/controller/tap" - telemetry "github.com/runconduit/conduit/controller/gen/controller/telemetry" pb "github.com/runconduit/conduit/controller/gen/public" - "google.golang.org/grpc" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes/fake" @@ -30,49 +24,6 @@ type listPodsExpected struct { res pb.ListPodsResponse } -type mockTelemetry struct { - test *testing.T - client telemetry.TelemetryClient - tRes *telemetry.QueryResponse - mReq *pb.MetricRequest - ts int64 -} - -// satisfies telemetry.TelemetryClient -func (m *mockTelemetry) Query(ctx context.Context, in *telemetry.QueryRequest, opts ...grpc.CallOption) (*telemetry.QueryResponse, error) { - - if !atomic.CompareAndSwapInt64(&m.ts, 0, in.EndMs) { - ts := atomic.LoadInt64(&m.ts) - if ts != in.EndMs { - m.test.Errorf("Timestamp changed across queries: %+v / %+v / %+v ", in, ts, in.EndMs) - } - } - - if in.EndMs == 0 { - m.test.Errorf("EndMs not set in telemetry request: %+v", in) - } - if !m.mReq.Summarize && (in.StartMs == 0 || in.Step == "") { - m.test.Errorf("Range params not set in timeseries request: %+v", in) - } - return m.tRes, nil -} -func (m *mockTelemetry) ListPods(ctx context.Context, in *telemetry.ListPodsRequest, opts ...grpc.CallOption) (*pb.ListPodsResponse, error) { - return nil, nil -} - -// sorting results makes it easier to compare against expected output -type ByHV []*pb.HistogramValue - -func (hv ByHV) Len() int { return len(hv) } -func (hv ByHV) Swap(i, j int) { hv[i], hv[j] = hv[j], hv[i] } -func (hv ByHV) Less(i, j int) bool { return hv[i].Label <= hv[j].Label } - -type testResponse struct { - tRes *telemetry.QueryResponse - mReq *pb.MetricRequest - mRes *pb.MetricResponse -} - // sort Pods in ListPodResponses for easier comparison type ByPod []*pb.Pod @@ -109,202 +60,6 @@ func listPodResponsesEqual(a pb.ListPodsResponse, b pb.ListPodsResponse) bool { return true } -func TestStat(t *testing.T) { - t.Run("Stat returns the expected responses", func(t *testing.T) { - - responses := []testResponse{ - testResponse{ - tRes: &telemetry.QueryResponse{ - Metrics: []*telemetry.Sample{ - &telemetry.Sample{ - Values: []*telemetry.SampleValue{ - &telemetry.SampleValue{Value: 1, TimestampMs: 2}, - &telemetry.SampleValue{Value: 3, TimestampMs: 4}, - }, - Labels: map[string]string{ - sourceDeployLabel: "sourceDeployLabel", - targetDeployLabel: "targetDeployLabel", - }, - }, - &telemetry.Sample{ - Values: []*telemetry.SampleValue{ - &telemetry.SampleValue{Value: 5, TimestampMs: 6}, - &telemetry.SampleValue{Value: 7, TimestampMs: 8}, - }, - Labels: map[string]string{ - sourceDeployLabel: "sourceDeployLabel2", - targetDeployLabel: "targetDeployLabel2", - }, - }, - }, - }, - mReq: &pb.MetricRequest{ - Metrics: []pb.MetricName{ - pb.MetricName_REQUEST_RATE, - }, - Summarize: true, - Window: pb.TimeWindow_TEN_MIN, - }, - mRes: &pb.MetricResponse{ - Metrics: []*pb.MetricSeries{ - &pb.MetricSeries{ - Name: pb.MetricName_REQUEST_RATE, - Metadata: &pb.MetricMetadata{ - SourceDeploy: "sourceDeployLabel", - TargetDeploy: "targetDeployLabel", - }, - Datapoints: []*pb.MetricDatapoint{ - &pb.MetricDatapoint{ - Value: &pb.MetricValue{Value: &pb.MetricValue_Gauge{Gauge: 1}}, - TimestampMs: 2, - }, - &pb.MetricDatapoint{ - Value: &pb.MetricValue{Value: &pb.MetricValue_Gauge{Gauge: 3}}, - TimestampMs: 4, - }, - }, - }, - &pb.MetricSeries{ - Name: pb.MetricName_REQUEST_RATE, - Metadata: &pb.MetricMetadata{ - SourceDeploy: "sourceDeployLabel2", - TargetDeploy: "targetDeployLabel2", - }, - Datapoints: []*pb.MetricDatapoint{ - &pb.MetricDatapoint{ - Value: &pb.MetricValue{Value: &pb.MetricValue_Gauge{Gauge: 5}}, - TimestampMs: 6, - }, - &pb.MetricDatapoint{ - Value: &pb.MetricValue{Value: &pb.MetricValue_Gauge{Gauge: 7}}, - TimestampMs: 8, - }, - }, - }, - }, - }, - }, - - testResponse{ - tRes: &telemetry.QueryResponse{ - Metrics: []*telemetry.Sample{ - &telemetry.Sample{ - Values: []*telemetry.SampleValue{ - &telemetry.SampleValue{Value: 1, TimestampMs: 2}, - }, - Labels: map[string]string{ - sourceDeployLabel: "sourceDeployLabel", - targetDeployLabel: "targetDeployLabel", - }, - }, - }, - }, - mReq: &pb.MetricRequest{ - Metrics: []pb.MetricName{ - pb.MetricName_LATENCY, - }, - Summarize: true, - Window: pb.TimeWindow_TEN_MIN, - }, - mRes: &pb.MetricResponse{ - Metrics: []*pb.MetricSeries{ - &pb.MetricSeries{ - Name: pb.MetricName_LATENCY, - Metadata: &pb.MetricMetadata{ - SourceDeploy: "sourceDeployLabel", - TargetDeploy: "targetDeployLabel", - }, - Datapoints: []*pb.MetricDatapoint{ - &pb.MetricDatapoint{ - Value: &pb.MetricValue{Value: &pb.MetricValue_Histogram{ - Histogram: &pb.Histogram{ - Values: []*pb.HistogramValue{ - &pb.HistogramValue{ - Label: pb.HistogramLabel_P50, - Value: 1, - }, - &pb.HistogramValue{ - Label: pb.HistogramLabel_P95, - Value: 1, - }, - &pb.HistogramValue{ - Label: pb.HistogramLabel_P99, - Value: 1, - }, - }, - }, - }}, - TimestampMs: 2, - }, - }, - }, - }, - }, - }, - } - - for _, tr := range responses { - clientSet := fake.NewSimpleClientset() - sharedInformers := informers.NewSharedInformerFactory(clientSet, 10*time.Minute) - s := newGrpcServer( - &MockProm{}, - &mockTelemetry{test: t, tRes: tr.tRes, mReq: tr.mReq}, - tap.NewTapClient(nil), - sharedInformers.Apps().V1().Deployments().Lister(), - sharedInformers.Apps().V1().ReplicaSets().Lister(), - sharedInformers.Core().V1().Pods().Lister(), - "conduit", - []string{}, - ) - - res, err := s.Stat(context.Background(), tr.mReq) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - - switch res.Metrics[0].Name { - case pb.MetricName_LATENCY: - sort.Sort(ByHV(res.Metrics[0].Datapoints[0].Value.GetHistogram().Values)) - } - - if !reflect.DeepEqual(res, tr.mRes) { - t.Fatalf("Unexpected response:\n%+v\n!=\n%+v", res, tr.mRes) - } - } - }) -} - -func TestFormatQueryExclusions(t *testing.T) { - testCases := []struct { - input string - expectedOutput string - }{ - {"conduit", `target_deployment!~"conduit/(web|controller|prometheus|grafana)",source_deployment!~"conduit/(web|controller|prometheus|grafana)"`}, - {"", ""}, - } - - for i, tc := range testCases { - t.Run(fmt.Sprintf("%d:filter out %v metrics", i, tc.input), func(t *testing.T) { - result, err := formatQuery(countHttpQuery, &pb.MetricRequest{ - Metrics: []pb.MetricName{ - pb.MetricName_REQUEST_RATE, - }, - Summarize: false, - FilterBy: &pb.MetricMetadata{TargetDeploy: "deployment/service1"}, - Window: pb.TimeWindow_ONE_HOUR, - }, "", tc.input) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - - if !strings.Contains(result, tc.expectedOutput) { - t.Fatalf("Expected test output to contain: %s\nbut got: %s\n", tc.expectedOutput, result) - } - }) - - } -} - func TestListPods(t *testing.T) { t.Run("Successfully performs a query based on resource type", func(t *testing.T) { expectations := []listPodsExpected{ @@ -417,7 +172,6 @@ spec: fakeGrpcServer := newGrpcServer( &MockProm{Res: exp.promRes}, - &mockTelemetry{}, tap.NewTapClient(nil), deployInformer.Lister(), replicaSetInformer.Lister(), diff --git a/controller/api/public/http_server.go b/controller/api/public/http_server.go index 5731b63e660d1..dd8d67f60e12c 100644 --- a/controller/api/public/http_server.go +++ b/controller/api/public/http_server.go @@ -11,7 +11,6 @@ import ( common "github.com/runconduit/conduit/controller/gen/common" healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck" tapPb "github.com/runconduit/conduit/controller/gen/controller/tap" - telemPb "github.com/runconduit/conduit/controller/gen/controller/telemetry" pb "github.com/runconduit/conduit/controller/gen/public" "github.com/runconduit/conduit/controller/util" log "github.com/sirupsen/logrus" @@ -23,7 +22,6 @@ import ( var ( jsonMarshaler = jsonpb.Marshaler{EmitDefaults: true} jsonUnmarshaler = jsonpb.Unmarshaler{} - statPath = fullUrlPathFor("Stat") statSummaryPath = fullUrlPathFor("StatSummary") versionPath = fullUrlPathFor("Version") listPodsPath = fullUrlPathFor("ListPods") @@ -47,8 +45,6 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, req *http.Request) { // Serve request switch req.URL.Path { - case statPath: - h.handleStat(w, req) case statSummaryPath: h.handleStatSummary(w, req) case versionPath: @@ -65,27 +61,6 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, req *http.Request) { } -func (h *handler) handleStat(w http.ResponseWriter, req *http.Request) { - var protoRequest pb.MetricRequest - err := httpRequestToProto(req, &protoRequest) - if err != nil { - writeErrorToHttpResponse(w, err) - return - } - - rsp, err := h.grpcServer.Stat(req.Context(), &protoRequest) - if err != nil { - writeErrorToHttpResponse(w, err) - return - } - - err = writeProtoToHttpResponse(w, rsp) - if err != nil { - writeErrorToHttpResponse(w, err) - return - } -} - func (h *handler) handleStatSummary(w http.ResponseWriter, req *http.Request) { var protoRequest pb.StatSummaryRequest @@ -223,7 +198,6 @@ func fullUrlPathFor(method string) string { func NewServer( addr string, prometheusClient promApi.Client, - telemetryClient telemPb.TelemetryClient, tapClient tapPb.TapClient, deployLister applisters.DeploymentLister, replicaSetLister applisters.ReplicaSetLister, @@ -234,7 +208,6 @@ func NewServer( baseHandler := &handler{ grpcServer: newGrpcServer( promv1.NewAPI(prometheusClient), - telemetryClient, tapClient, deployLister, replicaSetLister, diff --git a/controller/api/public/http_server_test.go b/controller/api/public/http_server_test.go index cb59b1843ae78..84a9965685812 100644 --- a/controller/api/public/http_server_test.go +++ b/controller/api/public/http_server_test.go @@ -3,7 +3,6 @@ package public import ( "context" "errors" - "fmt" "net" "net/http" "reflect" @@ -22,11 +21,6 @@ type mockGrpcServer struct { ErrorToReturn error } -func (m *mockGrpcServer) Stat(ctx context.Context, req *pb.MetricRequest) (*pb.MetricResponse, error) { - m.LastRequestReceived = req - return m.ResponseToReturn.(*pb.MetricResponse), m.ErrorToReturn -} - func (m *mockGrpcServer) StatSummary(ctx context.Context, req *pb.StatSummaryRequest) (*pb.StatSummaryResponse, error) { m.LastRequestReceived = req return m.ResponseToReturn.(*pb.StatSummaryResponse), m.ErrorToReturn @@ -99,19 +93,11 @@ func TestServer(t *testing.T) { functionCall: func() (proto.Message, error) { return client.ListPods(context.TODO(), listPodsReq) }, } - statReq := &pb.MetricRequest{ - Summarize: false, - } - seriesToReturn := make([]*pb.MetricSeries, 0) - for i := 0; i < 100; i++ { - seriesToReturn = append(seriesToReturn, &pb.MetricSeries{Name: pb.MetricName_LATENCY, Metadata: &pb.MetricMetadata{TargetDeploy: fmt.Sprintf("/%d", i)}}) - } - testStat := grpcCallTestCase{ - expectedRequest: statReq, - expectedResponse: &pb.MetricResponse{ - Metrics: seriesToReturn, - }, - functionCall: func() (proto.Message, error) { return client.Stat(context.TODO(), statReq) }, + statSummaryReq := &pb.StatSummaryRequest{} + testStatSummary := grpcCallTestCase{ + expectedRequest: statSummaryReq, + expectedResponse: &pb.StatSummaryResponse{}, + functionCall: func() (proto.Message, error) { return client.StatSummary(context.TODO(), statSummaryReq) }, } versionReq := &pb.Empty{} @@ -136,7 +122,7 @@ func TestServer(t *testing.T) { functionCall: func() (proto.Message, error) { return client.SelfCheck(context.TODO(), selfCheckReq) }, } - for _, testCase := range []grpcCallTestCase{testListPods, testStat, testVersion, testSelfCheck} { + for _, testCase := range []grpcCallTestCase{testListPods, testStatSummary, testVersion, testSelfCheck} { assertCallWasForwarded(t, mockGrpcServer, testCase.expectedRequest, testCase.expectedResponse, testCase.functionCall) } }) diff --git a/controller/api/public/proto_over_http_test.go b/controller/api/public/proto_over_http_test.go index 921e3b5d709ca..a901d2834a892 100644 --- a/controller/api/public/proto_over_http_test.go +++ b/controller/api/public/proto_over_http_test.go @@ -28,7 +28,6 @@ func (w *stubResponseWriter) Header() http.Header { func (w *stubResponseWriter) Write(p []byte) (int, error) { n, err := w.body.Write(p) - fmt.Print(n) return n, err } @@ -309,18 +308,14 @@ func TestDeserializePayloadFromReader(t *testing.T) { } }) - t.Run("Can write and read marshalled protobuf messages", func(t *testing.T) { - seriesToReturn := make([]*pb.MetricSeries, 0) - for i := 0; i < 351; i++ { - seriesToReturn = append(seriesToReturn, &pb.MetricSeries{Name: pb.MetricName_LATENCY}) - } - - expectedMessage := &pb.MetricResponse{ - Metrics: seriesToReturn, + t.Run("Can write and read marshalled protobuf messages", func(t *testing.T) { + expectedMessage := &pb.VersionInfo{ + GoVersion: "1.9.1", + BuildDate: "2017.11.17", + ReleaseVersion: "1.2.3", } expectedReadArray, err := proto.Marshal(expectedMessage) - if err != nil { t.Fatalf("Unexpected error: %v", err) } @@ -349,7 +344,7 @@ func TestDeserializePayloadFromReader(t *testing.T) { t.Fatalf("Expecting read byte array to be equal to written byte array, but they were different. xor: [%v]", xor) } - actualMessage := &pb.MetricResponse{} + actualMessage := &pb.VersionInfo{} err = proto.Unmarshal(actualReadArray, actualMessage) if err != nil { t.Fatalf("Unexpected error: %v", err) @@ -474,7 +469,7 @@ func TestCheckIfResponseHasError(t *testing.T) { }) t.Run("returns error if response contains Conduit error but body isn't error message", func(t *testing.T) { - protoInBytes, err := proto.Marshal(&pb.MetricMetadata{TargetDeploy: "a"}) + protoInBytes, err := proto.Marshal(&pb.VersionInfo{ReleaseVersion: "0.0.1"}) message, err := serializeAsPayload(protoInBytes) response := &http.Response{ Header: make(http.Header), diff --git a/controller/api/public/stat_summary_test.go b/controller/api/public/stat_summary_test.go index 24ff624a8a54c..d8350a6b25116 100644 --- a/controller/api/public/stat_summary_test.go +++ b/controller/api/public/stat_summary_test.go @@ -142,7 +142,6 @@ metadata: fakeGrpcServer := newGrpcServer( &MockProm{Res: exp.promRes}, - &mockTelemetry{}, tap.NewTapClient(nil), deployInformer.Lister(), replicaSetInformer.Lister(), @@ -211,7 +210,6 @@ metadata: sharedInformers := informers.NewSharedInformerFactory(clientSet, 10*time.Minute) fakeGrpcServer := newGrpcServer( &MockProm{Res: exp.promRes}, - &mockTelemetry{}, tap.NewTapClient(nil), sharedInformers.Apps().V1().Deployments().Lister(), sharedInformers.Apps().V1().ReplicaSets().Lister(), diff --git a/controller/api/public/test_helper.go b/controller/api/public/test_helper.go index 9beb48c80fd46..ab285236589fa 100644 --- a/controller/api/public/test_helper.go +++ b/controller/api/public/test_helper.go @@ -17,16 +17,11 @@ type MockConduitApiClient struct { ErrorToReturn error VersionInfoToReturn *pb.VersionInfo ListPodsResponseToReturn *pb.ListPodsResponse - MetricResponseToReturn *pb.MetricResponse StatSummaryResponseToReturn *pb.StatSummaryResponse SelfCheckResponseToReturn *healthcheckPb.SelfCheckResponse Api_TapClientToReturn pb.Api_TapClient } -func (c *MockConduitApiClient) Stat(ctx context.Context, in *pb.MetricRequest, opts ...grpc.CallOption) (*pb.MetricResponse, error) { - return c.MetricResponseToReturn, c.ErrorToReturn -} - func (c *MockConduitApiClient) StatSummary(ctx context.Context, in *pb.StatSummaryRequest, opts ...grpc.CallOption) (*pb.StatSummaryResponse, error) { return c.StatSummaryResponseToReturn, c.ErrorToReturn } diff --git a/controller/api/util/api_utils.go b/controller/api/util/api_utils.go index 0827e19690598..3178e0f78b60d 100644 --- a/controller/api/util/api_utils.go +++ b/controller/api/util/api_utils.go @@ -42,33 +42,6 @@ func GetWindowString(timeWindow pb.TimeWindow) (string, error) { } } -func GetMetricName(metricName string) (pb.MetricName, error) { - switch metricName { - case "requests": - return pb.MetricName_REQUEST_RATE, nil - case "latency": - return pb.MetricName_LATENCY, nil - case "successRate": - return pb.MetricName_SUCCESS_RATE, nil - default: - return pb.MetricName_REQUEST_RATE, errors.New("invalid metric name " + metricName) - } -} - -func GetAggregationType(aggregationType string) (pb.AggregationType, error) { - switch aggregationType { - case "target_deploy": - return pb.AggregationType_TARGET_DEPLOY, nil - case "source_deploy": - return pb.AggregationType_SOURCE_DEPLOY, nil - case "mesh": - return pb.AggregationType_MESH, nil - - default: - return pb.AggregationType_TARGET_DEPLOY, errors.New("invalid aggregation type " + aggregationType) - } -} - var defaultMetricTimeWindow = pb.TimeWindow_ONE_MIN type StatSummaryRequestParams struct { diff --git a/controller/api/util/api_utils_test.go b/controller/api/util/api_utils_test.go index 60ca5817be803..4e0cc51ade345 100644 --- a/controller/api/util/api_utils_test.go +++ b/controller/api/util/api_utils_test.go @@ -76,88 +76,6 @@ func TestGetWindowString(t *testing.T) { }) } -func TestGetMetricName(t *testing.T) { - t.Run("Returns valid metrics from name", func(t *testing.T) { - expectations := map[string]pb.MetricName{ - "requests": pb.MetricName_REQUEST_RATE, - "latency": pb.MetricName_LATENCY, - "successRate": pb.MetricName_SUCCESS_RATE, - } - - for metricFriendlyName, expectedMetricName := range expectations { - actualMetricName, err := GetMetricName(metricFriendlyName) - if err != nil { - t.Fatalf("Unexpected error when resolving metric friendly name [%s]: %v", - metricFriendlyName, err) - } - - if actualMetricName != expectedMetricName { - t.Fatalf("Expected resolving metric friendly name [%s] to return metric [%v], but got [%v]", - metricFriendlyName, expectedMetricName, actualMetricName) - } - } - }) - - t.Run("Returns error and default value if unknown friendly name for TimeWindow", func(t *testing.T) { - invalidNames := []string{"failureRate", ""} - defaultMetricName := pb.MetricName_REQUEST_RATE - - for _, invalidName := range invalidNames { - window, err := GetMetricName(invalidName) - if err == nil { - t.Fatalf("Expected invalid friendly name [%s] to generate error, but got no error and result [%v]", - invalidName, window) - } - - if window != defaultMetricName { - t.Fatalf("Expected invalid friendly name resolution to return default name [%v], but got [%v]", - defaultMetricName, window) - } - } - }) -} - -func TestGetAggregationType(t *testing.T) { - t.Run("Returns valid metrics from name", func(t *testing.T) { - expectations := map[string]pb.AggregationType{ - "target_deploy": pb.AggregationType_TARGET_DEPLOY, - "source_deploy": pb.AggregationType_SOURCE_DEPLOY, - "mesh": pb.AggregationType_MESH, - } - - for aggregationFriendlyName, expectedAggregation := range expectations { - actualAggregation, err := GetAggregationType(aggregationFriendlyName) - if err != nil { - t.Fatalf("Unexpected error when resolving friendly name [%s]: %v", - aggregationFriendlyName, err) - } - - if actualAggregation != expectedAggregation { - t.Fatalf("Expected resolving friendly name [%s] to return [%v], but got [%v]", - aggregationFriendlyName, expectedAggregation, actualAggregation) - } - } - }) - - t.Run("Returns error and default value if unknown friendly name for TimeWindow", func(t *testing.T) { - invalidNames := []string{"service", "target_service", "target_mesh", ""} - defaultAggregation := pb.AggregationType_TARGET_DEPLOY - - for _, invalidName := range invalidNames { - aggregation, err := GetAggregationType(invalidName) - if err == nil { - t.Fatalf("Expected invalid friendly name [%s] to generate error, but got no error and result [%v]", - invalidName, aggregation) - } - - if aggregation != defaultAggregation { - t.Fatalf("Expected invalid friendly name resolution to return default [%v], but got [%v]", - defaultAggregation, aggregation) - } - } - }) -} - func TestBuildStatSummaryRequest(t *testing.T) { t.Run("Maps Kubernetes friendly names to canonical names", func(t *testing.T) { expectations := map[string]string{ diff --git a/controller/cmd/proxy-api/main.go b/controller/cmd/proxy-api/main.go index 6a48869cfe84e..f875fdbc2315d 100644 --- a/controller/cmd/proxy-api/main.go +++ b/controller/cmd/proxy-api/main.go @@ -16,7 +16,6 @@ import ( func main() { addr := flag.String("addr", ":8086", "address to serve on") metricsAddr := flag.String("metrics-addr", ":9996", "address to serve scrapable metrics on") - telemetryAddr := flag.String("telemetry-addr", "127.0.0.1:8087", "address of telemetry service") destinationAddr := flag.String("destination-addr", "127.0.0.1:8089", "address of destination service") logLevel := flag.String("log-level", log.InfoLevel.String(), "log level, must be one of: panic, fatal, error, warn, info, debug") printVersion := version.VersionFlag() @@ -34,19 +33,13 @@ func main() { stop := make(chan os.Signal, 1) signal.Notify(stop, os.Interrupt, syscall.SIGTERM) - telemetryClient, conn, err := proxy.NewTelemetryClient(*telemetryAddr) - if err != nil { - log.Fatal(err) - } - defer conn.Close() - destinationClient, conn, err := destination.NewClient(*destinationAddr) if err != nil { log.Fatal(err) } defer conn.Close() - server, lis, err := proxy.NewServer(*addr, telemetryClient, destinationClient) + server, lis, err := proxy.NewServer(*addr, destinationClient) if err != nil { log.Fatal(err) } diff --git a/controller/cmd/public-api/main.go b/controller/cmd/public-api/main.go index 9f3d18ee9813a..048a378e567a6 100644 --- a/controller/cmd/public-api/main.go +++ b/controller/cmd/public-api/main.go @@ -13,7 +13,6 @@ import ( "github.com/runconduit/conduit/controller/api/public" "github.com/runconduit/conduit/controller/k8s" "github.com/runconduit/conduit/controller/tap" - "github.com/runconduit/conduit/controller/telemetry" "github.com/runconduit/conduit/controller/util" "github.com/runconduit/conduit/pkg/version" log "github.com/sirupsen/logrus" @@ -26,7 +25,6 @@ func main() { kubeConfigPath := flag.String("kubeconfig", "", "path to kube config") prometheusUrl := flag.String("prometheus-url", "http://127.0.0.1:9090", "prometheus url") metricsAddr := flag.String("metrics-addr", ":9995", "address to serve scrapable metrics on") - telemetryAddr := flag.String("telemetry-addr", "127.0.0.1:8087", "address of telemetry service") tapAddr := flag.String("tap-addr", "127.0.0.1:8088", "address of tap service") controllerNamespace := flag.String("controller-namespace", "conduit", "namespace in which Conduit is installed") ignoredNamespaces := flag.String("ignore-namespaces", "kube-system", "comma separated list of namespaces to not list pods from") @@ -46,12 +44,6 @@ func main() { stop := make(chan os.Signal, 1) signal.Notify(stop, os.Interrupt, syscall.SIGTERM) - telemetryClient, telemetryConn, err := telemetry.NewClient(*telemetryAddr) - if err != nil { - log.Fatal(err.Error()) - } - defer telemetryConn.Close() - tapClient, tapConn, err := tap.NewClient(*tapAddr) if err != nil { log.Fatal(err.Error()) @@ -84,7 +76,6 @@ func main() { server := public.NewServer( *addr, prometheusClient, - telemetryClient, tapClient, deployInformer.Lister(), replicaSetInformer.Lister(), diff --git a/controller/cmd/telemetry/main.go b/controller/cmd/telemetry/main.go deleted file mode 100644 index 1317bcd2f0c6d..0000000000000 --- a/controller/cmd/telemetry/main.go +++ /dev/null @@ -1,54 +0,0 @@ -package main - -import ( - "flag" - "os" - "os/signal" - "strings" - "syscall" - - "github.com/runconduit/conduit/controller/telemetry" - "github.com/runconduit/conduit/controller/util" - "github.com/runconduit/conduit/pkg/version" - log "github.com/sirupsen/logrus" -) - -func main() { - addr := flag.String("addr", "127.0.0.1:8087", "address to serve on") - metricsAddr := flag.String("metrics-addr", ":9997", "address to serve scrapable metrics on") - prometheusUrl := flag.String("prometheus-url", "http://127.0.0.1:9090", "prometheus url") - ignoredNamespaces := flag.String("ignore-namespaces", "", "comma separated list of namespaces to not list pods from") - kubeConfigPath := flag.String("kubeconfig", "", "path to kube config") - logLevel := flag.String("log-level", log.InfoLevel.String(), "log level, must be one of: panic, fatal, error, warn, info, debug") - printVersion := version.VersionFlag() - flag.Parse() - - // set global log level - level, err := log.ParseLevel(*logLevel) - if err != nil { - log.Fatalf("invalid log-level: %s", *logLevel) - } - log.SetLevel(level) - - version.MaybePrintVersionAndExit(*printVersion) - - stop := make(chan os.Signal, 1) - signal.Notify(stop, os.Interrupt, syscall.SIGTERM) - - server, lis, err := telemetry.NewServer(*addr, *prometheusUrl, strings.Split(*ignoredNamespaces, ","), *kubeConfigPath) - if err != nil { - log.Fatal(err.Error()) - } - - go func() { - log.Println("starting gRPC server on", *addr) - server.Serve(lis) - }() - - go util.NewMetricsServer(*metricsAddr) - - <-stop - - log.Println("shutting down gRPC server on", *addr) - server.GracefulStop() -} diff --git a/controller/gen/controller/telemetry/telemetry.pb.go b/controller/gen/controller/telemetry/telemetry.pb.go deleted file mode 100644 index 549873f25ba42..0000000000000 --- a/controller/gen/controller/telemetry/telemetry.pb.go +++ /dev/null @@ -1,299 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: controller/telemetry/telemetry.proto - -/* -Package conduit_controller_telemetry is a generated protocol buffer package. - -It is generated from these files: - controller/telemetry/telemetry.proto - -It has these top-level messages: - QueryRequest - QueryResponse - Sample - SampleValue - ListPodsRequest -*/ -package conduit_controller_telemetry - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import conduit_public "github.com/runconduit/conduit/controller/gen/public" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type QueryRequest struct { - // required - Query string `protobuf:"bytes,1,opt,name=query" json:"query,omitempty"` - // required for timeseries queries - StartMs int64 `protobuf:"varint,2,opt,name=start_ms,json=startMs" json:"start_ms,omitempty"` - // required for timeseries queries - // optional for single data point, but if unset, results will have non-deterministic timestamps - EndMs int64 `protobuf:"varint,3,opt,name=end_ms,json=endMs" json:"end_ms,omitempty"` - // required for timeseries queries - Step string `protobuf:"bytes,4,opt,name=step" json:"step,omitempty"` -} - -func (m *QueryRequest) Reset() { *m = QueryRequest{} } -func (m *QueryRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRequest) ProtoMessage() {} -func (*QueryRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *QueryRequest) GetQuery() string { - if m != nil { - return m.Query - } - return "" -} - -func (m *QueryRequest) GetStartMs() int64 { - if m != nil { - return m.StartMs - } - return 0 -} - -func (m *QueryRequest) GetEndMs() int64 { - if m != nil { - return m.EndMs - } - return 0 -} - -func (m *QueryRequest) GetStep() string { - if m != nil { - return m.Step - } - return "" -} - -type QueryResponse struct { - Metrics []*Sample `protobuf:"bytes,1,rep,name=metrics" json:"metrics,omitempty"` -} - -func (m *QueryResponse) Reset() { *m = QueryResponse{} } -func (m *QueryResponse) String() string { return proto.CompactTextString(m) } -func (*QueryResponse) ProtoMessage() {} -func (*QueryResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *QueryResponse) GetMetrics() []*Sample { - if m != nil { - return m.Metrics - } - return nil -} - -type Sample struct { - Values []*SampleValue `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"` - Labels map[string]string `protobuf:"bytes,2,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` -} - -func (m *Sample) Reset() { *m = Sample{} } -func (m *Sample) String() string { return proto.CompactTextString(m) } -func (*Sample) ProtoMessage() {} -func (*Sample) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -func (m *Sample) GetValues() []*SampleValue { - if m != nil { - return m.Values - } - return nil -} - -func (m *Sample) GetLabels() map[string]string { - if m != nil { - return m.Labels - } - return nil -} - -type SampleValue struct { - Value float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"` - TimestampMs int64 `protobuf:"varint,2,opt,name=timestamp_ms,json=timestampMs" json:"timestamp_ms,omitempty"` -} - -func (m *SampleValue) Reset() { *m = SampleValue{} } -func (m *SampleValue) String() string { return proto.CompactTextString(m) } -func (*SampleValue) ProtoMessage() {} -func (*SampleValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -func (m *SampleValue) GetValue() float64 { - if m != nil { - return m.Value - } - return 0 -} - -func (m *SampleValue) GetTimestampMs() int64 { - if m != nil { - return m.TimestampMs - } - return 0 -} - -type ListPodsRequest struct { -} - -func (m *ListPodsRequest) Reset() { *m = ListPodsRequest{} } -func (m *ListPodsRequest) String() string { return proto.CompactTextString(m) } -func (*ListPodsRequest) ProtoMessage() {} -func (*ListPodsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func init() { - proto.RegisterType((*QueryRequest)(nil), "conduit.controller.telemetry.QueryRequest") - proto.RegisterType((*QueryResponse)(nil), "conduit.controller.telemetry.QueryResponse") - proto.RegisterType((*Sample)(nil), "conduit.controller.telemetry.Sample") - proto.RegisterType((*SampleValue)(nil), "conduit.controller.telemetry.SampleValue") - proto.RegisterType((*ListPodsRequest)(nil), "conduit.controller.telemetry.ListPodsRequest") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for Telemetry service - -type TelemetryClient interface { - Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) - ListPods(ctx context.Context, in *ListPodsRequest, opts ...grpc.CallOption) (*conduit_public.ListPodsResponse, error) -} - -type telemetryClient struct { - cc *grpc.ClientConn -} - -func NewTelemetryClient(cc *grpc.ClientConn) TelemetryClient { - return &telemetryClient{cc} -} - -func (c *telemetryClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) { - out := new(QueryResponse) - err := grpc.Invoke(ctx, "/conduit.controller.telemetry.Telemetry/Query", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *telemetryClient) ListPods(ctx context.Context, in *ListPodsRequest, opts ...grpc.CallOption) (*conduit_public.ListPodsResponse, error) { - out := new(conduit_public.ListPodsResponse) - err := grpc.Invoke(ctx, "/conduit.controller.telemetry.Telemetry/ListPods", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for Telemetry service - -type TelemetryServer interface { - Query(context.Context, *QueryRequest) (*QueryResponse, error) - ListPods(context.Context, *ListPodsRequest) (*conduit_public.ListPodsResponse, error) -} - -func RegisterTelemetryServer(s *grpc.Server, srv TelemetryServer) { - s.RegisterService(&_Telemetry_serviceDesc, srv) -} - -func _Telemetry_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TelemetryServer).Query(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/conduit.controller.telemetry.Telemetry/Query", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TelemetryServer).Query(ctx, req.(*QueryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Telemetry_ListPods_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListPodsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TelemetryServer).ListPods(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/conduit.controller.telemetry.Telemetry/ListPods", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TelemetryServer).ListPods(ctx, req.(*ListPodsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Telemetry_serviceDesc = grpc.ServiceDesc{ - ServiceName: "conduit.controller.telemetry.Telemetry", - HandlerType: (*TelemetryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Query", - Handler: _Telemetry_Query_Handler, - }, - { - MethodName: "ListPods", - Handler: _Telemetry_ListPods_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "controller/telemetry/telemetry.proto", -} - -func init() { proto.RegisterFile("controller/telemetry/telemetry.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 388 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4d, 0x4f, 0xdb, 0x40, - 0x10, 0xed, 0xc6, 0x89, 0x93, 0x8c, 0x53, 0x35, 0x5d, 0xb5, 0x92, 0x6b, 0xf5, 0xe0, 0x5a, 0x39, - 0xa4, 0xad, 0xea, 0x54, 0xe9, 0xa5, 0x70, 0x40, 0xe2, 0x00, 0xe2, 0x90, 0x08, 0x30, 0x88, 0x1b, - 0x42, 0xfe, 0x98, 0x83, 0x61, 0xfd, 0x11, 0xef, 0x1a, 0x29, 0x7f, 0x12, 0xf1, 0x93, 0xd0, 0xae, - 0xed, 0xd8, 0xe2, 0x10, 0xe5, 0x36, 0x33, 0xfb, 0xde, 0xdb, 0x37, 0x1f, 0x30, 0x0b, 0xb3, 0x54, - 0x14, 0x19, 0x63, 0x58, 0x2c, 0x04, 0x32, 0x4c, 0x50, 0x14, 0xdb, 0x36, 0x72, 0xf3, 0x22, 0x13, - 0x19, 0xfd, 0x1e, 0x66, 0x69, 0x54, 0xc6, 0xc2, 0x6d, 0xd1, 0xee, 0x0e, 0x63, 0x4d, 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xf1, 0xd6, 0x02, 0x25, 0x99, 0xd4, 0x40, 0xfa, 0x03, 0x26, 0x22, 0x4e, 0x90, 0x0b, - 0x3f, 0xc9, 0xdb, 0x95, 0x18, 0xbb, 0xda, 0x9a, 0x3b, 0x9f, 0xe1, 0xd3, 0x2a, 0xe6, 0xe2, 0x2a, - 0x8b, 0x78, 0xbd, 0xda, 0xe5, 0x0b, 0x81, 0xf1, 0x6d, 0x63, 0x9f, 0x06, 0x30, 0x50, 0xcb, 0xa0, - 0xbf, 0xf6, 0xb7, 0xd9, 0xbd, 0x0e, 0xeb, 0xf7, 0x41, 0xd8, 0x6a, 0xbb, 0xce, 0x07, 0x7a, 0x0f, - 0xa3, 0xc6, 0x04, 0xfd, 0xb3, 0x9f, 0xfa, 0xce, 0xac, 0x65, 0xef, 0xe0, 0xd5, 0xc9, 0x76, 0x00, - 0x8d, 0x7c, 0xa0, 0xab, 0x13, 0xfe, 0xf7, 0x16, 0x00, 0x00, 0xff, 0xff, 0x50, 0x14, 0x20, 0x8d, - 0x1a, 0x03, 0x00, 0x00, -} diff --git a/controller/gen/proxy/telemetry/telemetry.pb.go b/controller/gen/proxy/telemetry/telemetry.pb.go deleted file mode 100644 index 6534053e52d4e..0000000000000 --- a/controller/gen/proxy/telemetry/telemetry.pb.go +++ /dev/null @@ -1,702 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: proxy/telemetry/telemetry.proto - -/* -Package conduit_proxy_telemetry is a generated protocol buffer package. - -It is generated from these files: - proxy/telemetry/telemetry.proto - -It has these top-level messages: - ReportRequest - Process - ServerTransport - ClientTransport - TransportSummary - RequestScope - RequestCtx - ResponseScope - ResponseCtx - EosScope - EosCtx - ReportResponse -*/ -package conduit_proxy_telemetry - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import conduit_common "github.com/runconduit/conduit/controller/gen/common" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type ReportRequest_Proxy int32 - -const ( - ReportRequest_INBOUND ReportRequest_Proxy = 0 - ReportRequest_OUTBOUND ReportRequest_Proxy = 1 -) - -var ReportRequest_Proxy_name = map[int32]string{ - 0: "INBOUND", - 1: "OUTBOUND", -} -var ReportRequest_Proxy_value = map[string]int32{ - "INBOUND": 0, - "OUTBOUND": 1, -} - -func (x ReportRequest_Proxy) String() string { - return proto.EnumName(ReportRequest_Proxy_name, int32(x)) -} -func (ReportRequest_Proxy) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} } - -type ReportRequest struct { - Process *Process `protobuf:"bytes,1,opt,name=process" json:"process,omitempty"` - Proxy ReportRequest_Proxy `protobuf:"varint,2,opt,name=proxy,enum=conduit.proxy.telemetry.ReportRequest_Proxy" json:"proxy,omitempty"` - ServerTransports []*ServerTransport `protobuf:"bytes,3,rep,name=server_transports,json=serverTransports" json:"server_transports,omitempty"` - ClientTransports []*ClientTransport `protobuf:"bytes,4,rep,name=client_transports,json=clientTransports" json:"client_transports,omitempty"` - Requests []*RequestScope `protobuf:"bytes,5,rep,name=requests" json:"requests,omitempty"` - // The inclusive upper bound of each bucket in the response latency histogram, - // in tenths of a millisecond. - // - // Each ResponseScope message will contain an array of numbers representing - // the number of observed response latencies in each bucket of the latency - // histogram. Since the structure of the latency histogram will be the same - // across all ResponseScopes, we only need to report the max values for these - // buckets a single time. - HistogramBucketBoundsTenthMs []uint32 `protobuf:"varint,6,rep,packed,name=histogram_bucket_bounds_tenth_ms,json=histogramBucketBoundsTenthMs" json:"histogram_bucket_bounds_tenth_ms,omitempty"` -} - -func (m *ReportRequest) Reset() { *m = ReportRequest{} } -func (m *ReportRequest) String() string { return proto.CompactTextString(m) } -func (*ReportRequest) ProtoMessage() {} -func (*ReportRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *ReportRequest) GetProcess() *Process { - if m != nil { - return m.Process - } - return nil -} - -func (m *ReportRequest) GetProxy() ReportRequest_Proxy { - if m != nil { - return m.Proxy - } - return ReportRequest_INBOUND -} - -func (m *ReportRequest) GetServerTransports() []*ServerTransport { - if m != nil { - return m.ServerTransports - } - return nil -} - -func (m *ReportRequest) GetClientTransports() []*ClientTransport { - if m != nil { - return m.ClientTransports - } - return nil -} - -func (m *ReportRequest) GetRequests() []*RequestScope { - if m != nil { - return m.Requests - } - return nil -} - -func (m *ReportRequest) GetHistogramBucketBoundsTenthMs() []uint32 { - if m != nil { - return m.HistogramBucketBoundsTenthMs - } - return nil -} - -type Process struct { - Node string `protobuf:"bytes,1,opt,name=node" json:"node,omitempty"` - ScheduledInstance string `protobuf:"bytes,2,opt,name=scheduled_instance,json=scheduledInstance" json:"scheduled_instance,omitempty"` - ScheduledNamespace string `protobuf:"bytes,3,opt,name=scheduled_namespace,json=scheduledNamespace" json:"scheduled_namespace,omitempty"` -} - -func (m *Process) Reset() { *m = Process{} } -func (m *Process) String() string { return proto.CompactTextString(m) } -func (*Process) ProtoMessage() {} -func (*Process) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *Process) GetNode() string { - if m != nil { - return m.Node - } - return "" -} - -func (m *Process) GetScheduledInstance() string { - if m != nil { - return m.ScheduledInstance - } - return "" -} - -func (m *Process) GetScheduledNamespace() string { - if m != nil { - return m.ScheduledNamespace - } - return "" -} - -type ServerTransport struct { - SourceIp *conduit_common.IPAddress `protobuf:"bytes,1,opt,name=source_ip,json=sourceIp" json:"source_ip,omitempty"` - Connects uint32 `protobuf:"varint,2,opt,name=connects" json:"connects,omitempty"` - Disconnects []*TransportSummary `protobuf:"bytes,3,rep,name=disconnects" json:"disconnects,omitempty"` - Protocol conduit_common.Protocol `protobuf:"varint,4,opt,name=protocol,enum=conduit.common.Protocol" json:"protocol,omitempty"` -} - -func (m *ServerTransport) Reset() { *m = ServerTransport{} } -func (m *ServerTransport) String() string { return proto.CompactTextString(m) } -func (*ServerTransport) ProtoMessage() {} -func (*ServerTransport) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -func (m *ServerTransport) GetSourceIp() *conduit_common.IPAddress { - if m != nil { - return m.SourceIp - } - return nil -} - -func (m *ServerTransport) GetConnects() uint32 { - if m != nil { - return m.Connects - } - return 0 -} - -func (m *ServerTransport) GetDisconnects() []*TransportSummary { - if m != nil { - return m.Disconnects - } - return nil -} - -func (m *ServerTransport) GetProtocol() conduit_common.Protocol { - if m != nil { - return m.Protocol - } - return conduit_common.Protocol_HTTP -} - -type ClientTransport struct { - TargetAddr *conduit_common.TcpAddress `protobuf:"bytes,1,opt,name=target_addr,json=targetAddr" json:"target_addr,omitempty"` - Connects uint32 `protobuf:"varint,2,opt,name=connects" json:"connects,omitempty"` - Disconnects []*TransportSummary `protobuf:"bytes,3,rep,name=disconnects" json:"disconnects,omitempty"` - Protocol conduit_common.Protocol `protobuf:"varint,4,opt,name=protocol,enum=conduit.common.Protocol" json:"protocol,omitempty"` -} - -func (m *ClientTransport) Reset() { *m = ClientTransport{} } -func (m *ClientTransport) String() string { return proto.CompactTextString(m) } -func (*ClientTransport) ProtoMessage() {} -func (*ClientTransport) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -func (m *ClientTransport) GetTargetAddr() *conduit_common.TcpAddress { - if m != nil { - return m.TargetAddr - } - return nil -} - -func (m *ClientTransport) GetConnects() uint32 { - if m != nil { - return m.Connects - } - return 0 -} - -func (m *ClientTransport) GetDisconnects() []*TransportSummary { - if m != nil { - return m.Disconnects - } - return nil -} - -func (m *ClientTransport) GetProtocol() conduit_common.Protocol { - if m != nil { - return m.Protocol - } - return conduit_common.Protocol_HTTP -} - -type TransportSummary struct { - DurationMs uint64 `protobuf:"varint,1,opt,name=duration_ms,json=durationMs" json:"duration_ms,omitempty"` - BytesSent uint64 `protobuf:"varint,2,opt,name=bytes_sent,json=bytesSent" json:"bytes_sent,omitempty"` -} - -func (m *TransportSummary) Reset() { *m = TransportSummary{} } -func (m *TransportSummary) String() string { return proto.CompactTextString(m) } -func (*TransportSummary) ProtoMessage() {} -func (*TransportSummary) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *TransportSummary) GetDurationMs() uint64 { - if m != nil { - return m.DurationMs - } - return 0 -} - -func (m *TransportSummary) GetBytesSent() uint64 { - if m != nil { - return m.BytesSent - } - return 0 -} - -type RequestScope struct { - Ctx *RequestCtx `protobuf:"bytes,1,opt,name=ctx" json:"ctx,omitempty"` - Count uint32 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"` - Responses []*ResponseScope `protobuf:"bytes,3,rep,name=responses" json:"responses,omitempty"` -} - -func (m *RequestScope) Reset() { *m = RequestScope{} } -func (m *RequestScope) String() string { return proto.CompactTextString(m) } -func (*RequestScope) ProtoMessage() {} -func (*RequestScope) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -func (m *RequestScope) GetCtx() *RequestCtx { - if m != nil { - return m.Ctx - } - return nil -} - -func (m *RequestScope) GetCount() uint32 { - if m != nil { - return m.Count - } - return 0 -} - -func (m *RequestScope) GetResponses() []*ResponseScope { - if m != nil { - return m.Responses - } - return nil -} - -type RequestCtx struct { - SourceIp *conduit_common.IPAddress `protobuf:"bytes,1,opt,name=source_ip,json=sourceIp" json:"source_ip,omitempty"` - TargetAddr *conduit_common.TcpAddress `protobuf:"bytes,2,opt,name=target_addr,json=targetAddr" json:"target_addr,omitempty"` - Authority string `protobuf:"bytes,3,opt,name=authority" json:"authority,omitempty"` -} - -func (m *RequestCtx) Reset() { *m = RequestCtx{} } -func (m *RequestCtx) String() string { return proto.CompactTextString(m) } -func (*RequestCtx) ProtoMessage() {} -func (*RequestCtx) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } - -func (m *RequestCtx) GetSourceIp() *conduit_common.IPAddress { - if m != nil { - return m.SourceIp - } - return nil -} - -func (m *RequestCtx) GetTargetAddr() *conduit_common.TcpAddress { - if m != nil { - return m.TargetAddr - } - return nil -} - -func (m *RequestCtx) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -type ResponseScope struct { - Ctx *ResponseCtx `protobuf:"bytes,1,opt,name=ctx" json:"ctx,omitempty"` - // Response latencies (time from request headers sent to response headers - // received). Represented as a histogram with buckets whose inclusive - // upper bounds are given in the `histogram_bucket_bounds_tenths_ms` array in - // `ReportRequest`. Each number in this array represents the number of times a - // latency falling into that bucket was observed. - ResponseLatencyCounts []uint32 `protobuf:"varint,2,rep,packed,name=response_latency_counts,json=responseLatencyCounts" json:"response_latency_counts,omitempty"` - Ends []*EosScope `protobuf:"bytes,3,rep,name=ends" json:"ends,omitempty"` -} - -func (m *ResponseScope) Reset() { *m = ResponseScope{} } -func (m *ResponseScope) String() string { return proto.CompactTextString(m) } -func (*ResponseScope) ProtoMessage() {} -func (*ResponseScope) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } - -func (m *ResponseScope) GetCtx() *ResponseCtx { - if m != nil { - return m.Ctx - } - return nil -} - -func (m *ResponseScope) GetResponseLatencyCounts() []uint32 { - if m != nil { - return m.ResponseLatencyCounts - } - return nil -} - -func (m *ResponseScope) GetEnds() []*EosScope { - if m != nil { - return m.Ends - } - return nil -} - -type ResponseCtx struct { - HttpStatusCode uint32 `protobuf:"varint,1,opt,name=http_status_code,json=httpStatusCode" json:"http_status_code,omitempty"` -} - -func (m *ResponseCtx) Reset() { *m = ResponseCtx{} } -func (m *ResponseCtx) String() string { return proto.CompactTextString(m) } -func (*ResponseCtx) ProtoMessage() {} -func (*ResponseCtx) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } - -func (m *ResponseCtx) GetHttpStatusCode() uint32 { - if m != nil { - return m.HttpStatusCode - } - return 0 -} - -type EosScope struct { - Ctx *EosCtx `protobuf:"bytes,1,opt,name=ctx" json:"ctx,omitempty"` - Streams uint32 `protobuf:"varint,2,opt,name=streams" json:"streams,omitempty"` -} - -func (m *EosScope) Reset() { *m = EosScope{} } -func (m *EosScope) String() string { return proto.CompactTextString(m) } -func (*EosScope) ProtoMessage() {} -func (*EosScope) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } - -func (m *EosScope) GetCtx() *EosCtx { - if m != nil { - return m.Ctx - } - return nil -} - -func (m *EosScope) GetStreams() uint32 { - if m != nil { - return m.Streams - } - return 0 -} - -type EosCtx struct { - // Types that are valid to be assigned to End: - // *EosCtx_GrpcStatusCode - // *EosCtx_ResetErrorCode - // *EosCtx_Other - End isEosCtx_End `protobuf_oneof:"end"` -} - -func (m *EosCtx) Reset() { *m = EosCtx{} } -func (m *EosCtx) String() string { return proto.CompactTextString(m) } -func (*EosCtx) ProtoMessage() {} -func (*EosCtx) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } - -type isEosCtx_End interface{ isEosCtx_End() } - -type EosCtx_GrpcStatusCode struct { - GrpcStatusCode uint32 `protobuf:"varint,1,opt,name=grpc_status_code,json=grpcStatusCode,oneof"` -} -type EosCtx_ResetErrorCode struct { - ResetErrorCode uint32 `protobuf:"varint,2,opt,name=reset_error_code,json=resetErrorCode,oneof"` -} -type EosCtx_Other struct { - Other bool `protobuf:"varint,3,opt,name=other,oneof"` -} - -func (*EosCtx_GrpcStatusCode) isEosCtx_End() {} -func (*EosCtx_ResetErrorCode) isEosCtx_End() {} -func (*EosCtx_Other) isEosCtx_End() {} - -func (m *EosCtx) GetEnd() isEosCtx_End { - if m != nil { - return m.End - } - return nil -} - -func (m *EosCtx) GetGrpcStatusCode() uint32 { - if x, ok := m.GetEnd().(*EosCtx_GrpcStatusCode); ok { - return x.GrpcStatusCode - } - return 0 -} - -func (m *EosCtx) GetResetErrorCode() uint32 { - if x, ok := m.GetEnd().(*EosCtx_ResetErrorCode); ok { - return x.ResetErrorCode - } - return 0 -} - -func (m *EosCtx) GetOther() bool { - if x, ok := m.GetEnd().(*EosCtx_Other); ok { - return x.Other - } - return false -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*EosCtx) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _EosCtx_OneofMarshaler, _EosCtx_OneofUnmarshaler, _EosCtx_OneofSizer, []interface{}{ - (*EosCtx_GrpcStatusCode)(nil), - (*EosCtx_ResetErrorCode)(nil), - (*EosCtx_Other)(nil), - } -} - -func _EosCtx_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*EosCtx) - // end - switch x := m.End.(type) { - case *EosCtx_GrpcStatusCode: - b.EncodeVarint(1<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.GrpcStatusCode)) - case *EosCtx_ResetErrorCode: - b.EncodeVarint(2<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.ResetErrorCode)) - case *EosCtx_Other: - t := uint64(0) - if x.Other { - t = 1 - } - b.EncodeVarint(3<<3 | proto.WireVarint) - b.EncodeVarint(t) - case nil: - default: - return fmt.Errorf("EosCtx.End has unexpected type %T", x) - } - return nil -} - -func _EosCtx_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*EosCtx) - switch tag { - case 1: // end.grpc_status_code - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.End = &EosCtx_GrpcStatusCode{uint32(x)} - return true, err - case 2: // end.reset_error_code - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.End = &EosCtx_ResetErrorCode{uint32(x)} - return true, err - case 3: // end.other - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.End = &EosCtx_Other{x != 0} - return true, err - default: - return false, nil - } -} - -func _EosCtx_OneofSizer(msg proto.Message) (n int) { - m := msg.(*EosCtx) - // end - switch x := m.End.(type) { - case *EosCtx_GrpcStatusCode: - n += proto.SizeVarint(1<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.GrpcStatusCode)) - case *EosCtx_ResetErrorCode: - n += proto.SizeVarint(2<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.ResetErrorCode)) - case *EosCtx_Other: - n += proto.SizeVarint(3<<3 | proto.WireVarint) - n += 1 - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type ReportResponse struct { -} - -func (m *ReportResponse) Reset() { *m = ReportResponse{} } -func (m *ReportResponse) String() string { return proto.CompactTextString(m) } -func (*ReportResponse) ProtoMessage() {} -func (*ReportResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } - -func init() { - proto.RegisterType((*ReportRequest)(nil), "conduit.proxy.telemetry.ReportRequest") - proto.RegisterType((*Process)(nil), "conduit.proxy.telemetry.Process") - proto.RegisterType((*ServerTransport)(nil), "conduit.proxy.telemetry.ServerTransport") - proto.RegisterType((*ClientTransport)(nil), "conduit.proxy.telemetry.ClientTransport") - proto.RegisterType((*TransportSummary)(nil), "conduit.proxy.telemetry.TransportSummary") - proto.RegisterType((*RequestScope)(nil), "conduit.proxy.telemetry.RequestScope") - proto.RegisterType((*RequestCtx)(nil), "conduit.proxy.telemetry.RequestCtx") - proto.RegisterType((*ResponseScope)(nil), "conduit.proxy.telemetry.ResponseScope") - proto.RegisterType((*ResponseCtx)(nil), "conduit.proxy.telemetry.ResponseCtx") - proto.RegisterType((*EosScope)(nil), "conduit.proxy.telemetry.EosScope") - proto.RegisterType((*EosCtx)(nil), "conduit.proxy.telemetry.EosCtx") - proto.RegisterType((*ReportResponse)(nil), "conduit.proxy.telemetry.ReportResponse") - proto.RegisterEnum("conduit.proxy.telemetry.ReportRequest_Proxy", ReportRequest_Proxy_name, ReportRequest_Proxy_value) -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for Telemetry service - -type TelemetryClient interface { - Report(ctx context.Context, in *ReportRequest, opts ...grpc.CallOption) (*ReportResponse, error) -} - -type telemetryClient struct { - cc *grpc.ClientConn -} - -func NewTelemetryClient(cc *grpc.ClientConn) TelemetryClient { - return &telemetryClient{cc} -} - -func (c *telemetryClient) Report(ctx context.Context, in *ReportRequest, opts ...grpc.CallOption) (*ReportResponse, error) { - out := new(ReportResponse) - err := grpc.Invoke(ctx, "/conduit.proxy.telemetry.Telemetry/Report", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for Telemetry service - -type TelemetryServer interface { - Report(context.Context, *ReportRequest) (*ReportResponse, error) -} - -func RegisterTelemetryServer(s *grpc.Server, srv TelemetryServer) { - s.RegisterService(&_Telemetry_serviceDesc, srv) -} - -func _Telemetry_Report_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReportRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TelemetryServer).Report(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/conduit.proxy.telemetry.Telemetry/Report", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TelemetryServer).Report(ctx, req.(*ReportRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Telemetry_serviceDesc = grpc.ServiceDesc{ - ServiceName: "conduit.proxy.telemetry.Telemetry", - HandlerType: (*TelemetryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Report", - Handler: _Telemetry_Report_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "proxy/telemetry/telemetry.proto", -} - -func init() { proto.RegisterFile("proxy/telemetry/telemetry.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 850 bytes of a gzipped FileDescriptorProto - 0x1f,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 0x69, 0x09, 0x90, - 0x43, 0x78, 0xb8, 0xa4, 0xf3, 0x28, 0x45, 0x95, 0x45, 0x0c, 0xfd, 0x86, 0xe1, 0x2f, 0x95, 0xce, - 0x1c, 0x12, 0xfc, 0xee, 0xc1, 0xfd, 0x95, 0x56, 0x91, 0x63, 0xe8, 0x28, 0x91, 0x4b, 0x86, 0x61, - 0x92, 0x95, 0x13, 0xf7, 0x66, 0x55, 0xc2, 0x72, 0x56, 0x4f, 0x2f, 0x9e, 0xc5, 0xb1, 0x2c, 0x46, - 0xad, 0x6d, 0xb9, 0xa7, 0x19, 0xd9, 0x87, 0x36, 0x13, 0x9c, 0x23, 0xd3, 0xca, 0x44, 0xd8, 0xa3, - 0xd5, 0x99, 0x7c, 0x0d, 0xdd, 0x38, 0x51, 0x15, 0x6c, 0xa7, 0xe7, 0x83, 0xb5, 0x8d, 0xa9, 0x82, - 0x99, 0xe4, 0x69, 0x1a, 0xc9, 0x05, 0xad, 0x7b, 0x93, 0xcf, 0xa0, 0x6d, 0x76, 0x85, 0x89, 0xb9, - 0xdf, 0x34, 0x73, 0xed, 0xaf, 0xc6, 0x77, 0x51, 0xe2, 0xb4, 0x62, 0x06, 0x7f, 0x7a, 0x70, 0x7f, - 0x65, 0x7c, 0xc8, 0x97, 0xd0, 0xd5, 0x91, 0xbc, 0x46, 0x1d, 0x46, 0x71, 0x2c, 0xcb, 0x64, 0xf7, - 0x57, 0xc5, 0xa6, 0x2c, 0x73, 0xd9, 0x82, 0xa5, 0x17, 0xc7, 0xff, 0x7b, 0xbe, 0x14, 0xfa, 0xab, - 0xb2, 0xe4, 0x00, 0xba, 0x71, 0x2e, 0x23, 0x9d, 0x08, 0x5e, 0x0c, 0x71, 0x91, 0x6f, 0x93, 0x82, - 0x33, 0xbd, 0x52, 0xe4, 0x2d, 0x80, 0xab, 0x85, 0x46, 0x15, 0x2a, 0xe4, 0xda, 0x64, 0xd5, 0xa4, - 0x1d, 0x63, 0x99, 0x20, 0xd7, 0x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ab, 0x34, 0x7d, 0xd8, 0x55, 0x5a, - 0x62, 0x94, 0xba, 0x45, 0x73, 0xc7, 0xe0, 0x67, 0xd8, 0xb1, 0x44, 0xf2, 0x21, 0xf4, 0xaf, 0x65, - 0xc6, 0xfe, 0x1e, 0xcc, 0xcb, 0x2d, 0xba, 0x57, 0x20, 0xcb, 0x70, 0x0a, 0xae, 0x44, 0x85, 0x3a, - 0x44, 0x29, 0x85, 0xb4, 0xdc, 0x6d, 0xc7, 0x35, 0xc8, 0x8b, 0x02, 0x30, 0xdc, 0x37, 0xa0, 0x25, - 0xf4, 0x0c, 0xa5, 0x69, 0x63, 0xfb, 0xe5, 0x16, 0xb5, 0xc7, 0x71, 0x0b, 0x1a, 0xc8, 0xe3, 0xa0, - 0x0f, 0x7b, 0xee, 0xd3, 0x69, 0x0b, 0x73, 0x34, 0x83, 0xce, 0xd4, 0x65, 0x41, 0xbe, 0x83, 0x1d, - 0x0b, 0x93, 0x27, 0xff, 0xec, 0xd3, 0xbb, 0xff, 0xfe, 0x46, 0x9e, 0xbd, 0x27, 0xd8, 0xba, 0xda, - 0x31, 0xbb, 0xfe, 0xe9, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x2c, 0x8a, 0x8a, 0xb8, 0x82, 0x08, - 0x00, 0x00, -} diff --git a/controller/gen/public/api.pb.go b/controller/gen/public/api.pb.go index ad6e9ecc7003f..ecd47631cbbcc 100644 --- a/controller/gen/public/api.pb.go +++ b/controller/gen/public/api.pb.go @@ -8,14 +8,6 @@ It is generated from these files: public/api.proto It has these top-level messages: - HistogramValue - Histogram - MetricValue - MetricDatapoint - MetricSeries - MetricMetadata - MetricResponse - MetricRequest Empty VersionInfo ListPodsResponse @@ -55,30 +47,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -type MetricName int32 - -const ( - MetricName_REQUEST_RATE MetricName = 0 - MetricName_LATENCY MetricName = 1 - MetricName_SUCCESS_RATE MetricName = 2 -) - -var MetricName_name = map[int32]string{ - 0: "REQUEST_RATE", - 1: "LATENCY", - 2: "SUCCESS_RATE", -} -var MetricName_value = map[string]int32{ - "REQUEST_RATE": 0, - "LATENCY": 1, - "SUCCESS_RATE": 2, -} - -func (x MetricName) String() string { - return proto.EnumName(MetricName_name, int32(x)) -} -func (MetricName) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - type TimeWindow int32 const ( @@ -104,393 +72,7 @@ var TimeWindow_value = map[string]int32{ func (x TimeWindow) String() string { return proto.EnumName(TimeWindow_name, int32(x)) } -func (TimeWindow) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -type AggregationType int32 - -const ( - AggregationType_TARGET_DEPLOY AggregationType = 0 - AggregationType_SOURCE_DEPLOY AggregationType = 1 - AggregationType_MESH AggregationType = 2 -) - -var AggregationType_name = map[int32]string{ - 0: "TARGET_DEPLOY", - 1: "SOURCE_DEPLOY", - 2: "MESH", -} -var AggregationType_value = map[string]int32{ - "TARGET_DEPLOY": 0, - "SOURCE_DEPLOY": 1, - "MESH": 2, -} - -func (x AggregationType) String() string { - return proto.EnumName(AggregationType_name, int32(x)) -} -func (AggregationType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -type HistogramLabel int32 - -const ( - HistogramLabel_MIN HistogramLabel = 0 - HistogramLabel_P50 HistogramLabel = 1 - HistogramLabel_P95 HistogramLabel = 2 - HistogramLabel_P99 HistogramLabel = 3 - HistogramLabel_MAX HistogramLabel = 4 -) - -var HistogramLabel_name = map[int32]string{ - 0: "MIN", - 1: "P50", - 2: "P95", - 3: "P99", - 4: "MAX", -} -var HistogramLabel_value = map[string]int32{ - "MIN": 0, - "P50": 1, - "P95": 2, - "P99": 3, - "MAX": 4, -} - -func (x HistogramLabel) String() string { - return proto.EnumName(HistogramLabel_name, int32(x)) -} -func (HistogramLabel) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -type HistogramValue struct { - Label HistogramLabel `protobuf:"varint,1,opt,name=label,enum=conduit.public.HistogramLabel" json:"label,omitempty"` - Value int64 `protobuf:"varint,2,opt,name=value" json:"value,omitempty"` -} - -func (m *HistogramValue) Reset() { *m = HistogramValue{} } -func (m *HistogramValue) String() string { return proto.CompactTextString(m) } -func (*HistogramValue) ProtoMessage() {} -func (*HistogramValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *HistogramValue) GetLabel() HistogramLabel { - if m != nil { - return m.Label - } - return HistogramLabel_MIN -} - -func (m *HistogramValue) GetValue() int64 { - if m != nil { - return m.Value - } - return 0 -} - -type Histogram struct { - Values []*HistogramValue `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"` -} - -func (m *Histogram) Reset() { *m = Histogram{} } -func (m *Histogram) String() string { return proto.CompactTextString(m) } -func (*Histogram) ProtoMessage() {} -func (*Histogram) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *Histogram) GetValues() []*HistogramValue { - if m != nil { - return m.Values - } - return nil -} - -type MetricValue struct { - // Types that are valid to be assigned to Value: - // *MetricValue_Counter - // *MetricValue_Gauge - // *MetricValue_Histogram - Value isMetricValue_Value `protobuf_oneof:"value"` -} - -func (m *MetricValue) Reset() { *m = MetricValue{} } -func (m *MetricValue) String() string { return proto.CompactTextString(m) } -func (*MetricValue) ProtoMessage() {} -func (*MetricValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -type isMetricValue_Value interface{ isMetricValue_Value() } - -type MetricValue_Counter struct { - Counter int64 `protobuf:"varint,1,opt,name=counter,oneof"` -} -type MetricValue_Gauge struct { - Gauge float64 `protobuf:"fixed64,2,opt,name=gauge,oneof"` -} -type MetricValue_Histogram struct { - Histogram *Histogram `protobuf:"bytes,3,opt,name=histogram,oneof"` -} - -func (*MetricValue_Counter) isMetricValue_Value() {} -func (*MetricValue_Gauge) isMetricValue_Value() {} -func (*MetricValue_Histogram) isMetricValue_Value() {} - -func (m *MetricValue) GetValue() isMetricValue_Value { - if m != nil { - return m.Value - } - return nil -} - -func (m *MetricValue) GetCounter() int64 { - if x, ok := m.GetValue().(*MetricValue_Counter); ok { - return x.Counter - } - return 0 -} - -func (m *MetricValue) GetGauge() float64 { - if x, ok := m.GetValue().(*MetricValue_Gauge); ok { - return x.Gauge - } - return 0 -} - -func (m *MetricValue) GetHistogram() *Histogram { - if x, ok := m.GetValue().(*MetricValue_Histogram); ok { - return x.Histogram - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*MetricValue) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _MetricValue_OneofMarshaler, _MetricValue_OneofUnmarshaler, _MetricValue_OneofSizer, []interface{}{ - (*MetricValue_Counter)(nil), - (*MetricValue_Gauge)(nil), - (*MetricValue_Histogram)(nil), - } -} - -func _MetricValue_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*MetricValue) - // value - switch x := m.Value.(type) { - case *MetricValue_Counter: - b.EncodeVarint(1<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Counter)) - case *MetricValue_Gauge: - b.EncodeVarint(2<<3 | proto.WireFixed64) - b.EncodeFixed64(math.Float64bits(x.Gauge)) - case *MetricValue_Histogram: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Histogram); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("MetricValue.Value has unexpected type %T", x) - } - return nil -} - -func _MetricValue_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*MetricValue) - switch tag { - case 1: // value.counter - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Value = &MetricValue_Counter{int64(x)} - return true, err - case 2: // value.gauge - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Value = &MetricValue_Gauge{math.Float64frombits(x)} - return true, err - case 3: // value.histogram - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Histogram) - err := b.DecodeMessage(msg) - m.Value = &MetricValue_Histogram{msg} - return true, err - default: - return false, nil - } -} - -func _MetricValue_OneofSizer(msg proto.Message) (n int) { - m := msg.(*MetricValue) - // value - switch x := m.Value.(type) { - case *MetricValue_Counter: - n += proto.SizeVarint(1<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.Counter)) - case *MetricValue_Gauge: - n += proto.SizeVarint(2<<3 | proto.WireFixed64) - n += 8 - case *MetricValue_Histogram: - s := proto.Size(x.Histogram) - n += proto.SizeVarint(3<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type MetricDatapoint struct { - Value *MetricValue `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` - TimestampMs int64 `protobuf:"varint,2,opt,name=timestamp_ms,json=timestampMs" json:"timestamp_ms,omitempty"` -} - -func (m *MetricDatapoint) Reset() { *m = MetricDatapoint{} } -func (m *MetricDatapoint) String() string { return proto.CompactTextString(m) } -func (*MetricDatapoint) ProtoMessage() {} -func (*MetricDatapoint) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -func (m *MetricDatapoint) GetValue() *MetricValue { - if m != nil { - return m.Value - } - return nil -} - -func (m *MetricDatapoint) GetTimestampMs() int64 { - if m != nil { - return m.TimestampMs - } - return 0 -} - -type MetricSeries struct { - Name MetricName `protobuf:"varint,1,opt,name=name,enum=conduit.public.MetricName" json:"name,omitempty"` - Metadata *MetricMetadata `protobuf:"bytes,2,opt,name=metadata" json:"metadata,omitempty"` - Datapoints []*MetricDatapoint `protobuf:"bytes,3,rep,name=datapoints" json:"datapoints,omitempty"` -} - -func (m *MetricSeries) Reset() { *m = MetricSeries{} } -func (m *MetricSeries) String() string { return proto.CompactTextString(m) } -func (*MetricSeries) ProtoMessage() {} -func (*MetricSeries) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *MetricSeries) GetName() MetricName { - if m != nil { - return m.Name - } - return MetricName_REQUEST_RATE -} - -func (m *MetricSeries) GetMetadata() *MetricMetadata { - if m != nil { - return m.Metadata - } - return nil -} - -func (m *MetricSeries) GetDatapoints() []*MetricDatapoint { - if m != nil { - return m.Datapoints - } - return nil -} - -type MetricMetadata struct { - TargetDeploy string `protobuf:"bytes,1,opt,name=targetDeploy" json:"targetDeploy,omitempty"` - SourceDeploy string `protobuf:"bytes,2,opt,name=sourceDeploy" json:"sourceDeploy,omitempty"` - Component string `protobuf:"bytes,3,opt,name=component" json:"component,omitempty"` -} - -func (m *MetricMetadata) Reset() { *m = MetricMetadata{} } -func (m *MetricMetadata) String() string { return proto.CompactTextString(m) } -func (*MetricMetadata) ProtoMessage() {} -func (*MetricMetadata) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -func (m *MetricMetadata) GetTargetDeploy() string { - if m != nil { - return m.TargetDeploy - } - return "" -} - -func (m *MetricMetadata) GetSourceDeploy() string { - if m != nil { - return m.SourceDeploy - } - return "" -} - -func (m *MetricMetadata) GetComponent() string { - if m != nil { - return m.Component - } - return "" -} - -type MetricResponse struct { - Metrics []*MetricSeries `protobuf:"bytes,1,rep,name=metrics" json:"metrics,omitempty"` -} - -func (m *MetricResponse) Reset() { *m = MetricResponse{} } -func (m *MetricResponse) String() string { return proto.CompactTextString(m) } -func (*MetricResponse) ProtoMessage() {} -func (*MetricResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } - -func (m *MetricResponse) GetMetrics() []*MetricSeries { - if m != nil { - return m.Metrics - } - return nil -} - -type MetricRequest struct { - Metrics []MetricName `protobuf:"varint,1,rep,packed,name=metrics,enum=conduit.public.MetricName" json:"metrics,omitempty"` - Window TimeWindow `protobuf:"varint,2,opt,name=window,enum=conduit.public.TimeWindow" json:"window,omitempty"` - GroupBy AggregationType `protobuf:"varint,3,opt,name=groupBy,enum=conduit.public.AggregationType" json:"groupBy,omitempty"` - FilterBy *MetricMetadata `protobuf:"bytes,4,opt,name=filterBy" json:"filterBy,omitempty"` - Summarize bool `protobuf:"varint,5,opt,name=summarize" json:"summarize,omitempty"` -} - -func (m *MetricRequest) Reset() { *m = MetricRequest{} } -func (m *MetricRequest) String() string { return proto.CompactTextString(m) } -func (*MetricRequest) ProtoMessage() {} -func (*MetricRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } - -func (m *MetricRequest) GetMetrics() []MetricName { - if m != nil { - return m.Metrics - } - return nil -} - -func (m *MetricRequest) GetWindow() TimeWindow { - if m != nil { - return m.Window - } - return TimeWindow_TEN_SEC -} - -func (m *MetricRequest) GetGroupBy() AggregationType { - if m != nil { - return m.GroupBy - } - return AggregationType_TARGET_DEPLOY -} - -func (m *MetricRequest) GetFilterBy() *MetricMetadata { - if m != nil { - return m.FilterBy - } - return nil -} - -func (m *MetricRequest) GetSummarize() bool { - if m != nil { - return m.Summarize - } - return false -} +func (TimeWindow) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } type Empty struct { } @@ -498,7 +80,7 @@ type Empty struct { func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } +func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } type VersionInfo struct { GoVersion string `protobuf:"bytes,1,opt,name=goVersion" json:"goVersion,omitempty"` @@ -509,7 +91,7 @@ type VersionInfo struct { func (m *VersionInfo) Reset() { *m = VersionInfo{} } func (m *VersionInfo) String() string { return proto.CompactTextString(m) } func (*VersionInfo) ProtoMessage() {} -func (*VersionInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } +func (*VersionInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } func (m *VersionInfo) GetGoVersion() string { if m != nil { @@ -539,7 +121,7 @@ type ListPodsResponse struct { func (m *ListPodsResponse) Reset() { *m = ListPodsResponse{} } func (m *ListPodsResponse) String() string { return proto.CompactTextString(m) } func (*ListPodsResponse) ProtoMessage() {} -func (*ListPodsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } +func (*ListPodsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } func (m *ListPodsResponse) GetPods() []*Pod { if m != nil { @@ -562,7 +144,7 @@ type Pod struct { func (m *Pod) Reset() { *m = Pod{} } func (m *Pod) String() string { return proto.CompactTextString(m) } func (*Pod) ProtoMessage() {} -func (*Pod) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } +func (*Pod) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } func (m *Pod) GetName() string { if m != nil { @@ -640,7 +222,7 @@ type TapRequest struct { func (m *TapRequest) Reset() { *m = TapRequest{} } func (m *TapRequest) String() string { return proto.CompactTextString(m) } func (*TapRequest) ProtoMessage() {} -func (*TapRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } +func (*TapRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } type isTapRequest_Target interface{ isTapRequest_Target() } @@ -811,7 +393,7 @@ type ApiError struct { func (m *ApiError) Reset() { *m = ApiError{} } func (m *ApiError) String() string { return proto.CompactTextString(m) } func (*ApiError) ProtoMessage() {} -func (*ApiError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } +func (*ApiError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } func (m *ApiError) GetError() string { if m != nil { @@ -829,7 +411,7 @@ type Resource struct { func (m *Resource) Reset() { *m = Resource{} } func (m *Resource) String() string { return proto.CompactTextString(m) } func (*Resource) ProtoMessage() {} -func (*Resource) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } +func (*Resource) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } func (m *Resource) GetNamespace() string { if m != nil { @@ -860,7 +442,7 @@ type ResourceSelection struct { func (m *ResourceSelection) Reset() { *m = ResourceSelection{} } func (m *ResourceSelection) String() string { return proto.CompactTextString(m) } func (*ResourceSelection) ProtoMessage() {} -func (*ResourceSelection) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } +func (*ResourceSelection) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } func (m *ResourceSelection) GetResource() *Resource { if m != nil { @@ -884,7 +466,7 @@ type ResourceError struct { func (m *ResourceError) Reset() { *m = ResourceError{} } func (m *ResourceError) String() string { return proto.CompactTextString(m) } func (*ResourceError) ProtoMessage() {} -func (*ResourceError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } +func (*ResourceError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } func (m *ResourceError) GetResource() *Resource { if m != nil { @@ -913,7 +495,7 @@ type StatSummaryRequest struct { func (m *StatSummaryRequest) Reset() { *m = StatSummaryRequest{} } func (m *StatSummaryRequest) String() string { return proto.CompactTextString(m) } func (*StatSummaryRequest) ProtoMessage() {} -func (*StatSummaryRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } +func (*StatSummaryRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } type isStatSummaryRequest_Outbound interface{ isStatSummaryRequest_Outbound() } @@ -1076,7 +658,7 @@ type StatSummaryResponse struct { func (m *StatSummaryResponse) Reset() { *m = StatSummaryResponse{} } func (m *StatSummaryResponse) String() string { return proto.CompactTextString(m) } func (*StatSummaryResponse) ProtoMessage() {} -func (*StatSummaryResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } +func (*StatSummaryResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } type isStatSummaryResponse_Response interface{ isStatSummaryResponse_Response() } @@ -1192,7 +774,7 @@ type StatSummaryResponse_Ok struct { func (m *StatSummaryResponse_Ok) Reset() { *m = StatSummaryResponse_Ok{} } func (m *StatSummaryResponse_Ok) String() string { return proto.CompactTextString(m) } func (*StatSummaryResponse_Ok) ProtoMessage() {} -func (*StatSummaryResponse_Ok) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18, 0} } +func (*StatSummaryResponse_Ok) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10, 0} } func (m *StatSummaryResponse_Ok) GetStatTables() []*StatTable { if m != nil { @@ -1212,7 +794,7 @@ type BasicStats struct { func (m *BasicStats) Reset() { *m = BasicStats{} } func (m *BasicStats) String() string { return proto.CompactTextString(m) } func (*BasicStats) ProtoMessage() {} -func (*BasicStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } +func (*BasicStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } func (m *BasicStats) GetSuccessCount() uint64 { if m != nil { @@ -1258,7 +840,7 @@ type StatTable struct { func (m *StatTable) Reset() { *m = StatTable{} } func (m *StatTable) String() string { return proto.CompactTextString(m) } func (*StatTable) ProtoMessage() {} -func (*StatTable) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } +func (*StatTable) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } type isStatTable_Table interface{ isStatTable_Table() } @@ -1344,7 +926,7 @@ type StatTable_PodGroup struct { func (m *StatTable_PodGroup) Reset() { *m = StatTable_PodGroup{} } func (m *StatTable_PodGroup) String() string { return proto.CompactTextString(m) } func (*StatTable_PodGroup) ProtoMessage() {} -func (*StatTable_PodGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20, 0} } +func (*StatTable_PodGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12, 0} } func (m *StatTable_PodGroup) GetRows() []*StatTable_PodGroup_Row { if m != nil { @@ -1364,7 +946,7 @@ type StatTable_PodGroup_Row struct { func (m *StatTable_PodGroup_Row) Reset() { *m = StatTable_PodGroup_Row{} } func (m *StatTable_PodGroup_Row) String() string { return proto.CompactTextString(m) } func (*StatTable_PodGroup_Row) ProtoMessage() {} -func (*StatTable_PodGroup_Row) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20, 0, 0} } +func (*StatTable_PodGroup_Row) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12, 0, 0} } func (m *StatTable_PodGroup_Row) GetResource() *Resource { if m != nil { @@ -1402,14 +984,6 @@ func (m *StatTable_PodGroup_Row) GetStats() *BasicStats { } func init() { - proto.RegisterType((*HistogramValue)(nil), "conduit.public.HistogramValue") - proto.RegisterType((*Histogram)(nil), "conduit.public.Histogram") - proto.RegisterType((*MetricValue)(nil), "conduit.public.MetricValue") - proto.RegisterType((*MetricDatapoint)(nil), "conduit.public.MetricDatapoint") - proto.RegisterType((*MetricSeries)(nil), "conduit.public.MetricSeries") - proto.RegisterType((*MetricMetadata)(nil), "conduit.public.MetricMetadata") - proto.RegisterType((*MetricResponse)(nil), "conduit.public.MetricResponse") - proto.RegisterType((*MetricRequest)(nil), "conduit.public.MetricRequest") proto.RegisterType((*Empty)(nil), "conduit.public.Empty") proto.RegisterType((*VersionInfo)(nil), "conduit.public.VersionInfo") proto.RegisterType((*ListPodsResponse)(nil), "conduit.public.ListPodsResponse") @@ -1426,10 +1000,7 @@ func init() { proto.RegisterType((*StatTable)(nil), "conduit.public.StatTable") proto.RegisterType((*StatTable_PodGroup)(nil), "conduit.public.StatTable.PodGroup") proto.RegisterType((*StatTable_PodGroup_Row)(nil), "conduit.public.StatTable.PodGroup.Row") - proto.RegisterEnum("conduit.public.MetricName", MetricName_name, MetricName_value) proto.RegisterEnum("conduit.public.TimeWindow", TimeWindow_name, TimeWindow_value) - proto.RegisterEnum("conduit.public.AggregationType", AggregationType_name, AggregationType_value) - proto.RegisterEnum("conduit.public.HistogramLabel", HistogramLabel_name, HistogramLabel_value) } // Reference imports to suppress errors if they are not otherwise used. @@ -1443,7 +1014,6 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for Api service type ApiClient interface { - Stat(ctx context.Context, in *MetricRequest, opts ...grpc.CallOption) (*MetricResponse, error) StatSummary(ctx context.Context, in *StatSummaryRequest, opts ...grpc.CallOption) (*StatSummaryResponse, error) Version(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*VersionInfo, error) ListPods(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListPodsResponse, error) @@ -1459,15 +1029,6 @@ func NewApiClient(cc *grpc.ClientConn) ApiClient { return &apiClient{cc} } -func (c *apiClient) Stat(ctx context.Context, in *MetricRequest, opts ...grpc.CallOption) (*MetricResponse, error) { - out := new(MetricResponse) - err := grpc.Invoke(ctx, "/conduit.public.Api/Stat", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *apiClient) StatSummary(ctx context.Context, in *StatSummaryRequest, opts ...grpc.CallOption) (*StatSummaryResponse, error) { out := new(StatSummaryResponse) err := grpc.Invoke(ctx, "/conduit.public.Api/StatSummary", in, out, c.cc, opts...) @@ -1539,7 +1100,6 @@ func (x *apiTapClient) Recv() (*conduit_common.TapEvent, error) { // Server API for Api service type ApiServer interface { - Stat(context.Context, *MetricRequest) (*MetricResponse, error) StatSummary(context.Context, *StatSummaryRequest) (*StatSummaryResponse, error) Version(context.Context, *Empty) (*VersionInfo, error) ListPods(context.Context, *Empty) (*ListPodsResponse, error) @@ -1551,24 +1111,6 @@ func RegisterApiServer(s *grpc.Server, srv ApiServer) { s.RegisterService(&_Api_serviceDesc, srv) } -func _Api_Stat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MetricRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ApiServer).Stat(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/conduit.public.Api/Stat", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ApiServer).Stat(ctx, req.(*MetricRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Api_StatSummary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(StatSummaryRequest) if err := dec(in); err != nil { @@ -1666,10 +1208,6 @@ var _Api_serviceDesc = grpc.ServiceDesc{ ServiceName: "conduit.public.Api", HandlerType: (*ApiServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Stat", - Handler: _Api_Stat_Handler, - }, { MethodName: "StatSummary", Handler: _Api_StatSummary_Handler, @@ -1700,112 +1238,81 @@ var _Api_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("public/api.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1697 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xcd, 0x73, 0x23, 0x47, - 0x15, 0xd7, 0x8c, 0x64, 0x4b, 0x7a, 0xb2, 0x6c, 0x6d, 0x6f, 0x48, 0x29, 0x22, 0x59, 0x9c, 0x49, - 0x58, 0x5c, 0x0b, 0x68, 0x8d, 0x59, 0xa7, 0xf0, 0xa6, 0xb6, 0x82, 0x2c, 0x2b, 0x2b, 0x57, 0xf9, - 0x43, 0xb4, 0xb4, 0x21, 0x29, 0xa8, 0x52, 0xb5, 0x67, 0xda, 0xd2, 0xe0, 0x99, 0xe9, 0xc9, 0x74, - 0xcf, 0x1a, 0x71, 0xe7, 0xca, 0x99, 0x1b, 0x37, 0xfe, 0x09, 0xce, 0x54, 0xf1, 0x07, 0xc0, 0x91, - 0xff, 0x84, 0x03, 0xd5, 0x1f, 0x33, 0xfa, 0xb0, 0xbc, 0xd9, 0xda, 0x9c, 0xd4, 0xfd, 0xeb, 0xdf, - 0x7b, 0xfd, 0xbe, 0xfa, 0xe9, 0x0d, 0x34, 0xe2, 0xf4, 0x2a, 0xf0, 0xdd, 0xa7, 0x24, 0xf6, 0xdb, - 0x71, 0xc2, 0x04, 0x43, 0xdb, 0x2e, 0x8b, 0xbc, 0xd4, 0x17, 0x6d, 0x7d, 0xd2, 0x7a, 0x34, 0x61, - 0x6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x09, 0x11, 0x24, 0x66, 0x7e, 0x24, 0xd0, 0x2f, 0x32, 0xaf, - 0x2d, 0xa5, 0xf2, 0x87, 0xab, 0x2a, 0x17, 0xcc, 0x36, 0x21, 0x41, 0x1f, 0xc3, 0x96, 0xf0, 0x43, - 0xca, 0x05, 0x09, 0xe3, 0x71, 0xc8, 0x4d, 0xbc, 0x6a, 0x39, 0x76, 0xce, 0x9d, 0x7f, 0x58, 0xb0, - 0xa5, 0x25, 0x87, 0x34, 0xf1, 0x29, 0x47, 0x6d, 0x28, 0x45, 0x24, 0xa4, 0x26, 0x23, 0xad, 0xf5, - 0xb7, 0x5c, 0x90, 0x90, 0x62, 0xc5, 0x43, 0xcf, 0xa1, 0x12, 0x52, 0x41, 0x3c, 0x22, 0x88, 0xd2, - 0xbf, 0x26, 0xd6, 0x5a, 0xe6, 0xdc, 0xb0, 0x70, 0xce, 0x47, 0x5f, 0x00, 0x78, 0x99, 0x7f, 0xbc, - 0x59, 0x54, 0x99, 0xfa, 0xd1, 0x7a, 0xe9, 0x3c, 0x0e, 0x78, 0x41, 0xc4, 0x79, 0x0d, 0xdb, 0xcb, - 0xca, 0x91, 0x03, 0x5b, 0x82, 0x24, 0x13, 0x2a, 0x4e, 0x68, 0x1c, 0xb0, 0x99, 0x72, 0xa3, 0x8a, - 0x97, 0x30, 0xc9, 0xe1, 0x2c, 0x4d, 0x5c, 0x6a, 0x38, 0xb6, 0xe6, 0x2c, 0x62, 0xe8, 0x43, 0xa8, - 0xba, 0x2c, 0x8c, 0x59, 0x44, 0x23, 0xa1, 0x92, 0x58, 0xc5, 0x73, 0xc0, 0xe9, 0x67, 0xf7, 0x62, - 0xca, 0x63, 0x16, 0x71, 0x8a, 0x3e, 0x83, 0x72, 0xa8, 0x90, 0xac, 0xe2, 0x3e, 0x5c, 0xef, 0x87, - 0x8e, 0x32, 0xce, 0xc8, 0xce, 0x5f, 0x6c, 0xa8, 0x67, 0xaa, 0xbe, 0x4d, 0x29, 0x17, 0xe8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0x94, 0x86, 0xda, 0x35, 0x99, - 0x05, 0xb5, 0x53, 0xf6, 0x50, 0x31, 0x65, 0x5e, 0xb3, 0xaa, 0x71, 0xbd, 0x93, 0xa5, 0x48, 0x52, - 0x31, 0x65, 0x89, 0x2f, 0x66, 0x4d, 0xd0, 0xa5, 0x98, 0x03, 0xd2, 0xaa, 0x98, 0x88, 0x69, 0xb3, - 0xa6, 0xad, 0x92, 0xeb, 0xe3, 0x0a, 0x6c, 0xea, 0xfe, 0xe4, 0xec, 0x42, 0xa5, 0x13, 0xfb, 0xbd, - 0x24, 0x61, 0x89, 0xcc, 0x32, 0x95, 0x0b, 0x53, 0x48, 0x7a, 0xe3, 0x0c, 0xa0, 0x82, 0xa9, 0xee, - 0x54, 0xf2, 0xa6, 0x28, 0x4f, 0x91, 0x79, 0x12, 0x39, 0xa0, 0xfc, 0x9f, 0xc5, 0xd9, 0x6b, 0x50, - 0xeb, 0xbc, 0x36, 0x8b, 0xf3, 0xda, 0x74, 0x62, 0x78, 0x90, 0x69, 0x1c, 0xd2, 0x80, 0xba, 0xb2, - 0x30, 0xd0, 0x33, 0xa8, 0x24, 0x06, 0x34, 0xff, 0x37, 0xcd, 0xd5, 0xca, 0xcf, 0x84, 0x70, 0xce, - 0x44, 0x3f, 0x86, 0x6d, 0xf5, 0x0f, 0x3d, 0xe6, 0x4a, 0x11, 0x4b, 0xcc, 0xe5, 0x75, 0x85, 0x0e, - 0x0d, 0xe8, 0xfc, 0x0e, 0xea, 0x99, 0xb0, 0x76, 0xf5, 0xdd, 0x6e, 0xcb, 0x03, 0x64, 0x2f, 0x06, - 0xe8, 0x3f, 0x36, 0xa0, 0xa1, 0x20, 0x62, 0xa8, 0x3a, 0xca, 0x2c, 0xab, 0xb9, 0x17, 0x50, 0xc9, - 0x8d, 0xd2, 0x57, 0x7c, 0x7c, 0xdf, 0x15, 0x79, 0x14, 0x70, 0x2e, 0x82, 0x3e, 0x07, 0xf5, 0xaf, - 0x39, 0x7e, 0xeb,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93, 0xb7, 0xe8, 0x53, 0x4e, 0x01, 0x7d, 0x01, 0xe5, 0x6c, 0xbe, 0x5c, - 0xdf, 0xb4, 0x5b, 0x77, 0x3e, 0xc2, 0x16, 0x26, 0x56, 0xa7, 0x80, 0x7a, 0x50, 0xc9, 0xe6, 0xc9, - 0xfb, 0x34, 0xec, 0xae, 0xc2, 0xab, 0x03, 0xa8, 0x53, 0x40, 0x7f, 0x80, 0xea, 0x90, 0x06, 0xd7, - 0x5d, 0xf9, 0x29, 0x8d, 0x7e, 0x96, 0x0b, 0x98, 0x2f, 0xf0, 0xc5, 0xef, 0xec, 0x9c, 0x96, 0x79, - 0xfa, 0xf3, 0xb7, 0x64, 0x2f, 0xf8, 0x5c, 0x1c, 0x91, 0x18, 0xdd, 0x7d, 0x5e, 0xf9, 0xf8, 0xd6, - 0x6a, 0xae, 0xea, 0x1c, 0x91, 0xb8, 0xf7, 0x5a, 0x7e, 0x16, 0x15, 0xf6, 0xad, 0xab, 0x4d, 0x35, - 0x65, 0xfe, 0xf2, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xec, 0x4b, 0xec, 0x2d, 0x6a, 0x10, 0x00, - 0x00, + // 1204 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x5d, 0x6f, 0x1b, 0x45, + 0x17, 0xb6, 0xd7, 0x4e, 0xb2, 0x3e, 0x8e, 0xd3, 0x74, 0xf2, 0xbe, 0x68, 0x6b, 0xa0, 0x32, 0xdb, + 0x12, 0x22, 0x3e, 0x9c, 0xc8, 0x10, 0x89, 0xb4, 0x42, 0x90, 0xa4, 0x2e, 0x8e, 0xd4, 0x26, 0xd6, + 0xc4, 0x7c, 0x48, 0x5c, 0x58, 0xe3, 0xdd, 0x49, 0xbc, 0x64, 0x77, 0x67, 0xba, 0x33, 0x4b, 0xc8, + 0xff, 0xe0, 0x82, 0x3b, 0xee, 0xf8,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0x6d, 0x44, 0x38, 0xba, 0x3e, 0x54, + 0xe5, 0xa3, 0xa5, 0xed, 0xcd, 0xc7, 0x1c, 0x11, 0xde, 0xff, 0x89, 0xa6, 0xd2, 0xaf, 0x6c, 0x55, + 0x27, 0x8b, 0xfa, 0x6d, 0xf5, 0xe9, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x43, 0x1e, 0x96, 0xb2, + 0x3b, 0x0b, 0x00, 0x00, } diff --git a/controller/telemetry/client.go b/controller/telemetry/client.go deleted file mode 100644 index ddd1ef9c3c8d0..0000000000000 --- a/controller/telemetry/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package telemetry - -import ( - pb "github.com/runconduit/conduit/controller/gen/controller/telemetry" - "google.golang.org/grpc" -) - -func NewClient(addr string) (pb.TelemetryClient, *grpc.ClientConn, error) { - conn, err := grpc.Dial(addr, grpc.WithInsecure()) - if err != nil { - return nil, nil, err - } - - return pb.NewTelemetryClient(conn), conn, nil -} diff --git a/controller/telemetry/server.go b/controller/telemetry/server.go deleted file mode 100644 index ac40bda59b0ac..0000000000000 --- a/controller/telemetry/server.go +++ /dev/null @@ -1,453 +0,0 @@ -package telemetry - -import ( - "context" - "errors" - "fmt" - "net" - "net/http" - "strconv" - "time" - - "github.com/golang/protobuf/ptypes/duration" - "github.com/prometheus/client_golang/api" - "github.com/prometheus/client_golang/api/prometheus/v1" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/common/model" - common "github.com/runconduit/conduit/controller/gen/common" - read "github.com/runconduit/conduit/controller/gen/controller/telemetry" - write "github.com/runconduit/conduit/controller/gen/proxy/telemetry" - public "github.com/runconduit/conduit/controller/gen/public" - "github.com/runconduit/conduit/controller/k8s" - "github.com/runconduit/conduit/controller/util" - pkgK8s "github.com/runconduit/conduit/pkg/k8s" - log "github.com/sirupsen/logrus" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - k8sV1 "k8s.io/api/core/v1" -) - -const ( - reportsMetric = "reports_total" -) - -var ( - requestLabels = []string{"source_deployment", "target_deployment"} - requestsTotal = prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "requests_total", - Help: "Total number of requests", - }, - requestLabels, - ) - - responseLabels = append(requestLabels, []string{"http_status_code", "classification"}...) - responsesTotal = prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "responses_total", - Help: "Total number of responses", - }, - responseLabels, - ) - - responseLatencyBuckets = append(append(append(append(append( - prometheus.LinearBuckets(1, 1, 5), - prometheus.LinearBuckets(10, 10, 5)...), - prometheus.LinearBuckets(100, 100, 5)...), - prometheus.LinearBuckets(1000, 1000, 5)...), - prometheus.LinearBuckets(10000, 10000, 5)...), - ) - - responseLatency = prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "response_latency_ms", - Help: "Response latency in milliseconds", - Buckets: responseLatencyBuckets, - }, - requestLabels, - ) - - reportsLabels = []string{"pod"} - reportsTotal = prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: reportsMetric, - Help: "Total number of telemetry reports received", - }, - reportsLabels, - ) -) - -func init() { - prometheus.MustRegister(requestsTotal) - prometheus.MustRegister(responsesTotal) - prometheus.MustRegister(responseLatency) - prometheus.MustRegister(reportsTotal) -} - -type ( - server struct { - prometheusAPI v1.API - pods k8s.PodIndex - replicaSets *k8s.ReplicaSetStore - ignoredNamespaces []string - } -) - -func NewServer(addr, prometheusUrl string, ignoredNamespaces []string, kubeconfig string) (*grpc.Server, net.Listener, error) { - prometheusClient, err := api.NewClient(api.Config{Address: prometheusUrl}) - if err != nil { - return nil, nil, err - } - - clientSet, err := k8s.NewClientSet(kubeconfig) - if err != nil { - return nil, nil, err - } - - pods, err := k8s.NewPodsByIp(clientSet) - if err != nil { - return nil, nil, err - } - err = pods.Run() - if err != nil { - return nil, nil, err - } - - replicaSets, err := k8s.NewReplicaSetStore(clientSet) - if err != nil { - return nil, nil, err - } - err = replicaSets.Run() - if err != nil { - return nil, nil, err - } - - srv := &server{ - prometheusAPI: v1.NewAPI(prometheusClient), - pods: pods, - replicaSets: replicaSets, - ignoredNamespaces: ignoredNamespaces, - } - - lis, err := net.Listen("tcp", addr) - if err != nil { - return nil, nil, err - } - - s := util.NewGrpcServer() - read.RegisterTelemetryServer(s, srv) - write.RegisterTelemetryServer(s, srv) - - // TODO: register shutdown hook to call pods.Stop() and replicatSets.Stop() - - return s, lis, nil -} - -func (s *server) Query(ctx context.Context, req *read.QueryRequest) (*read.QueryResponse, error) { - log.Debugf("Query request: %+v", req) - - samples := make([]*read.Sample, 0) - - if req.EndMs == 0 { - err := fmt.Errorf("EndMs timestamp missing from request: %+v", req) - log.Errorf("%s", err) - return nil, err - } - end := time.Unix(0, req.EndMs*int64(time.Millisecond)) - - if req.StartMs != 0 && req.EndMs != 0 && req.Step != "" { - // timeseries query - - start := time.Unix(0, req.StartMs*int64(time.Millisecond)) - step, err := time.ParseDuration(req.Step) - if err != nil { - log.Errorf("ParseDuration(%+v) failed with: %+v", req.Step, err) - return nil, err - } - - queryRange := v1.Range{ - Start: start, - End: end, - Step: step, - } - - res, err := s.prometheusAPI.QueryRange(ctx, req.Query, queryRange) - if err != nil { - log.Errorf("QueryRange(%+v, %+v) failed with: %+v", req.Query, queryRange, err) - return nil, err - } - log.Debugf("Query response: %+v", res) - - if res.Type() != model.ValMatrix { - err = fmt.Errorf("Unexpected query result type (expected Matrix): %s", res.Type()) - log.Error(err) - return nil, err - } - for _, s := range res.(model.Matrix) { - samples = append(samples, convertSampleStream(s)) - } - } else { - // single data point (aka summary) query - - res, err := s.prometheusAPI.Query(ctx, req.Query, end) - if err != nil { - log.Errorf("Query(%+v, %+v) failed with: %+v", req.Query, end, err) - return nil, err - } - log.Debugf("Query response: %+v", res) - - if res.Type() != model.ValVector { - err = fmt.Errorf("Unexpected query result type (expected Vector): %s", res.Type()) - log.Error(err) - return nil, err - } - for _, s := range res.(model.Vector) { - samples = append(samples, convertSample(s)) - } - } - - return &read.QueryResponse{Metrics: samples}, nil -} - -func (s *server) ListPods(ctx context.Context, req *read.ListPodsRequest) (*public.ListPodsResponse, error) { - log.Debugf("ListPods request: %+v", req) - - pods, err := s.pods.List() - if err != nil { - return nil, err - } - - // Reports is a map from instance name to the absolute time of the most recent - // report from that instance. - reports := make(map[string]time.Time) - // Query Prometheus for reports in the last 30 seconds. - res, err := s.prometheusAPI.Query(ctx, reportsMetric+"[30s]", time.Time{}) - if err != nil { - return nil, err - } - if res.Type() != model.ValMatrix { - err = fmt.Errorf("Unexpected query result type (expected Matrix): %s", res.Type()) - log.Error(err) - return nil, err - } - for _, s := range res.(model.Matrix) { - labels := metricToMap(s.Metric) - timestamp := s.Values[len(s.Values)-1].Timestamp - reports[labels["pod"]] = time.Unix(0, int64(timestamp)*int64(time.Millisecond)) - } - - podList := make([]*public.Pod, 0) - - for _, pod := range pods { - if s.shouldIngore(pod) { - continue - } - deployment, err := s.replicaSets.GetDeploymentForPod(pod) - if err != nil { - log.Debugf("Cannot get deployment for pod %s: %s", pod.Name, err) - deployment = "" - } - name := pod.Namespace + "/" + pod.Name - updated, added := reports[name] - - status := string(pod.Status.Phase) - if pod.DeletionTimestamp != nil { - status = "Terminating" - } - - controllerComponent := pod.Labels[pkgK8s.ControllerComponentLabel] - controllerNS := pod.Labels[pkgK8s.ControllerNSLabel] - - item := &public.Pod{ - Name: pod.Namespace + "/" + pod.Name, - Deployment: deployment, - Status: status, - PodIP: pod.Status.PodIP, - Added: added, - ControllerNamespace: controllerNS, - ControlPlane: controllerComponent != "", - } - if added { - since := time.Since(updated) - item.SinceLastReport = &duration.Duration{ - Seconds: int64(since / time.Second), - Nanos: int32(since % time.Second), - } - } - podList = append(podList, item) - } - - return &public.ListPodsResponse{Pods: podList}, nil -} - -func (s *server) Report(ctx context.Context, req *write.ReportRequest) (*write.ReportResponse, error) { - log.Debugf("Report request: %+v", req) - - id := "unknown" - if req.Process != nil { - id = req.Process.ScheduledNamespace + "/" + req.Process.ScheduledInstance - } - - logCtx := log.WithFields(log.Fields{"id": id}) - logCtx.Debugf("Received report with %d requests", len(req.Requests)) - - reportsTotal.With(prometheus.Labels{"pod": id}).Inc() - - for _, requestScope := range req.Requests { - if requestScope.Ctx == nil { - return nil, errors.New("RequestCtx is required") - } - requestLabels := s.requestLabelsFor(requestScope) - requestsTotal.With(requestLabels).Add(float64(requestScope.Count)) - latencyStat := responseLatency.With(requestLabels) - - for _, responseScope := range requestScope.Responses { - if responseScope.Ctx == nil { - return nil, errors.New("ResponseCtx is required") - } - - // Validate this ResponseScope's latency histogram. - numBuckets := len(responseScope.ResponseLatencyCounts) - expectedNumBuckets := len(req.HistogramBucketBoundsTenthMs) - if numBuckets != expectedNumBuckets { - err := errors.New( - "received report with incorrect number of latency buckets") - logCtx.WithFields(log.Fields{ - "numBuckets": numBuckets, - "expected": expectedNumBuckets, - "scope": responseScope, - }).WithError(err).Error() - return nil, err - } - - for bucketNum, count := range responseScope.ResponseLatencyCounts { - // Look up the bucket max value corresponding to this position - // in the report's latency histogram. - latencyTenthsMs := req.HistogramBucketBoundsTenthMs[bucketNum] - latencyMs := float64(latencyTenthsMs) / 10 - for i := uint32(0); i < count; i++ { - // Then, report that latency value to Prometheus a number - // of times equal to the count reported by the proxy. - latencyStat.Observe(latencyMs) - } - - } - - for _, eosScope := range responseScope.Ends { - if eosScope.Ctx == nil { - return nil, errors.New("EosCtx is required") - } - - responseLabels := s.requestLabelsFor(requestScope) - for k, v := range responseLabelsFor(responseScope, eosScope) { - responseLabels[k] = v - } - - responsesTotal.With(responseLabels).Add(float64(eosScope.Streams)) - } - } - - } - return &write.ReportResponse{}, nil -} - -func (s *server) shouldIngore(pod *k8sV1.Pod) bool { - for _, namespace := range s.ignoredNamespaces { - if pod.Namespace == namespace { - return true - } - } - return false -} - -// getDeployment returns the name of the deployment associated with a pod. -// If the name of the deployment could not be found, then a message will be -// logged, and getDeployment will return an emtpy string. -func (s *server) getDeployment(ip *common.IPAddress) string { - ipStr := util.IPToString(ip) - pods, err := s.pods.GetPodsByIndex(ipStr) - if err != nil { - log.Debugf("Cannot get pod for IP %s: %s", ipStr, err) - return "" - } - if len(pods) == 0 { - log.Debugf("No pod exists for IP %s", ipStr) - return "" - } - if len(pods) > 1 { - log.Debugf("Multiple pods found for IP %s", ipStr) - return "" - } - pod := pods[0] - deployment, err := (*s.replicaSets).GetDeploymentForPod(pod) - if err != nil { - log.WithError(err).Debugf("Cannot get deployment for pod %s", pod.Name) - return "" - } - return deployment -} - -func metricToMap(metric model.Metric) map[string]string { - labels := make(map[string]string) - for k, v := range metric { - labels[string(k)] = string(v) - } - return labels -} - -func convertSampleStream(sample *model.SampleStream) *read.Sample { - values := make([]*read.SampleValue, 0) - for _, s := range sample.Values { - v := read.SampleValue{ - Value: float64(s.Value), - TimestampMs: int64(s.Timestamp), - } - values = append(values, &v) - } - - return &read.Sample{Values: values, Labels: metricToMap(sample.Metric)} -} - -func convertSample(sample *model.Sample) *read.Sample { - values := []*read.SampleValue{ - &read.SampleValue{ - Value: float64(sample.Value), - TimestampMs: int64(sample.Timestamp), - }, - } - - return &read.Sample{Values: values, Labels: metricToMap(sample.Metric)} -} - -func (s *server) requestLabelsFor(requestScope *write.RequestScope) prometheus.Labels { - sourceDeployment := s.getDeployment(requestScope.Ctx.SourceIp) - targetDeployment := s.getDeployment(requestScope.Ctx.TargetAddr.Ip) - - return prometheus.Labels{ - "source_deployment": sourceDeployment, - "target_deployment": targetDeployment, - } -} - -func responseLabelsFor(responseScope *write.ResponseScope, eosScope *write.EosScope) prometheus.Labels { - httpStatusCode := strconv.Itoa(int(responseScope.Ctx.HttpStatusCode)) - classification := "failure" - switch x := eosScope.Ctx.End.(type) { - case *write.EosCtx_GrpcStatusCode: - // The stream ended with a `grpc-status` trailer. - // Classify based on the gRPC status code. - if x.GrpcStatusCode == uint32(codes.OK) { - classification = "success" - } - case *write.EosCtx_Other: - // The stream did not end with a `grpc-status` trailer (i.e., it was - // not a gRPC message). Classify based on the response's HTTP status. - if responseScope.Ctx.HttpStatusCode < http.StatusInternalServerError { - classification = "success" - } - } - return prometheus.Labels{ - "http_status_code": httpStatusCode, - "classification": classification, - } -} diff --git a/controller/telemetry/server_test.go b/controller/telemetry/server_test.go deleted file mode 100644 index 43416c82dbf89..0000000000000 --- a/controller/telemetry/server_test.go +++ /dev/null @@ -1,156 +0,0 @@ -package telemetry - -import ( - "context" - "errors" - "reflect" - "testing" - - "github.com/prometheus/common/model" - "github.com/runconduit/conduit/controller/api/public" - read "github.com/runconduit/conduit/controller/gen/controller/telemetry" -) - -type testResponse struct { - err error - promRes model.Value - queryReq *read.QueryRequest - queryRes *read.QueryResponse -} - -func TestServerResponses(t *testing.T) { - responses := []testResponse{ - - testResponse{ - err: errors.New("EndMs timestamp missing from request: query:\"fake query0\" "), - promRes: &model.Scalar{}, - queryReq: &read.QueryRequest{ - Query: "fake query0", - }, - queryRes: nil, - }, - testResponse{ - err: errors.New("Unexpected query result type (expected Vector): scalar"), - promRes: &model.Scalar{}, - queryReq: &read.QueryRequest{ - Query: "fake query1", - EndMs: 1, - }, - queryRes: nil, - }, - testResponse{ - err: errors.New("Unexpected query result type (expected Vector): matrix"), - promRes: model.Matrix{}, - queryReq: &read.QueryRequest{ - Query: "fake query2", - EndMs: 1, - }, - queryRes: nil, - }, - testResponse{ - err: errors.New("Unexpected query result type (expected Matrix): vector"), - promRes: model.Vector{}, - queryReq: &read.QueryRequest{ - Query: "fake query3", - StartMs: 1, - EndMs: 2, - Step: "10s", - }, - queryRes: nil, - }, - testResponse{ - err: nil, - promRes: model.Vector{ - &model.Sample{ - Metric: model.Metric{"fake label": "fake value"}, - Value: 123, - Timestamp: 456, - }, - &model.Sample{ - Metric: model.Metric{"fake label2": "fake value2"}, - Value: 321, - Timestamp: 654, - }, - }, - queryReq: &read.QueryRequest{ - Query: "fake query4", - EndMs: 1, - }, - queryRes: &read.QueryResponse{ - Metrics: []*read.Sample{ - &read.Sample{ - Values: []*read.SampleValue{{Value: 123, TimestampMs: 456}}, - Labels: map[string]string{"fake label": "fake value"}, - }, - &read.Sample{ - Values: []*read.SampleValue{{Value: 321, TimestampMs: 654}}, - Labels: map[string]string{"fake label2": "fake value2"}, - }, - }, - }, - }, - testResponse{ - err: nil, - promRes: model.Matrix{ - &model.SampleStream{ - Metric: model.Metric{"fake label": "fake value"}, - Values: []model.SamplePair{ - {Timestamp: 1, Value: 2}, - {Timestamp: 3, Value: 4}, - }, - }, - &model.SampleStream{ - Metric: model.Metric{"fake label2": "fake value2"}, - Values: []model.SamplePair{ - {Timestamp: 5, Value: 6}, - {Timestamp: 7, Value: 8}, - }, - }, - }, - queryReq: &read.QueryRequest{ - Query: "fake query5", - StartMs: 1, - EndMs: 2, - Step: "10s", - }, - queryRes: &read.QueryResponse{ - Metrics: []*read.Sample{ - &read.Sample{ - Values: []*read.SampleValue{ - {Value: 2, TimestampMs: 1}, - {Value: 4, TimestampMs: 3}, - }, - Labels: map[string]string{"fake label": "fake value"}, - }, - &read.Sample{ - Values: []*read.SampleValue{ - {Value: 6, TimestampMs: 5}, - {Value: 8, TimestampMs: 7}, - }, - Labels: map[string]string{"fake label2": "fake value2"}, - }, - }, - }, - }, - } - - t.Run("Queries return the expected responses", func(t *testing.T) { - for _, tr := range responses { - s := server{ - prometheusAPI: &public.MockProm{Res: tr.promRes}, - } - res, err := s.Query(context.Background(), tr.queryReq) - if err != nil || tr.err != nil { - if (err == nil && tr.err != nil) || - (err != nil && tr.err == nil) || - (err.Error() != tr.err.Error()) { - t.Fatalf("Unexpected error (Expected: %s, Got: %s)", tr.err, err) - } - } - - if !reflect.DeepEqual(res, tr.queryRes) { - t.Fatalf("Unexpected response:\n%+v\n!=\n%+v", res, tr.queryRes) - } - } - }) -} diff --git a/docker-compose.yml b/docker-compose.yml index cd0e8ce553eec..f0d2adeafd80f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,24 +35,6 @@ services: - -metrics-addr=:9998 - -kubeconfig=/kubeconfig - telemetry: - build: - context: . - dockerfile: controller/Dockerfile - args: - - CONDUIT_VERSION=latest - ports: - - "8087:8087" - - "9997:9997" - volumes: - - ~/.kube/config:/kubeconfig:ro - command: - - telemetry - - -addr=:8087 - - -metrics-addr=:9997 - - -prometheus-url=http://prometheus:9090 - - -kubeconfig=/kubeconfig - proxy-api: build: context: . @@ -66,7 +48,6 @@ services: - proxy-api - -addr=:8086 - -metrics-addr=:9996 - - -telemetry-addr=telemetry:8087 - -destination-addr=destination:8089 public-api: @@ -84,7 +65,6 @@ services: - public-api - -addr=:8085 - -metrics-addr=:9995 - - -telemetry-addr=telemetry:8087 - -tap-addr=tap:8088 - -prometheus-url=http://prometheus:9090 - -kubeconfig=/kubeconfig diff --git a/proto/controller/telemetry/telemetry.proto b/proto/controller/telemetry/telemetry.proto deleted file mode 100644 index 275cb3bab4dea..0000000000000 --- a/proto/controller/telemetry/telemetry.proto +++ /dev/null @@ -1,45 +0,0 @@ -syntax = "proto3"; - -package conduit.controller.telemetry; - -import "public/api.proto"; - -/// Telemetry Service /// -// -// Internal Telemetry Service read API - -service Telemetry { - rpc Query(QueryRequest) returns (QueryResponse) {} - rpc ListPods(ListPodsRequest) returns (public.ListPodsResponse) {} -} - -message QueryRequest { - // required - string query = 1; - - // required for timeseries queries - int64 start_ms = 2; - - // required for timeseries queries - // optional for single data point, but if unset, results will have non-deterministic timestamps - int64 end_ms = 3; - - // required for timeseries queries - string step = 4; -} - -message QueryResponse { - repeated Sample metrics = 1; -} - -message Sample { - repeated SampleValue values = 1; - map labels = 2; -} - -message SampleValue { - double value = 1; - int64 timestamp_ms = 2; -} - -message ListPodsRequest {} diff --git a/proto/proxy/telemetry/telemetry.proto b/proto/proxy/telemetry/telemetry.proto deleted file mode 100644 index 2395b239e9097..0000000000000 --- a/proto/proxy/telemetry/telemetry.proto +++ /dev/null @@ -1,106 +0,0 @@ -syntax = "proto3"; - -package conduit.proxy.telemetry; - -import "common/common.proto"; - -/// Telemetry Service /// -// -// Reports request metadata. - -service Telemetry { - rpc Report(ReportRequest) returns (ReportResponse) {} -} - -message ReportRequest { - - Process process = 1; - - enum Proxy { - INBOUND = 0; - OUTBOUND = 1; - } - Proxy proxy = 2; - - repeated ServerTransport server_transports = 3; - repeated ClientTransport client_transports = 4; - - repeated RequestScope requests = 5; - - // The inclusive upper bound of each bucket in the response latency histogram, - // in tenths of a millisecond. - // - // Each ResponseScope message will contain an array of numbers representing - // the number of observed response latencies in each bucket of the latency - // histogram. Since the structure of the latency histogram will be the same - // across all ResponseScopes, we only need to report the max values for these - // buckets a single time. - repeated uint32 histogram_bucket_bounds_tenth_ms = 6; -} - -message Process { - string node = 1; - string scheduled_instance = 2; - string scheduled_namespace = 3; -} - -message ServerTransport { - common.IPAddress source_ip = 1; - uint32 connects = 2; - repeated TransportSummary disconnects = 3; - common.Protocol protocol = 4; -} - -message ClientTransport { - common.TcpAddress target_addr = 1; - uint32 connects = 2; - repeated TransportSummary disconnects = 3; - common.Protocol protocol = 4; -} - -message TransportSummary { - uint64 duration_ms = 1; - uint64 bytes_sent = 2; -} - -message RequestScope { - RequestCtx ctx = 1; - uint32 count = 2; - repeated ResponseScope responses = 3; -} - -message RequestCtx { - common.IPAddress source_ip = 1; - common.TcpAddress target_addr = 2; - string authority = 3; -} - -message ResponseScope { - ResponseCtx ctx = 1; - // Response latencies (time from request headers sent to response headers - // received). Represented as a histogram with buckets whose inclusive - // upper bounds are given in the `histogram_bucket_bounds_tenths_ms` array in - // `ReportRequest`. Each number in this array represents the number of times a - // latency falling into that bucket was observed. - repeated uint32 response_latency_counts = 2; - repeated EosScope ends = 3; -} - -message ResponseCtx { - uint32 http_status_code = 1; -} - -message EosScope { - EosCtx ctx = 1; - uint32 streams = 2; -} - -message EosCtx { - oneof end { - uint32 grpc_status_code = 1; - uint32 reset_error_code = 2; - bool other = 3; // Stream ended without reset and without grpc status code - } -} - -message ReportResponse {} diff --git a/proto/public/api.proto b/proto/public/api.proto index 63df7652e8bed..50f030b90842b 100644 --- a/proto/public/api.proto +++ b/proto/public/api.proto @@ -7,12 +7,6 @@ import "google/protobuf/duration.proto"; import "common/common.proto"; import "common/healthcheck/healthcheck.proto"; -enum MetricName { - REQUEST_RATE = 0; - LATENCY = 1; - SUCCESS_RATE = 2; -} - enum TimeWindow { TEN_SEC = 0; ONE_MIN = 1; @@ -20,66 +14,6 @@ enum TimeWindow { ONE_HOUR = 3; } -enum AggregationType { - TARGET_DEPLOY = 0; - SOURCE_DEPLOY = 1; - MESH = 2; -} - -enum HistogramLabel { - MIN = 0; - P50 = 1; - P95 = 2; - P99 = 3; - MAX = 4; -} - -message HistogramValue { - HistogramLabel label = 1; - int64 value = 2; -} - -message Histogram { - repeated HistogramValue values = 1; -} - -message MetricValue { - oneof value { - int64 counter = 1; - double gauge = 2; - Histogram histogram = 3; - } -} - -message MetricDatapoint { - MetricValue value = 1; - int64 timestamp_ms = 2; -} - -message MetricSeries { - MetricName name = 1; - MetricMetadata metadata = 2; - repeated MetricDatapoint datapoints = 3; -} - -message MetricMetadata { - string targetDeploy = 1; - string sourceDeploy = 2; - string component = 3; -} - -message MetricResponse { - repeated MetricSeries metrics = 1; -} - -message MetricRequest { - repeated MetricName metrics = 1; - TimeWindow window = 2; - AggregationType groupBy = 3; - MetricMetadata filterBy = 4; - bool summarize = 5; -} - message Empty {} message VersionInfo { @@ -190,7 +124,6 @@ message StatTable { } service Api { - rpc Stat(MetricRequest) returns (MetricResponse) {} rpc StatSummary(StatSummaryRequest) returns (StatSummaryResponse) {} rpc Version(Empty) returns (VersionInfo) {} rpc ListPods(Empty) returns (ListPodsResponse) {} diff --git a/web/app/js/components/ServiceMesh.jsx b/web/app/js/components/ServiceMesh.jsx index 19243871bda48..d6a1c06f292a4 100644 --- a/web/app/js/components/ServiceMesh.jsx +++ b/web/app/js/components/ServiceMesh.jsx @@ -33,7 +33,6 @@ const componentNames = { "proxy-api": "Proxy API", "public-api": "Public API", "tap": "Tap", - "telemetry": "Telemetry", "web": "Web UI" }; @@ -43,7 +42,6 @@ const componentDeploys = { "proxy-api": "controller", "public-api": "controller", "tap": "controller", - "telemetry": "controller", "web": "web" }; diff --git a/web/app/js/components/util/ApiHelpers.jsx b/web/app/js/components/util/ApiHelpers.jsx index 987b67b3c70e1..5c6db8ca79dda 100644 --- a/web/app/js/components/util/ApiHelpers.jsx +++ b/web/app/js/components/util/ApiHelpers.jsx @@ -37,7 +37,7 @@ const makeCancelable = (promise, onSuccess) => { }; }; -export const ApiHelpers = (pathPrefix, defaultMetricsWindow = '10m') => { +export const ApiHelpers = (pathPrefix, defaultMetricsWindow = '1m') => { let metricsWindow = defaultMetricsWindow; const podsPath = `/api/pods`; diff --git a/web/app/test/ApiHelpersTest.jsx b/web/app/test/ApiHelpersTest.jsx index ad5641040dd25..122a3d01a1333 100644 --- a/web/app/test/ApiHelpersTest.jsx +++ b/web/app/test/ApiHelpersTest.jsx @@ -33,11 +33,11 @@ describe('ApiHelpers', () => { describe('getMetricsWindow/setMetricsWindow', () => { it('sets a default metricsWindow', () => { - expect(api.getMetricsWindow()).to.equal('10m'); + expect(api.getMetricsWindow()).to.equal('1m'); }); it('changes the metricsWindow on valid window input', () => { - expect(api.getMetricsWindow()).to.equal('10m'); + expect(api.getMetricsWindow()).to.equal('1m'); api.setMetricsWindow('10s'); expect(api.getMetricsWindow()).to.equal('10s'); @@ -47,13 +47,16 @@ describe('ApiHelpers', () => { api.setMetricsWindow('10m'); expect(api.getMetricsWindow()).to.equal('10m'); + + api.setMetricsWindow('1h'); + expect(api.getMetricsWindow()).to.equal('1h'); }); it('does not change metricsWindow on invalid window size', () => { - expect(api.getMetricsWindow()).to.equal('10m'); + expect(api.getMetricsWindow()).to.equal('1m'); api.setMetricsWindow('10h'); - expect(api.getMetricsWindow()).to.equal('10m'); + expect(api.getMetricsWindow()).to.equal('1m'); }); }); @@ -243,21 +246,21 @@ describe('ApiHelpers', () => { api.fetchMetrics('/my/path'); expect(fetchStub.calledOnce).to.be.true; - expect(fetchStub.args[0][0]).to.equal('/the/prefix/my/path?window=10m'); + expect(fetchStub.args[0][0]).to.equal('/the/prefix/my/path?window=1m'); }); it('adds a ?window= if metricsWindow is the only param', () => { api.fetchMetrics('/api/stat'); expect(fetchStub.calledOnce).to.be.true; - expect(fetchStub.args[0][0]).to.equal('/api/stat?window=10m'); + expect(fetchStub.args[0][0]).to.equal('/api/stat?window=1m'); }); it('adds &window= if metricsWindow is not the only param', () => { api.fetchMetrics('/api/stat?foo=3&bar="me"'); expect(fetchStub.calledOnce).to.be.true; - expect(fetchStub.args[0][0]).to.equal('/api/stat?foo=3&bar="me"&window=10m'); + expect(fetchStub.args[0][0]).to.equal('/api/stat?foo=3&bar="me"&window=1m'); }); it('does not add another &window= if there is already a window param', () => {