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

Error: Invalid label name when using non-ASCII characters in tags #5096

Open
1 task done
candies404 opened this issue Sep 9, 2024 · 1 comment
Open
1 task done
Labels
area:metrics related to monitoring metrics bug Something isn't working releaseblocker blocking bugs encountered with a new release
Milestone

Comments

@candies404
Copy link

πŸ“‘ I have found these related issues/pull requests

No correlation has been found

πŸ›‘οΈ Security Policy

Description

When using non-ASCII characters (such as Chinese) in tag names, the system throws an "Invalid label name" error during Prometheus metrics initialization.

image

πŸ‘Ÿ Reproduction steps

  1. Create a tag with a non-ASCII name (e.g., Chinese characters) in Uptime Kuma
  2. Restart the Uptime Kuma service or trigger Prometheus metrics initialization

πŸ‘€ Expected behavior

The system should handle non-ASCII tag names gracefully, either by converting them to valid Prometheus label names or by using a separate field for Prometheus-compatible names.

πŸ˜“ Actual Behavior

The system crashes with an "Invalid label name" error when initializing Prometheus metrics.

🐻 Uptime-Kuma Version

2.0.0-dev

πŸ’» Operating System and Arch

Ubuntu Linux

🌐 Browser

127.0.6533.120

πŸ–₯️ Deployment Environment

  • Runtime: Docker
  • Database: external mariadb
  • Filesystem used to store the database on: btrfs
  • number of monitors: 5

πŸ“ Relevant log output

Error message:
Trace: Error: Invalid label name
    at new Metric (/app/node_modules/prom-client/lib/metric.js:39:10)
    at new Gauge (/app/node_modules/prom-client/lib/gauge.js:19:1)
    at Prometheus.initMetrics (/app/server/prometheus.js:61:45)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Prometheus.createAndInitMetrics (/app/server/prometheus.js:96:9)
    at async Proxy.start (/app/server/model/monitor.js:349:27)
    at async startMonitors (/app/server/server.js:1805:9)
    at process.unexpectedErrorHandler (/app/server/server.js:1859:13)
    at process.emit (node:events:519:28)
    at emitUnhandledRejection (node:internal/process/promises:250:13)
    at throwUnhandledRejectionsMode (node:internal/process/promises:385:19)
    at processPromiseRejections (node:internal/process/promises:470:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)
@candies404 candies404 added the bug Something isn't working label Sep 9, 2024
@louislam louislam added this to the 2.0.0 milestone Sep 9, 2024
@louislam
Copy link
Owner

louislam commented Sep 9, 2024

Thanks for finding the root cause. I was experiencing this issue last week too. It should be related to this pull request:

#4704 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metrics related to monitoring metrics bug Something isn't working releaseblocker blocking bugs encountered with a new release
Projects
None yet
Development

No branches or pull requests

3 participants