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

Thanos Query truncate ExtLabels does not support unicode #6266

Closed
mickeyzzc opened this issue Apr 10, 2023 · 2 comments
Closed

Thanos Query truncate ExtLabels does not support unicode #6266

mickeyzzc opened this issue Apr 10, 2023 · 2 comments

Comments

@mickeyzzc
Copy link
Contributor

I came across a scenario where the upstream of the thanos query had a long label and mixed with Unicode.

When cutting, it just cuts to Unicode, causing the entire thanos query to crash.

This is a random patchwork, not necessarily 1000. But where it's cut, it happens to be a Unicode
,It look like:

{cluster="k8s-hw-bj", idc_id="huaweicloud_bj", idc_name="华为云京", prometheus="monitoring/business", prometheus_replica="prometheus-business-0"},{cluster="k8s-hw-bj", idc_id="huaweicloud_bj", idc_name="华为云北京", prometheus="monitoring/istio-telemetry", prometheus_replica="prometheus-istio-telemetry-0"},{cluster="k8s-hw-bj", idc_id="huaweicloud_bj", idc_name="华为云北京", prometheus="monitoring/istio-telemetry", prometheus_replica="prometheus-istio-telemetry-shard-1-0"},{cluster="k8s-hw-bj", idc_id="huaweicloud_bj", idc_name="华为云北京", prometheus="monitoring/istio-telemetry", prometheus_replica="prometheus-istio-telemetry-shard-2-0"},{cluster="k8s-hw-bj", idc_id="huaweicloud_bj", idc_name="华为云北京", prometheus="monitoring/istio-telemetry", prometheus_replica="prometheus-istio-telemetry-shard-3-0"},{cluster="k8s-hw-bj", idc_id="huaweicloud_bj", idc_name="华为云北京", prometheus="monitoring/istio-telemetry", prometheus_replica="prometheus-istio-telemetry-shard-4-0"},{cluster="k8s-hw-bj", idc_id="huaweicloud_bj", idc_name="华为云北`

The problem code is as follows:

// thanos/pkg/query/endpointset.go  :  v0.30 - v0.31
// truncateExtLabels truncates the stringify external labels with the format of {labels..}.
func truncateExtLabels(s string, threshold int) string {
	if len(s) > threshold {
		return fmt.Sprintf("%s}", s[:threshold-1])
	}
	return s
}
@mickeyzzc
Copy link
Contributor Author

truncateExtLabels support Unicode cut #6267

@mickeyzzc
Copy link
Contributor Author

Merged Branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant