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

chore: make infoLabels optional #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## [Unreleased]

## [v0.13.2] - 2024-10-31

- Set infoLabels to optional
- Ran `make gen`

## [v0.13.1] - 2024-10-31

- Update Mockery from 2.14.0 to 2.46.3
Expand Down Expand Up @@ -188,7 +193,9 @@
- Support raw query based SLI.
- Kubernetes (prometheus-operator) CRD generation support.

[unreleased]: https://github.com/linode-obs/sloth/compare/v0.13.0...HEAD
[unreleased]: https://github.com/linode-obs/sloth/compare/v0.13.2...HEAD
[v0.13.2]: https://github.com/slok/sloth/compare/v0.13.1...v0.13.2
[v0.13.1]: https://github.com/slok/sloth/compare/v0.13.0...v0.13.1
[v0.13.0]: https://github.com/slok/sloth/compare/v0.12.0...v0.13.0
[v0.12.0]: https://github.com/slok/sloth/compare/v0.11.0...v0.12.0
[v0.11.0]: https://github.com/slok/sloth/compare/v0.10.0...v0.11.0
Expand Down
13 changes: 7 additions & 6 deletions deploy/kubernetes/raw/sloth-with-common-plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: sloth
namespace: monitoring
labels:
helm.sh/chart: sloth-0.6.4
helm.sh/chart: sloth-0.8.2
app.kubernetes.io/managed-by: Helm
app: sloth
app.kubernetes.io/name: sloth
Expand All @@ -18,7 +18,7 @@ kind: ClusterRole
metadata:
name: sloth
labels:
helm.sh/chart: sloth-0.6.4
helm.sh/chart: sloth-0.8.2
app.kubernetes.io/managed-by: Helm
app: sloth
app.kubernetes.io/name: sloth
Expand All @@ -38,7 +38,7 @@ kind: ClusterRoleBinding
metadata:
name: sloth
labels:
helm.sh/chart: sloth-0.6.4
helm.sh/chart: sloth-0.8.2
app.kubernetes.io/managed-by: Helm
app: sloth
app.kubernetes.io/name: sloth
Expand All @@ -59,7 +59,7 @@ metadata:
name: sloth
namespace: monitoring
labels:
helm.sh/chart: sloth-0.6.4
helm.sh/chart: sloth-0.8.2
app.kubernetes.io/managed-by: Helm
app: sloth
app.kubernetes.io/name: sloth
Expand All @@ -74,7 +74,7 @@ spec:
template:
metadata:
labels:
helm.sh/chart: sloth-0.6.4
helm.sh/chart: sloth-0.8.2
app.kubernetes.io/managed-by: Helm
app: sloth
app.kubernetes.io/name: sloth
Expand All @@ -89,6 +89,7 @@ spec:
args:
- kubernetes-controller
- --sli-plugins-path=/plugins
- --logger=default
ports:
- containerPort: 8081
name: metrics
Expand Down Expand Up @@ -132,7 +133,7 @@ metadata:
name: sloth
namespace: monitoring
labels:
helm.sh/chart: sloth-0.6.4
helm.sh/chart: sloth-0.8.2
app.kubernetes.io/managed-by: Helm
app: sloth
app.kubernetes.io/name: sloth
Expand Down
13 changes: 7 additions & 6 deletions deploy/kubernetes/raw/sloth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: sloth
namespace: monitoring
labels:
helm.sh/chart: sloth-0.6.4
helm.sh/chart: sloth-0.8.2
app.kubernetes.io/managed-by: Helm
app: sloth
app.kubernetes.io/name: sloth
Expand All @@ -18,7 +18,7 @@ kind: ClusterRole
metadata:
name: sloth
labels:
helm.sh/chart: sloth-0.6.4
helm.sh/chart: sloth-0.8.2
app.kubernetes.io/managed-by: Helm
app: sloth
app.kubernetes.io/name: sloth
Expand All @@ -38,7 +38,7 @@ kind: ClusterRoleBinding
metadata:
name: sloth
labels:
helm.sh/chart: sloth-0.6.4
helm.sh/chart: sloth-0.8.2
app.kubernetes.io/managed-by: Helm
app: sloth
app.kubernetes.io/name: sloth
Expand All @@ -59,7 +59,7 @@ metadata:
name: sloth
namespace: monitoring
labels:
helm.sh/chart: sloth-0.6.4
helm.sh/chart: sloth-0.8.2
app.kubernetes.io/managed-by: Helm
app: sloth
app.kubernetes.io/name: sloth
Expand All @@ -74,7 +74,7 @@ spec:
template:
metadata:
labels:
helm.sh/chart: sloth-0.6.4
helm.sh/chart: sloth-0.8.2
app.kubernetes.io/managed-by: Helm
app: sloth
app.kubernetes.io/name: sloth
Expand All @@ -88,6 +88,7 @@ spec:
image: ghcr.io/linode-obs/sloth:v0.13.1
args:
- kubernetes-controller
- --logger=default
ports:
- containerPort: 8081
name: metrics
Expand All @@ -107,7 +108,7 @@ metadata:
name: sloth
namespace: monitoring
labels:
helm.sh/chart: sloth-0.6.4
helm.sh/chart: sloth-0.8.2
app.kubernetes.io/managed-by: Helm
app: sloth
app.kubernetes.io/name: sloth
Expand Down
2 changes: 1 addition & 1 deletion internal/prometheus/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type SLO struct {
Labels map[string]string `validate:"dive,keys,prom_label_key,endkeys,required,prom_label_value"`
PageAlertMeta AlertMeta
TicketAlertMeta AlertMeta
InfoLabels map[string]string `validate:"dive,keys,prom_label_key,endkeys,required,prom_label_value"`
InfoLabels map[string]string `validate:"dive,keys,prom_label_key,endkeys,prom_label_value"`
}

