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

only one additional dimension possible? #37

Open
smaldon-bjss opened this issue Apr 22, 2020 · 1 comment
Open

only one additional dimension possible? #37

smaldon-bjss opened this issue Apr 22, 2020 · 1 comment

Comments

@smaldon-bjss
Copy link

An issue that has come up for me is that I want to send metrics to cloudwatch from many different sources for consumption in grafana later. To filter my metrics and construct sensible dashboards I want labels for categories, call "servergroup" and "environment", and within these categories metrics can also come from multiple instances, so I also want a label for "instance_id".

However I found that when I specified multiple -additional_dimension arguments to the program it would only label my metrics with the last argument specified. I looked at the code.

var additionalDimensions = map[string]string{}

var additionalDimensions = map[string]string{}
if *additionalDimension != "" {
	key, val := keyValMustParse(*additionalDimension, "-additionalDimension must be formatted as NAME=VALUE")
	additionalDimensions[key] = val
}

var replaceDims = map[string]string{}
if *replaceDimensions != "" {
	kvs := strings.Split(*replaceDimensions, ",")
	if len(kvs) > 0 {
		for _, rd := range kvs {
			key, val := keyValMustParse(rd, "-replaceDimensions must be formatted as NAME=VALUE,...")
			replaceDims[key] = val
		}
	}
}

It looks like an map was used just like with replaceDimensions yet the actual code seems limited to only ever populating that map with at most a single key-value pair. This seems like a disappointing limitation?

Would there be any drawback to changing additional_dimension to additional_dimensions (or adding additional_dimensions for backwards compatibility) and copying the same pattern for parsing it as is already in use for replace_dimensions? It looks at a glance like the rest of the code is already there.

@smaldon-bjss
Copy link
Author

#38

Something like this?

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