Skip to content

Commit

Permalink
forbid fawmetric for honeycomb
Browse files Browse the repository at this point in the history
  • Loading branch information
nikodemrafalski committed Jan 23, 2025
1 parent 9971a68 commit 6fc6aed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions manifest/v1alpha/slo/metrics_honeycomb.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ var honeycombSingleQueryValidation = govy.New[HoneycombMetric](
rules.StringMaxLength(255),
rules.StringNotEmpty()),
)

var honeycombRawMetricValidation = govy.New[MetricSpec](
govy.For(func(m MetricSpec) *HoneycombMetric { return m.Honeycomb }).
WithName("honeycomb").
Rules(rules.Forbidden[*HoneycombMetric]()),
)
4 changes: 2 additions & 2 deletions manifest/v1alpha/slo/metrics_honeycomb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ func TestHoneycomb_singleQuery(t *testing.T) {
})
}

func TestHoneycomb_rawMetrics(t *testing.T) {
func TestHoneycomb_rawMetrics_forbidded(t *testing.T) {
slo := validRawMetricSLO(v1alpha.Honeycomb)
err := validate(slo)
testutils.AssertContainsErrors(t, slo, err, 1, testutils.ExpectedError{
Prop: "spec.objectives[0].rawMetric",
Prop: "spec.objectives[0].rawMetric.query.honeycomb",
Code: rules.ErrorCodeForbidden,
})
}
Expand Down
4 changes: 3 additions & 1 deletion manifest/v1alpha/slo/metrics_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ var RawMetricsValidation = govy.New[RawMetricSpec](
lightstepRawMetricValidation,
pingdomRawMetricValidation,
thousandEyesRawMetricValidation,
instanaRawMetricValidation),
instanaRawMetricValidation,
honeycombRawMetricValidation,
),
)

var countMetricsValidation = govy.New[MetricSpec](
Expand Down

0 comments on commit 6fc6aed

Please sign in to comment.