Documentation ¶
Index ¶
- Constants
- func CreateDashboardURL(serviceName string, jobmap *map[string]JobInfoM, ...) string
- func ForemastQuery(jobmap *map[string]JobInfoM, appName string, metricmap map[string]string) bool
- func GenerateReport(serviceName string, info JobInfoM, currentYear *int, currentMonth *time.Month, ...) string
- func GenerateSummaryReport(serviceslist map[string]JobInfoM, currentYear *int, currentMonth *time.Month, ...)
- func MonitorService(serviceName string, mutex *sync.Mutex, anomalyfilename *string, ...)
- func QueryWavefrontAnomalyCount(serviceName string, query string, metricName string, unixtime int64, ...) float64
- func StartAnalyzing(analyzingRequest ApplicationHealthAnalyzeRequest) (string, error)
- type Analyst
- type AnomalousMetric
- type AnomalousMetricValue
- type Anomaly
- type AnomalyInfo
- type ApplicationHealthAnalyzeRequest
- type ApplicationHealthAnalyzeResponse
- type Client
- type ContactData
- type DeploymentMetadata
- type DeploymentMetadataList
- type DeploymentMetadataSpec
- type DeploymentMetadataStatus
- type DeploymentMonitor
- type DeploymentMonitorList
- type DeploymentMonitorSpec
- type DeploymentMonitorStatus
- type Descriptor
- type ImageSpec
- type Interface
- type JobInfo
- type JobInfoM
- type JobRequest
- type Link
- type Logs
- type MetricQuery
- type Metrics
- type MetricsInfo
- type Monitoring
- type RemediationAction
Constants ¶
const ( MonitorPhaseHealthy = "Healthy" MonitorPhaseRunning = "Running" MonitorPhaseFailed = "Failed" MonitorPhaseUnhealthy = "Unhealthy" MonitorPhaseWarning = "Warning" MonitorPhaseExpired = "Expired" MonitorPhaseAbort = "Abort" )
"healthy" deployment is considered healthy, "running" the deployment is running and it is detecting, "error" got error, "anomaly" engine detected anomaly issues,
const ( //No remediation required RemediationNone = "None" //Trigger a rollback if error occured RemediationAutoRollback = "AutoRollback" //Trigger a pause only to reduce the error rate RemediationAutoPause = "AutoPause" //Trigger an auto scaling for specific use cases, for example, connection stack or CPU bump up a lot //RemediationAutoScaling = "AutoScaling" //Let foremast take care everything for you RemediationAuto = "Auto" )
Constants for Actions
const CategoryBaseline = "baseline"
const CategoryCurrent = "current"
const CategoryHistorical = "historical"
const StrategyCanary = "canary"
const StrategyContinuous = "continuous"
const StrategyRollingUpdate = "rollingUpdate"
Variables ¶
This section is empty.
Functions ¶
func CreateDashboardURL ¶
func CreateDashboardURL(serviceName string, jobmap *map[string]JobInfoM, healthresponse ApplicationHealthAnalyzeResponse) string
func ForemastQuery ¶
create the initial request to be sent to foremast
func GenerateReport ¶
func GenerateReport(serviceName string, info JobInfoM, currentYear *int, currentMonth *time.Month, currentDay *int) string
generate the anomaly counts for a single service
func GenerateSummaryReport ¶
func GenerateSummaryReport(serviceslist map[string]JobInfoM, currentYear *int, currentMonth *time.Month, currentDay *int)
generate the anomaly counts for all services func GenerateSummaryReport(serviceslist []string, currentYear *int, currentMonth *time.Month, currentDay *int) {
func MonitorService ¶
func MonitorService(serviceName string, mutex *sync.Mutex, anomalyfilename *string, jobmap *map[string]JobInfoM, currentYear *int, currentMonth *time.Month, currentDay *int)
continuously monitors a service by polling
func QueryWavefrontAnomalyCount ¶
func QueryWavefrontAnomalyCount(serviceName string, query string, metricName string, unixtime int64, currentYear *int, currentMonth *time.Month, currentDay *int) float64
QueryWavefrontAnomalyCount - run query for servicename at unix time to get anomaly count from WAVEFRONT returns value of anomaly count
func StartAnalyzing ¶
func StartAnalyzing(analyzingRequest ApplicationHealthAnalyzeRequest) (string, error)
StartAnalyzing - send the request to the foremast service to start the job
Types ¶
type AnomalousMetric ¶
type AnomalousMetric struct { Name string `json:"name"` Tags string `json:"tags,omitempty"` Values []AnomalousMetricValue `json:"values"` }
type AnomalousMetricValue ¶
type Anomaly ¶
type Anomaly struct {
AnomalousMetrics []AnomalousMetric `json:"anomalousMetrics,omitempty"`
}
Anomaly detected
type AnomalyInfo ¶
type ApplicationHealthAnalyzeRequest ¶
type ApplicationHealthAnalyzeRequest struct { AppName string `json:"appName"` //RFC3339 = "2006-01-02T15:04:05Z07:00" StartTime string `json:"startTime"` //RFC3339 = "2006-01-02T15:04:05Z07:00" EndTime string `json:"endTime"` //// key: current, baseline, historical Metrics MetricsInfo `json:"metrics"` // canary or blue-green Strategy string `json:"strategy"` }
type ApplicationHealthAnalyzeResponse ¶
type ApplicationHealthAnalyzeResponse struct { StatusCode int32 `json:"statusCode"` Reason string `json:"reason,omitempty"` JobId string `json:"jobId"` Status string `json:"status"` Anomaly map[string]AnomalyInfo `json:"anomaly,omitempty"` }
func CheckJobStatus ¶
func CheckJobStatus(jobID string, serviceName string) ApplicationHealthAnalyzeResponse
CheckJobStatus - query the foremast service for the job status
type Client ¶
type ContactData ¶
type ContactData struct { // Name is the descriptive name. Name string `json:"name,omitempty"` // Url could typically be a website address. Url string `json:"url,omitempty"` // Email is the email address. Email string `json:"email,omitempty"` }
ContactData contains information about an individual or organization.
type DeploymentMetadata ¶
type DeploymentMetadata struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec DeploymentMetadataSpec `json:"spec"` // The status object for the Application. Status DeploymentMetadataStatus `json:"status,omitempty"` }
DeploymentMetadata describes a DeploymentMetadata.
type DeploymentMetadataList ¶
type DeploymentMetadataList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` Items []DeploymentMetadata `json:"items"` }
DeploymentMetadataList is a list of DeploymentMetadata resources
type DeploymentMetadataSpec ¶
type DeploymentMetadataSpec struct { Analyst Analyst `json:"analyst"` // Description is human readable content explaining the purpose of the link. Description string `json:"description,omitempty"` // Metrics metadata Metrics Metrics `json:"metrics"` // Logs should be monitored by canary deployment Logs []Logs `json:"logs,omitempty"` // Descriptor regroups information and metadata about an application. Descriptor Descriptor `json:"descriptor,omitempty"` }
DeploymentMetadataSpec is the spec for a DeploymentMetadata resource
type DeploymentMetadataStatus ¶
type DeploymentMetadataStatus struct { // ObservedGeneration is used by the DeploymentMetadata Controller to report the last Generation of a DeploymentMetadata // that it has observed. ObservedGeneration int64 `json:"observedGeneration,omitempty"` }
DeploymentMetadataStatus defines controllers the observed state of DeploymentMetadata
type DeploymentMonitor ¶
type DeploymentMonitor struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec DeploymentMonitorSpec `json:"spec"` // The status object for the Application. Status DeploymentMonitorStatus `json:"status,omitempty"` }
DeploymentMonitor describes a DeploymentMonitor information.
type DeploymentMonitorList ¶
type DeploymentMonitorList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` Items []DeploymentMonitor `json:"items"` }
DeploymentMonitorList is a list of DeploymentMonitor resources
type DeploymentMonitorSpec ¶
type DeploymentMonitorSpec struct { // Selector is a label query over kinds that created by the application. It must match the component objects' labels. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors Selector *metav1.LabelSelector `json:"selector,omitempty"` Analyst Analyst `json:"analyst,omitempty"` StartTime string `json:"startTime,omitempty"` WaitUntil string `json:"waitUntil,omitempty"` // Metrics metadata Metrics Metrics `json:"metrics,omitempty"` // Logs should be monitored by canary deployment Logs []Logs `json:"logs,omitempty"` // Continuous monitoring or not Continuous bool `json:"continuous,omitempty"` // Remediation action Remediation RemediationAction `json:"remediation,omitempty"` // Rollback revision RollbackRevision int64 `json:"rollbackRevision,omitempty"` }
type DeploymentMonitorStatus ¶
type DeploymentMonitorStatus struct { // ObservedGeneration is used by the DeploymentMetadata Controller to report the last Generation of a DeploymentMetadata // that it has observed. ObservedGeneration int64 `json:"observedGeneration,omitempty"` JobId string `json:"jobId,omitempty"` Phase string `json:"phase"` RemediationTaken bool `json:"remediationTaken"` Anomaly Anomaly `json:"anomaly,omitempty"` Timestamp string `json:"timestamp"` Expired bool `json:"expired"` }
DeploymentMonitorStatus defines controllers the observed state of DeploymentMonitor
type Descriptor ¶
type Descriptor struct { // Type is the type of the application (e.g. SpringBoot, NodeJS, Python). Type string `json:"type,omitempty"` // Version is an optional version indicator for the Application. Version string `json:"version,omitempty"` // Description is a brief string description of the Application. Description string `json:"description,omitempty"` // Icons is an optional list of icons for an application. Icon information includes the source, size, // and mime type. Icons []ImageSpec `json:"icons,omitempty"` // Maintainers is an optional list of maintainers of the application. The maintainers in this list maintain the // the source code, images, and package for the application. Maintainers []ContactData `json:"maintainers,omitempty"` // Owners is an optional list of the owners of the installed application. The owners of the application should be // contacted in the event of a planned or unplanned disruption affecting the application. Owners []ContactData `json:"owners,omitempty"` // Keywords is an optional list of key words associated with the application (e.g. MySQL, RDBMS, database). Keywords []string `json:"keywords,omitempty"` // Links are a list of descriptive URLs intended to be used to surface additional documentation, dashboards, etc. Links []Link `json:"links,omitempty"` // Notes contain a human readable snippets intended as a quick start for the users of the Application. // CommonMark markdown syntax may be used for rich text representation. Notes string `json:"notes,omitempty"` }
The following descriptor https://github.com/kubernetes-sigs/application/blob/master/pkg/apis/app/v1beta1/application_types.go Descriptor defines the Metadata and information about the DeploymentMetadata.
type ImageSpec ¶
type ImageSpec struct { // The source for image represented as either an absolute URL to the image or a Data URL containing // the image. Data URLs are defined in RFC 2397. Source string `json:"src"` // (optional) The size of the image in pixels (e.g., 25x25). Size string `json:"size,omitempty"` // (optional) The mine type of the image (e.g., "image/png"). Type string `json:"type,omitempty"` }
ImageSpec contains information about an image used as an icon.
type JobInfo ¶
type JobInfo struct { JobID string ErrorQuery string LatencyQuery string TPSQuery string Request ApplicationHealthAnalyzeRequest }
type JobInfoM ¶
type JobInfoM struct { JobID string MetricMap map[string]string Request ApplicationHealthAnalyzeRequest }
type JobRequest ¶
type Link ¶
type Link struct { // Description is human readable content explaining the purpose of the link. Description string `json:"description,omitempty"` // Url typically points at a website address. Url string `json:"url,omitempty"` }
Link contains information about an URL to surface documentation, dashboards, etc.
type MetricQuery ¶
type Metrics ¶
type Metrics struct { // prometheus or other metrics solution DataSourceType string `json:"dataSourceType"` // Endpoint of prometheus Endpoint string `json:"endpoint"` // Monitoring contains the metrics should be monitored by canary deployment Monitoring []Monitoring `json:"monitoring,omitempty"` }
Metrics metadata
type MetricsInfo ¶
type MetricsInfo struct { Current map[string]MetricQuery `json:"current"` Baseline map[string]MetricQuery `json:"baseline,omitempty"` Historical map[string]MetricQuery `json:"historical,omitempty"` }
type Monitoring ¶
type RemediationAction ¶
type RemediationAction struct { Option string `json:"option"` Parameters map[string]string `json:"parameters,omitempty"` }
Option could be RemediationNone, RemediationAutoRollback, RemediationAutoPause, RemediationAutoScaling, RemediationAuto