type SLOGroup struct {
Expand Down
19 changes: 10 additions & 9 deletions pkg/kubernetes/api/sloth/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func VersionKind(kind string) schema.GroupVersionKind

VersionKind takes an unqualified kind and returns back a Group qualified GroupVersionKind.

## type [Alert](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L159-L172>)
## type [Alert](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L160-L173>)

Alert configures specific SLO alert.

Expand Down Expand Up @@ -127,7 +127,7 @@ func (in *Alert) DeepCopyInto(out *Alert)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil.

## type [Alerting](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L137-L156>)
## type [Alerting](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L138-L157>)

Alerting wraps all the configuration required by the SLO alerts.

Expand Down Expand Up @@ -210,7 +210,7 @@ func (in *PrometheusServiceLevel) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

## type [PrometheusServiceLevelList](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L193-L198>)
## type [PrometheusServiceLevelList](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L194-L199>)

\+k8s:deepcopy\-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

Expand Down Expand Up @@ -287,7 +287,7 @@ func (in *PrometheusServiceLevelSpec) DeepCopyInto(out *PrometheusServiceLevelSp

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil.

## type [PrometheusServiceLevelStatus](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L174-L188>)
## type [PrometheusServiceLevelStatus](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L175-L189>)

```go
type PrometheusServiceLevelStatus struct {
Expand Down Expand Up @@ -323,7 +323,7 @@ func (in *PrometheusServiceLevelStatus) DeepCopyInto(out *PrometheusServiceLevel

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil.

## type [SLI](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L91-L103>)
## type [SLI](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L92-L104>)

SLI will tell what is good or bad for the SLO. All SLIs will be get based on time windows, that's why Sloth needs the queries to use \`\{\{.window\}\}\` template variable.

Expand Down Expand Up @@ -361,7 +361,7 @@ func (in *SLI) DeepCopyInto(out *SLI)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil.

## type [SLIEvents](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L114-L124>)
## type [SLIEvents](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L115-L125>)

SLIEvents is an SLI that is calculated as the division of bad events and total events, giving a ratio SLI. Normally this is the most common ratio type.

Expand Down Expand Up @@ -395,7 +395,7 @@ func (in *SLIEvents) DeepCopyInto(out *SLIEvents)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil.

## type [SLIPlugin](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L127-L134>)
## type [SLIPlugin](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L128-L135>)

SLIPlugin will use the SLI returned by the SLI plugin selected along with the options.

Expand Down Expand Up @@ -426,7 +426,7 @@ func (in *SLIPlugin) DeepCopyInto(out *SLIPlugin)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil.

## type [SLIRaw](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L107-L110>)
## type [SLIRaw](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L108-L111>)

SLIRaw is a error ratio SLI already calculated. Normally this will be used when the SLI is already calculated by other recording rule, system...

Expand All @@ -453,7 +453,7 @@ func (in *SLIRaw) DeepCopyInto(out *SLIRaw)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil.

## type [SLO](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L49-L84>)
## type [SLO](<https://github.com/linode-obs/sloth/blob/main/pkg/kubernetes/api/sloth/v1/types.go#L49-L85>)

SLO is the configuration/declaration of the service level objective of a service.

Expand Down Expand Up @@ -481,6 +481,7 @@ type SLO struct {
Labels map[string]string `json:"labels,omitempty"`

// Info labels added to the `sloth_slo_info` metric
// +optional
InfoLabels map[string]string `json:"infoLabels,omitempty"`

// +kubebuilder:validation:Required
Expand Down
1 change: 1 addition & 0 deletions pkg/kubernetes/api/sloth/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ type SLO struct {
Labels map[string]string `json:"labels,omitempty"`

// Info labels added to the `sloth_slo_info` metric
// +optional
InfoLabels map[string]string `json:"infoLabels,omitempty"`

// +kubebuilder:validation:Required
Expand Down
Loading