Skip to content

Conversation

0xTim
Copy link
Member

@0xTim 0xTim commented Jun 17, 2022

Sanitize dimensions to avoid scraping from breaking. Resolves #65 and #38

Checklist

  • The provided tests still run.
  • I've created new tests where needed.
  • I've updated the documentation if necessary.

Motivation and Context

If dimensions aren't sanitized then Prometheus breaks with errors like

error while linting: text format parsing error in line 9: expected '=' after label name, found '-'

Description

Run dimensions through a sanitizer. Uses a new DimensionsSanitizer as uppercase ASCII is allowed. (It looks like regular labels should allow uppercase as well but I didn't want to change that).

Also split out sanitiser types into their own files

@0xTim 0xTim requested review from MrLotU and ktoso June 17, 2022 12:41
@MrLotU MrLotU changed the base branch from master to release_1 June 17, 2022 13:53
Copy link
Collaborator

@MrLotU MrLotU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@MrLotU MrLotU merged commit e3f3833 into release_1 Jun 17, 2022
@MrLotU MrLotU deleted the dimension-sanitisation branch June 17, 2022 13:53
MrLotU added a commit that referenced this pull request Jun 20, 2022
* Sanitize Dimensions (#68)

* Add failing test for sanitising dimension

* Fix test

* Add new DimensionsSanitizer

* Remove labels parametrisation (#63)

* Stop leaking 'le', 'quantile' in Summary/Histogram labels, remove labels parametrisation

* chore: Remove base labels protocol and add ExpressibleByArrayLiteral

* chore: Cleanup documentation. Remove deprecations

Co-authored-by: Jari (LotU) <[email protected]>

* Add async/await APIs (#67)

* Add async/await APIs

* Revert unrelated change

* Add #if swift for 5.2

* Fix Swift version number check

* Add task API

Co-authored-by: Tim Condon <[email protected]>
Co-authored-by: Anton <[email protected]>
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

Successfully merging this pull request may close these issues.

Add dimension name sanitizer

2 participants