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

No way to use Docker recommended naming in labels #2455

Closed
RaitoBezarius opened this issue Jul 30, 2020 · 2 comments · Fixed by #2459
Closed

No way to use Docker recommended naming in labels #2455

RaitoBezarius opened this issue Jul 30, 2020 · 2 comments · Fixed by #2459
Labels
keepalive An issue or PR that will be kept alive and never marked as stale.

Comments

@RaitoBezarius
Copy link
Contributor

Describe the bug
Docker actually recommends labels to have a com.xxx.yyy.zzz naming which clashes with the label regex being in use in Loki/Prometheus, which makes it in turn impossible to get those labels in Loki.

To Reproduce
Steps to reproduce the behavior:

  1. Started Loki (any)
  2. Use Docker logging driver
  3. Use the log opt: labels: "com.xxx.yyy.zzz" in daemon.json

Expected behavior
There should be a way to prepare for those, as they're… technically the Docker recommendation. I'd expect that relabelling can be done before validation of the labels name, which, according to the current code, is not the case.

Environment:

  • Infrastructure: laptop
  • Deployment tool: Dokku (which labels with com.dokku.app-name for example).
@stale
Copy link

stale bot commented Aug 29, 2020

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale A stale issue or PR that will automatically be closed. label Aug 29, 2020
@stale stale bot closed this as completed Sep 5, 2020
@cyriltovena cyriltovena added the keepalive An issue or PR that will be kept alive and never marked as stale. label Sep 17, 2020
@cyriltovena cyriltovena reopened this Sep 17, 2020
@cyriltovena cyriltovena removed the stale A stale issue or PR that will automatically be closed. label Sep 17, 2020
@cyriltovena
Copy link
Contributor

cyriltovena commented Sep 17, 2020

Hey @RaitoBezarius ,

Sorry for the late reply I was off, just to be clear, the problem is that com.xxx.yyy.zzz is not a valid label as per this prometheus label code ?

// IsValid is true iff the label name matches the pattern of LabelNameRE. This
// method, however, does not use LabelNameRE for the check but a much faster
// hardcoded implementation.
func (ln LabelName) IsValid() bool {
	if len(ln) == 0 {
		return false
	}
	for i, b := range ln {
		if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || (b >= '0' && b <= '9' && i > 0)) {
			return false
		}
	}
	return true
}

And so when you want to use those . notation label it just error out to you ? In this case I'm all good for that PR.

EDIT: yeah that seems to be the case !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keepalive An issue or PR that will be kept alive and never marked as stale.
Projects
None yet
2 participants