| 60 | } |
| 61 | |
| 62 | func cortexReadRoutes(cfg Config) []querytee.Route { |
| 63 | prefix := cfg.PathPrefix |
| 64 | |
| 65 | // Strip trailing slashes. |
| 66 | for len(prefix) > 0 && prefix[len(prefix)-1] == '/' { |
| 67 | prefix = prefix[:len(prefix)-1] |
| 68 | } |
| 69 | |
| 70 | samplesComparator := querytee.NewSamplesComparator(cfg.ProxyConfig.ValueComparisonTolerance) |
| 71 | return []querytee.Route{ |
| 72 | {Path: prefix + "/api/v1/query", RouteName: "api_v1_query", Methods: []string{"GET"}, ResponseComparator: samplesComparator}, |
| 73 | {Path: prefix + "/api/v1/query_range", RouteName: "api_v1_query_range", Methods: []string{"GET"}, ResponseComparator: samplesComparator}, |
| 74 | {Path: prefix + "/api/v1/query_exemplars", RouteName: "api_v1_query_exemplars", Methods: []string{"GET"}, ResponseComparator: nil}, |
| 75 | {Path: prefix + "/api/v1/labels", RouteName: "api_v1_labels", Methods: []string{"GET"}, ResponseComparator: nil}, |
| 76 | {Path: prefix + "/api/v1/label/{name}/values", RouteName: "api_v1_label_name_values", Methods: []string{"GET"}, ResponseComparator: nil}, |
| 77 | {Path: prefix + "/api/v1/series", RouteName: "api_v1_series", Methods: []string{"GET"}, ResponseComparator: nil}, |
| 78 | {Path: prefix + "/api/v1/metadata", RouteName: "api_v1_metadata", Methods: []string{"GET"}, ResponseComparator: nil}, |
| 79 | {Path: prefix + "/api/v1/rules", RouteName: "api_v1_rules", Methods: []string{"GET"}, ResponseComparator: nil}, |
| 80 | {Path: prefix + "/api/v1/alerts", RouteName: "api_v1_alerts", Methods: []string{"GET"}, ResponseComparator: nil}, |
| 81 | } |
| 82 | } |