diff --git a/config/config.go b/config/config.go index 5021863..036787d 100644 --- a/config/config.go +++ b/config/config.go @@ -13,11 +13,12 @@ import ( // through environment variables. Learn more through the documentation of the envconfig package. // https://github.com/kelseyhightower/envconfig type Specification struct { - KubernetesClusterName string `json:"kubernetesClusterName" split_words:"true" required:"false"` - KubernetesNodeName string `json:"kubernetesNodeName" split_words:"true" required:"false"` - KubernetesPodName string `json:"kubernetesPodName" split_words:"true" required:"false"` - KubernetesNamespace string `json:"kubernetesNamespace" split_words:"true" required:"false"` - EnableLocationSelection bool `json:"enableLocationSelection" split_words:"true" required:"false"` + KubernetesClusterName string `json:"kubernetesClusterName" split_words:"true" required:"false"` + KubernetesNodeName string `json:"kubernetesNodeName" split_words:"true" required:"false"` + KubernetesPodName string `json:"kubernetesPodName" split_words:"true" required:"false"` + KubernetesNamespace string `json:"kubernetesNamespace" split_words:"true" required:"false"` + EnableLocationSelection bool `json:"enableLocationSelection" split_words:"true" required:"false"` + EnableWidgetBackwardCompatibility bool `json:"enableWidgetBackwardCompatibility" split_words:"true" required:"false" default:"true"` } var ( diff --git a/exthttpcheck/common.go b/exthttpcheck/common.go index 5f75738..be34ad1 100644 --- a/exthttpcheck/common.go +++ b/exthttpcheck/common.go @@ -222,6 +222,84 @@ var ( Advanced: extutil.Ptr(true), Order: extutil.Ptr(22), } + widgetsBackwardCompatiblity = extutil.Ptr([]action_kit_api.Widget{ + action_kit_api.PredefinedWidget{ + Type: action_kit_api.ComSteadybitWidgetPredefined, + PredefinedWidgetId: "com.steadybit.widget.predefined.HttpCheck", + }, + }) + widgets = extutil.Ptr([]action_kit_api.Widget{ + action_kit_api.LineChartWidget{ + Type: action_kit_api.ComSteadybitWidgetLineChart, + Title: "HTTP Responses", + Identity: action_kit_api.LineChartWidgetIdentityConfig{ + MetricName: "response_time", + From: "url", + Mode: action_kit_api.ComSteadybitWidgetLineChartIdentityModeWidgetPerValue, + }, + Grouping: extutil.Ptr(action_kit_api.LineChartWidgetGroupingConfig{ + ShowSummary: extutil.Ptr(true), + Groups: []action_kit_api.LineChartWidgetGroup{ + { + Title: "Successul", + Color: "success", + Matcher: action_kit_api.LineChartWidgetGroupMatcherFallback{ + Type: action_kit_api.ComSteadybitWidgetLineChartGroupMatcherFallback, + }, + }, + { + Title: "Failure", + Color: "danger", + Matcher: action_kit_api.LineChartWidgetGroupMatcherNotEmpty{ + Type: action_kit_api.ComSteadybitWidgetLineChartGroupMatcherNotEmpty, + Key: "error", + }, + }, + { + Title: "Unexpected Status", + Color: "warn", + Matcher: action_kit_api.LineChartWidgetGroupMatcherKeyEqualsValue{ + Type: action_kit_api.ComSteadybitWidgetLineChartGroupMatcherKeyEqualsValue, + Key: "expected_http_status", + Value: "false", + }, + }, + { + Title: "Body Constraint Violated", + Color: "warn", + Matcher: action_kit_api.LineChartWidgetGroupMatcherKeyEqualsValue{ + Type: action_kit_api.ComSteadybitWidgetLineChartGroupMatcherKeyEqualsValue, + Key: "response_constraints_fulfilled", + Value: "false", + }, + }, + { + Title: "Response Time Constraint Violated", + Color: "warn", + Matcher: action_kit_api.LineChartWidgetGroupMatcherKeyEqualsValue{ + Type: action_kit_api.ComSteadybitWidgetLineChartGroupMatcherKeyEqualsValue, + Key: "response_time_constraints_fulfilled", + Value: "false", + }, + }, + }, + }), + Tooltip: extutil.Ptr(action_kit_api.LineChartWidgetTooltipConfig{ + MetricValueTitle: extutil.Ptr("Response Time"), + MetricValueUnit: extutil.Ptr("ms"), + AdditionalContent: []action_kit_api.LineChartWidgetTooltipContent{ + { + From: "error", + Title: "Error", + }, + { + From: "http_status", + Title: "HTTP Status", + }, + }, + }), + }, + }) ) func separator(order int) action_kit_api.ActionParameter { diff --git a/exthttpcheck/fixAmount.go b/exthttpcheck/fixAmount.go index d2dfc1b..14c9600 100644 --- a/exthttpcheck/fixAmount.go +++ b/exthttpcheck/fixAmount.go @@ -36,6 +36,12 @@ func (l *httpCheckActionFixedAmount) NewEmptyState() HTTPCheckState { // Describe returns the action description for the platform with all required information. func (l *httpCheckActionFixedAmount) Describe() action_kit_api.ActionDescription { + + widgetToUse := widgets + if config.Config.EnableWidgetBackwardCompatibility { + widgetToUse = widgetsBackwardCompatiblity + } + description := action_kit_api.ActionDescription{ Id: ActionIDFixedAmount, Label: "HTTP (# of Requests)", @@ -43,12 +49,7 @@ func (l *httpCheckActionFixedAmount) Describe() action_kit_api.ActionDescription Version: extbuild.GetSemverVersionStringOrUnknown(), Icon: extutil.Ptr(actionIconFixedAmount), TargetSelection: targetSelection, - Widgets: extutil.Ptr([]action_kit_api.Widget{ - action_kit_api.PredefinedWidget{ - Type: action_kit_api.ComSteadybitWidgetPredefined, - PredefinedWidgetId: "com.steadybit.widget.predefined.HttpCheck", - }, - }), + Widgets: widgetToUse, Technology: extutil.Ptr("HTTP"), Category: extutil.Ptr("HTTP"), //Can be removed in Q1/24 - support for backward compatibility of old sidebar diff --git a/exthttpcheck/periodically.go b/exthttpcheck/periodically.go index eb80a9e..c8ac2d1 100644 --- a/exthttpcheck/periodically.go +++ b/exthttpcheck/periodically.go @@ -35,6 +35,11 @@ func (l *httpCheckActionPeriodically) NewEmptyState() HTTPCheckState { // Describe returns the action description for the platform with all required information. func (l *httpCheckActionPeriodically) Describe() action_kit_api.ActionDescription { + widgetToUse := widgets + if config.Config.EnableWidgetBackwardCompatibility { + widgetToUse = widgetsBackwardCompatiblity + } + description := action_kit_api.ActionDescription{ Id: ActionIDPeriodically, Label: "HTTP (Requests / s)", @@ -42,12 +47,7 @@ func (l *httpCheckActionPeriodically) Describe() action_kit_api.ActionDescriptio Version: extbuild.GetSemverVersionStringOrUnknown(), Icon: extutil.Ptr(actionIconPeriodically), TargetSelection: targetSelection, - Widgets: extutil.Ptr([]action_kit_api.Widget{ - action_kit_api.PredefinedWidget{ - Type: action_kit_api.ComSteadybitWidgetPredefined, - PredefinedWidgetId: "com.steadybit.widget.predefined.HttpCheck", - }, - }), + Widgets: widgetToUse, Technology: extutil.Ptr("HTTP"), Category: extutil.Ptr("HTTP"), //Can be removed in Q1/24 - support for backward compatibility of old sidebar