Skip to content

Commit

Permalink
Fix: increase max target length
Browse files Browse the repository at this point in the history
Both Prometheus and Loki have relatiely large values for the maximum
length of label values (2048). We limit the legth of the labels we apply
to metrics and logs mostly to keep the UI usable. Allow for longer
target values, because this is actually in use.

Signed-off-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>
  • Loading branch information
mem committed Feb 6, 2024
1 parent 23cbe73 commit 8338926
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions pkg/pb/synthetic_monitoring/checks_extra.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,16 @@ const (
)

const (
MaxMetricLabels = 20 // Prometheus allows for 32 labels, but limit to 20.
MaxLogLabels = 15 // Loki allows a maximum of 15 labels.
MaxCheckLabels = 10 // Allow 10 user labels for checks,
MaxProbeLabels = 3 // 3 for probes, leaving 7 for internal use.
MaxLabelValueLength = 128 // Keep this number low so that the UI remains usable.
MaxPingPackets = 10 // Allow 10 packets per ping.
MaxMultiHttpTargets = 10 // Max targets per multi-http check.
MaxMultiHttpAssertions = 5 // Max assertions per multi-http target.
MaxMultiHttpVariables = 5 // Max variables per multi-http target.
MaxMetricLabels = 20 // Prometheus allows for 32 labels, but limit to 20.
MaxLogLabels = 15 // Loki allows a maximum of 15 labels.
MaxCheckLabels = 10 // Allow 10 user labels for checks,
MaxProbeLabels = 3 // 3 for probes, leaving 7 for internal use.
maxValidLabelValueLength = 2048 // This is the actual max label value length.
MaxLabelValueLength = 128 // Keep this number low so that the UI remains usable.
MaxPingPackets = 10 // Allow 10 packets per ping.
MaxMultiHttpTargets = 10 // Max targets per multi-http check.
MaxMultiHttpAssertions = 5 // Max assertions per multi-http target.
MaxMultiHttpVariables = 5 // Max variables per multi-http target.
)

type validatable interface {
Expand Down Expand Up @@ -265,7 +266,7 @@ func (c Check) Validate() error {

func (c Check) validateTarget() error {
// All targets must be valid label values.
if err := validateLabelValue(c.Target); err != nil {
if len(c.Target) > maxValidLabelValueLength {
return ErrInvalidTargetValue
}

Expand Down

0 comments on commit 8338926

Please sign in to comment.