Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line Chart Widget #67

Merged
merged 3 commits into from
Dec 11, 2024
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
11 changes: 6 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
78 changes: 78 additions & 0 deletions exthttpcheck/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 7 additions & 6 deletions exthttpcheck/fixAmount.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,20 @@ 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)",
Description: "Calls an http endpoint a specified number of times and checks the response",
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
Expand Down
12 changes: 6 additions & 6 deletions exthttpcheck/periodically.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ 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)",
Description: "Calls a http endpoint periodically (requests / s) and checks the response",
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
Expand Down
Loading