const ( // DefaultRouteName is the name to display for requests that don't match any routes. DefaultRouteName = "[DEFAULT]" )
var ( // ErrNoPrometheusInstance is returned when there is no prometheus instance configured ErrNoPrometheusInstance = errors.New("No prometheus instance to connect") )
func GenEdgesResponse(resourceType string, edgeRowNamespace string) *pb.EdgesResponse
GenEdgesResponse generates a mock metrics-api EdgesResponse object.
func GenStatSummaryResponse(resName, resType string, resNs []string, counts *PodCounts, basicStats bool, tcpStats bool) *pb.StatSummaryResponse
GenStatSummaryResponse generates a mock metrics-api StatSummaryResponse object.
func GenTopRoutesResponse(routes []string, counts []uint64, outbound bool, authority string) *pb.TopRoutesResponse
GenTopRoutesResponse generates a mock metrics-api TopRoutesResponse object.
func NewGrpcServer( promAPI promv1.API, k8sAPI *k8s.API, controllerNamespace string, clusterDomain string, ignoredNamespaces []string, ) *grpc.Server
NewGrpcServer creates a new instance of the Api server and registers it with Prometheus.
MockAPIClient satisfies the metrics-api gRPC interfaces
type MockAPIClient struct { ErrorToReturn error ListPodsResponseToReturn *pb.ListPodsResponse ListServicesResponseToReturn *pb.ListServicesResponse StatSummaryResponseToReturn *pb.StatSummaryResponse AuthzResponseToReturn *pb.AuthzResponse GatewaysResponseToReturn *pb.GatewaysResponse TopRoutesResponseToReturn *pb.TopRoutesResponse EdgesResponseToReturn *pb.EdgesResponse SelfCheckResponseToReturn *pb.SelfCheckResponse }
func (c *MockAPIClient) Authz(ctx context.Context, in *pb.AuthzRequest, opts ...grpc.CallOption) (*pb.AuthzResponse, error)
Authz provides a mock of a metrics-api method.
func (c *MockAPIClient) Edges(ctx context.Context, in *pb.EdgesRequest, opts ...grpc.CallOption) (*pb.EdgesResponse, error)
Edges provides a mock of a metrics-api method.
func (c *MockAPIClient) Gateways(ctx context.Context, in *pb.GatewaysRequest, opts ...grpc.CallOption) (*pb.GatewaysResponse, error)
Gateways provides a mock of a metrics-api method.
func (c *MockAPIClient) ListPods(ctx context.Context, in *pb.ListPodsRequest, opts ...grpc.CallOption) (*pb.ListPodsResponse, error)
ListPods provides a mock of a metrics-api method.
func (c *MockAPIClient) ListServices(ctx context.Context, in *pb.ListServicesRequest, opts ...grpc.CallOption) (*pb.ListServicesResponse, error)
ListServices provides a mock of a metrics-api method.
func (c *MockAPIClient) SelfCheck(ctx context.Context, in *pb.SelfCheckRequest, _ ...grpc.CallOption) (*pb.SelfCheckResponse, error)
SelfCheck provides a mock of a metrics-api method.
func (c *MockAPIClient) StatSummary(ctx context.Context, in *pb.StatSummaryRequest, opts ...grpc.CallOption) (*pb.StatSummaryResponse, error)
StatSummary provides a mock of a metrics-api method.
func (c *MockAPIClient) TopRoutes(ctx context.Context, in *pb.TopRoutesRequest, opts ...grpc.CallOption) (*pb.TopRoutesResponse, error)
TopRoutes provides a mock of a metrics-api method.
PodCounts is a test helper struct that is used for representing data in a StatTable.PodGroup.Row.
type PodCounts struct { Status string MeshedPods uint64 RunningPods uint64 FailedPods uint64 Errors map[string]*pb.PodErrors }
Server specifies the interface the Viz metric API server should implement
type Server interface { pb.ApiServer }