Documentation
¶
Overview ¶
Package report is the package for SLA report
Index ¶
- Variables
- func AutoRefreshJS(time string) string
- func DurationStr(d time.Duration) string
- func FormatTime(t time.Time) string
- func HTMLFooter(time string) string
- func HTMLHeader(title string) string
- func JSONEscape(str string) string
- func LogSend(kind, name, tag, message string, err error)
- func SLACSV(probers []probe.Prober) string
- func SLACSVSection(r *probe.Result) []string
- func SLAHTML(probers []probe.Prober) string
- func SLAHTMLFilter(probers []probe.Prober, filter *SLAFilter) string
- func SLAHTMLSection(r *probe.Result) string
- func SLAJSON(probers []probe.Prober) string
- func SLAJSONSection(r *probe.Result) string
- func SLALark(probers []probe.Prober) string
- func SLALarkSection(r *probe.Result) string
- func SLALog(probers []probe.Prober) string
- func SLALogSection(r *probe.Result) string
- func SLAMarkdown(probers []probe.Prober) string
- func SLAMarkdownSection(r *probe.Result, f Format) string
- func SLAMarkdownSocial(probers []probe.Prober) string
- func SLAShell(probers []probe.Prober) string
- func SLASlack(probers []probe.Prober) string
- func SLASlackSection(r *probe.Result) string
- func SLAStatusText(s probe.Stat, t Format) string
- func SLASummary(probers []probe.Prober) string
- func SLAText(probers []probe.Prober) string
- func SLATextSection(r *probe.Result) string
- func SlackTimeFormation(t time.Time, act string, format string) string
- func ToCSV(r probe.Result) string
- func ToHTML(r probe.Result) string
- func ToJSON(r probe.Result) string
- func ToJSONIndent(r probe.Result) string
- func ToLark(r probe.Result) string
- func ToLog(r probe.Result) string
- func ToMarkdown(r probe.Result) string
- func ToMarkdownSocial(r probe.Result) string
- func ToShell(r probe.Result) string
- func ToSlack(r probe.Result) string
- func ToText(r probe.Result) string
- type Availability
- type Format
- type FormatFuncStruct
- type FormatFuncType
- type LatestProbe
- type SLA
- type SLAFilter
- type StatFormatFuncType
- type Summary
Constants ¶
This section is empty.
Variables ¶
var FormatFuncs = map[Format]FormatFuncStruct{ Unknown: {ToText, SLAText}, Text: {ToText, SLAText}, Log: {ToLog, SLALog}, JSON: {ToJSON, SLAJSON}, Markdown: {ToMarkdown, SLAMarkdown}, MarkdownSocial: {ToMarkdownSocial, SLAMarkdownSocial}, HTML: {ToHTML, SLAHTML}, Slack: {ToSlack, SLASlack}, Lark: {ToLark, SLALark}, SMS: {ToText, SLASummary}, Shell: {ToShell, SLAShell}, }
FormatFuncs is the format function map
Functions ¶
func AutoRefreshJS ¶ added in v1.4.0
AutoRefreshJS return the auto refresh javascript
func DurationStr ¶
DurationStr convert the curation to string
func FormatTime ¶ added in v1.7.0
FormatTime format the time with time zone and time format
func SLACSVSection ¶ added in v1.6.0
SLACSVSection set the CSV format for SLA
func SLAHTMLFilter ¶ added in v1.7.0
SLAHTMLFilter return a stat report with filter
func SLAHTMLSection ¶
SLAHTMLSection return the HTML format string to stat
func SLAJSONSection ¶
SLAJSONSection return the JSON format string to stat
func SLALarkSection ¶
SLALarkSection return the Text format string to stat
func SLALogSection ¶ added in v1.6.0
SLALogSection return the Log format string to stat
func SLAMarkdown ¶
SLAMarkdown return a full stat report with Markdown format
func SLAMarkdownSection ¶
SLAMarkdownSection return the Markdown format string to stat
func SLAMarkdownSocial ¶
SLAMarkdownSocial return a full stat report with social markdown
func SLASlackSection ¶
SLASlackSection return the slack json format string to stat
func SLAStatusText ¶
SLAStatusText return the string of status statices
func SLASummary ¶ added in v1.5.0
SLASummary return a summary stat report
func SLATextSection ¶
SLATextSection return the Text format string to stat
func SlackTimeFormation ¶
SlackTimeFormation return the slack time formation
func ToJSONIndent ¶
ToJSONIndent convert the object to indent JSON
func ToLark ¶
ToLark convert the object to Lark notification Go to https://open.feishu.cn/document/ukTMukTMukTM/ucTM5YjL3ETO24yNxkjN#4996824a to build the notification block
func ToMarkdown ¶
ToMarkdown convert the object to ToMarkdown
func ToMarkdownSocial ¶
ToMarkdownSocial convert the object to Markdown
func ToSlack ¶
ToSlack convert the object to ToSlack notification Go to https://app.slack.com/block-kit-builder to build the notification block
Types ¶
type Availability ¶
type Availability struct { UpTime time.Duration `json:"up"` DownTime time.Duration `json:"down"` SLA float64 `json:"sla"` }
Availability is the Availability JSON structure
type Format ¶
type Format int
Format is the format of text
const ( Unknown Format = iota MarkdownSocial // *text* is bold Markdown // **text** is bold HTML JSON Text Log Slack Discord Lark SMS Shell )
The format types
func (Format) MarshalYAML ¶
MarshalYAML is marshal the format
func (*Format) UnmarshalYAML ¶
UnmarshalYAML is unmarshal the format
type FormatFuncStruct ¶
type FormatFuncStruct struct { ResultFn FormatFuncType StatFn StatFormatFuncType }
FormatFuncStruct is the format function struct
type FormatFuncType ¶
FormatFuncType is the format function
type LatestProbe ¶
type LatestProbe struct { Time time.Time `json:"time"` Status probe.Status `json:"status"` Message string `json:"message"` }
LatestProbe is the LatestProbe JSON structure
type SLA ¶
type SLA struct { Name string `json:"name"` Endpoint string `json:"endpoint"` Availability Availability `json:"sla"` ProbeTimes Summary `json:"probe_summary"` LatestProbe LatestProbe `json:"latest_probe"` }
SLA is the SLA JSON structure
type SLAFilter ¶ added in v1.7.0
type SLAFilter struct { Name string Kind string Endpoint string Status *probe.Status SLAGreater float64 SLALess float64 Message string PageNum int PageSize int // contains filtered or unexported fields }
SLAFilter filter the probers
func NewEmptyFilter ¶ added in v1.7.0
func NewEmptyFilter() *SLAFilter
NewEmptyFilter create a new SLAFilter
type StatFormatFuncType ¶
StatFormatFuncType is the format function for Stat