...

Package api

import "github.com/linkerd/linkerd2/viz/metrics-api"
Overview
Index
Subdirectories

Overview ▾

Index ▾

Constants
Variables
func GenEdgesResponse(resourceType string, edgeRowNamespace string) *pb.EdgesResponse
func GenStatSummaryResponse(resName, resType string, resNs []string, counts *PodCounts, basicStats bool, tcpStats bool) *pb.StatSummaryResponse
func GenTopRoutesResponse(routes []string, counts []uint64, outbound bool, authority string) *pb.TopRoutesResponse
func NewGrpcServer(promAPI promv1.API, k8sAPI *k8s.API, controllerNamespace string, clusterDomain string, ignoredNamespaces []string) *grpc.Server
type MockAPIClient
    func (c *MockAPIClient) Authz(ctx context.Context, in *pb.AuthzRequest, opts ...grpc.CallOption) (*pb.AuthzResponse, error)
    func (c *MockAPIClient) Edges(ctx context.Context, in *pb.EdgesRequest, opts ...grpc.CallOption) (*pb.EdgesResponse, error)
    func (c *MockAPIClient) Gateways(ctx context.Context, in *pb.GatewaysRequest, opts ...grpc.CallOption) (*pb.GatewaysResponse, error)
    func (c *MockAPIClient) ListPods(ctx context.Context, in *pb.ListPodsRequest, opts ...grpc.CallOption) (*pb.ListPodsResponse, error)
    func (c *MockAPIClient) ListServices(ctx context.Context, in *pb.ListServicesRequest, opts ...grpc.CallOption) (*pb.ListServicesResponse, error)
    func (c *MockAPIClient) SelfCheck(ctx context.Context, in *pb.SelfCheckRequest, _ ...grpc.CallOption) (*pb.SelfCheckResponse, error)
    func (c *MockAPIClient) StatSummary(ctx context.Context, in *pb.StatSummaryRequest, opts ...grpc.CallOption) (*pb.StatSummaryResponse, error)
    func (c *MockAPIClient) TopRoutes(ctx context.Context, in *pb.TopRoutesRequest, opts ...grpc.CallOption) (*pb.TopRoutesResponse, error)
type PodCounts
type Server

Package files

authz.go edges.go gateways.go grpc_server.go policy.go prometheus.go stat_summary.go test_helper.go top_routes.go

Constants

const (

    // DefaultRouteName is the name to display for requests that don't match any routes.
    DefaultRouteName = "[DEFAULT]"
)

Variables

var (
    // ErrNoPrometheusInstance is returned when there is no prometheus instance configured
    ErrNoPrometheusInstance = errors.New("No prometheus instance to connect")
)

func GenEdgesResponse

func GenEdgesResponse(resourceType string, edgeRowNamespace string) *pb.EdgesResponse

GenEdgesResponse generates a mock metrics-api EdgesResponse object.

func GenStatSummaryResponse

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

func GenTopRoutesResponse(routes []string, counts []uint64, outbound bool, authority string) *pb.TopRoutesResponse

GenTopRoutesResponse generates a mock metrics-api TopRoutesResponse object.

func NewGrpcServer

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.

type MockAPIClient

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 (*MockAPIClient) Authz

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 (*MockAPIClient) Edges

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 (*MockAPIClient) Gateways

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 (*MockAPIClient) ListPods

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 (*MockAPIClient) ListServices

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 (*MockAPIClient) SelfCheck

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 (*MockAPIClient) StatSummary

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 (*MockAPIClient) TopRoutes

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.

type PodCounts

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
}

type Server

Server specifies the interface the Viz metric API server should implement

type Server interface {
    pb.ApiServer
}

Subdirectories

Name Synopsis
..
client
cmd
gen
viz
util