Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (cfg *Config) ApplyFlags() {
if *listen != "" {
cfg.ListenAddress = *listen
}
cfg.GRPC.Disabled = *grpcDisabled
cfg.GRPC.Disabled = cfg.GRPC.Disabled || *grpcDisabled
if *grpcListen != "" {
cfg.GRPC.ListenAddress = *grpcListen
}
Expand Down
8 changes: 5 additions & 3 deletions front/src/components/PropagationMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ function calcLevel(index, a, level, backLinks) {
export default {
props: {
applications: Array,
categories: Array,
},

components: { AppIcon },
Expand Down Expand Up @@ -230,8 +229,11 @@ export default {
a.x1 = s.left + s.width;
a.y1 = s.top + s.height / 2;
a.x2 = d.left;

a.y2 = d.top + 10 + (hash(u.id) % (d.height - 20));
a.y2 = d.top + d.height / 2;
const upstream = index.get(u.id);
if (upstream && Math.abs(upstream.level - app.level) > 1) {
a.y2 = d.top + 10 + (hash(app.id) % (d.height / 2 - 20));
}

if (a.x1 > a.x2) {
a.x1 = s.left;
Expand Down
6 changes: 3 additions & 3 deletions front/src/utils/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export function durationPretty(ms) {
if (ms > DAY) {
return duration(ms, 'h');
}
if (ms > HOUR) {
return duration(ms, 'm');
}
if (ms > MINUTE) {
return duration(ms, 'm');
}
if (ms > SECOND) {
return duration(ms, 's');
}
return duration(ms, 'ms');
}

Expand Down
20 changes: 11 additions & 9 deletions front/src/views/Incident.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,19 @@

<template v-if="incident.rca.detailed_root_cause_analysis">
<div>
<a @click="toggle_rca_details"
>Show
<template v-if="!show_details">more</template>
<template v-else>less</template>
details

<v-icon v-if="!show_details">mdi-chevron-down</v-icon>
<v-icon v-else>mdi-chevron-up</v-icon>
<a @click="toggle_rca_details">
Show {{ show_details ? 'less' : 'more' }} details
<v-icon v-if="show_details">mdi-chevron-up</v-icon>
<v-icon v-else>mdi-chevron-down</v-icon>
</a>
</div>

<v-card outlined v-if="show_details" class="pa-5 mt-5">
<PropagationMap
v-if="incident.rca.propagation_map"
:applications="incident.rca.propagation_map.applications"
class="mb-5"
/>
<Markdown :src="incident.rca.detailed_root_cause_analysis" :widgets="incident.rca.widgets || []" />
</v-card>
</template>
Expand Down Expand Up @@ -208,9 +209,10 @@ import Widget from '@/components/Widget.vue';
import CheckForm from '@/components/CheckForm.vue';
import AppTraces from '@/views/AppTraces.vue';
import Markdown from '@/components/Markdown.vue';
import PropagationMap from '@/components/PropagationMap.vue';

export default {
components: { Markdown, Views, AppTraces, CheckForm, Widget, NoData },
components: { PropagationMap, Markdown, Views, AppTraces, CheckForm, Widget, NoData },

computed: {
availabilityBurnRate() {
Expand Down
20 changes: 11 additions & 9 deletions front/src/views/RCA.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,19 @@

<template v-if="rca.summary.detailed_root_cause_analysis">
<div>
<a @click="toggle_rca_details"
>Show
<template v-if="!show_details">more</template>
<template v-else>less</template>
details

<v-icon v-if="!show_details">mdi-chevron-down</v-icon>
<v-icon v-else>mdi-chevron-up</v-icon>
<a @click="toggle_rca_details">
Show {{ show_details ? 'less' : 'more' }} details
<v-icon v-if="show_details">mdi-chevron-up</v-icon>
<v-icon v-else>mdi-chevron-down</v-icon>
</a>
</div>

<v-card outlined v-if="show_details" class="pa-5 mt-5">
<PropagationMap
v-if="rca.summary.propagation_map"
:applications="rca.summary.propagation_map.applications"
class="mb-5"
/>
<Markdown :src="rca.summary.detailed_root_cause_analysis" :widgets="rca.summary.widgets || []" />
</v-card>
</template>
Expand Down Expand Up @@ -112,6 +113,7 @@ import { palette } from '@/utils/colors';
import Chart from '@/components/Chart.vue';
import Views from '@/views/Views.vue';
import Markdown from '@/components/Markdown.vue';
import PropagationMap from '@/components/PropagationMap.vue';

export default {
computed: {
Expand Down Expand Up @@ -150,7 +152,7 @@ export default {
noTitle: Boolean,
},

components: { Markdown, Views, Chart },
components: { PropagationMap, Markdown, Views, Chart },

data() {
return {
Expand Down
54 changes: 47 additions & 7 deletions model/application_incident.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package model

import (
"fmt"

"github.com/coroot/coroot/timeseries"
"github.com/coroot/coroot/utils"
)

type Impact struct {
Expand All @@ -16,13 +19,50 @@ type IncidentDetails struct {
}

type RCA struct {
Status string `json:"status"`
Error string `json:"error"`
ShortSummary string `json:"short_summary"`
RootCause string `json:"root_cause"`
ImmediateFixes string `json:"immediate_fixes"`
DetailedRootCause string `json:"detailed_root_cause_analysis"`
Widgets []*Widget `json:"widgets"`
Status string `json:"status"`
Error string `json:"error"`
ShortSummary string `json:"short_summary"`
RootCause string `json:"root_cause"`
ImmediateFixes string `json:"immediate_fixes"`
DetailedRootCause string `json:"detailed_root_cause_analysis"`
PropagationMap *PropagationMap `json:"propagation_map"`
Widgets []*Widget `json:"widgets"`
}

type PropagationMap struct {
Applications []*PropagationMapApplication `json:"applications"`
}

type PropagationMapApplication struct {
Id ApplicationId `json:"id"`
Icon string `json:"icon"`
Labels Labels `json:"labels"`
Status Status `json:"status"`
Issues []string `json:"issues,omitempty"`

Upstreams []*PropagationMapApplicationLink `json:"upstreams"`
Downstreams []*PropagationMapApplicationLink `json:"downstreams"`
}

func (app *PropagationMapApplication) Issue(format string, a ...any) {
issue := fmt.Sprintf(format, a...)
for _, i := range app.Issues {
if i == issue {
return
}
}
app.Issues = append(app.Issues, issue)
}

type PropagationMapApplicationLink struct {
Id ApplicationId `json:"id"`
Status Status `json:"status"`
Stats *utils.StringSet `json:"stats"`
}

func (l *PropagationMapApplicationLink) AddIssues(issues ...string) {
l.Status = CRITICAL
l.Stats.Add(issues...)
}

type ApplicationIncident struct {
Expand Down
9 changes: 9 additions & 0 deletions utils/stringset.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,12 @@ func (ss *StringSet) GetFirst() string {
func (ss *StringSet) MarshalJSON() ([]byte, error) {
return json.Marshal(ss.Items())
}

func (ss *StringSet) UnmarshalJSON(data []byte) error {
var items []string
if err := json.Unmarshal(data, &items); err != nil {
return err
}
ss.Add(items...)
return nil
}