Documentation ¶
Overview ¶
Package service provides prometheus service for user to query metrics.
Index ¶
- Variables
- func GenerateD3JSON(w io.Writer, g *Dynamic) error
- func Init()
- func InitKube()
- func InitProm()
- func NewPromHandler(addr string, static *Static, writer SerializeFn) http.Handler
- type Attributes
- type Dynamic
- type Edge
- type Graph
- type KubePodStatus
- type KubeServiceStatus
- type SerializeFn
- type Static
- type Tree
Constants ¶
This section is empty.
Variables ¶
var ( // ServiceInfo handles normal service running in the k8s ServiceInfo *kubeInfo // IstioInfo handles istio service running in the k8s IstioInfo *kubeInfo )
var Prom *prom
Prom wraps prom service for easily use.
var Task task
Task wraps task service for easily use.
var TaskTmpl taskTmpl
TaskTmpl wraps task service for easily use.
var TaskTmplVar taskTmplVar
TaskTmplVar wraps task service for easily use.
Functions ¶
func GenerateD3JSON ¶
GenerateD3JSON converts the standard Dynamic graph to d3Graph, then serializes to JSON.
func NewPromHandler ¶
func NewPromHandler(addr string, static *Static, writer SerializeFn) http.Handler
NewPromHandler returns a new http.Handler that will serve servicegraph data based on queries against a prometheus backend.
Types ¶
type Attributes ¶
Attributes contain a set of annotations for an edge.
type Dynamic ¶
Dynamic represents a service graph generated on the fly.
type Edge ¶
type Edge struct { Source string `json:"source"` Target string `json:"target"` Labels Attributes `json:"labels"` }
Edge represents an edge in a dynamic service graph.
type KubePodStatus ¶
type KubePodStatus struct { UID string `json:"uid"` Name string `json:"name"` Ready string `json:"ready"` Status string `json:"status"` // Pending、Running、Succeeded、Failed、Unknown Restarts int `json:"restarts"` Age string `json:"age"` }
KubePodStatus defines pods' status of specific service.
type KubeServiceStatus ¶
type KubeServiceStatus struct { UID string `json:"uid"` Name string `json:"name"` Type string `json:"type"` ClusterIP string `json:"clusterIP"` ExternalIP string `json:"externalIP"` Ports string `json:"ports"` Age string `json:"age"` }
KubeServiceStatus defines services' status of specific service.
type SerializeFn ¶
SerializeFn provides a mechanism for writing out the service graph.