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

Allow to set dimensions for metrics #57

Merged
merged 1 commit into from
Apr 9, 2020
Merged

Conversation

sumo-drosiek
Copy link
Contributor

@sumo-drosiek sumo-drosiek commented Apr 7, 2020

It would be nice to add some dimensions directly from configuration.
custom_dimensions allows to add dimensions in X-Sumo-Dimensions header.

https://help.sumologic.com/03Send-Data/Sources/02Sources-for-Hosted-Collectors/HTTP-Source/Upload-Metrics-to-an-HTTP-Source#supported-http-headers

Copy link
Contributor

@frankreno frankreno left a comment

Choose a reason for hiding this comment

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

LGTM, pending the two pieces of feedback i left.

@@ -37,6 +37,10 @@ def request_headers(source_host, source_category, source_name, data_type, metric
else
raise RuntimeError, "Invalid #{metric_data_format}, must be graphite or carbon2 or prometheus"
end

unless metadata.nil?
headers['X-Sumo-Metadata'] = metadata
Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed on Slack, let's confirm Metadata is the best use, as opposed to dimensions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I change it to dimensions, but regarding another discussion I'm not sure if we want to merge those changes or not

@@ -136,6 +143,10 @@ def configure(conf)
conf['custom_fields'] = nil
end

if conf['custom_metadata'].nil? || conf['custom_metadata'].strip.length == 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we do some validation on the configuration? Testing it is actually a KVP string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added simple validation 👍

@sumo-drosiek
Copy link
Contributor Author

U updated PR description due to changes

@sumo-drosiek sumo-drosiek force-pushed the drosiek-custom-metadata branch from b31d158 to 8a1f307 Compare April 8, 2020 09:17
@sumo-drosiek sumo-drosiek force-pushed the drosiek-custom-metadata branch from 8a1f307 to a7b3a3c Compare April 8, 2020 09:17
sumo-drosiek pushed a commit that referenced this pull request Apr 8, 2020
* custom_fields (#56)
* cutom_dimensions (#57)
* sumo_client (#59)
* compression (#58)
@sumo-drosiek sumo-drosiek changed the title Allow to set metadata for metrics Allow to set dimensions for metrics Apr 8, 2020
@sumo-drosiek sumo-drosiek merged commit 8592b96 into master Apr 9, 2020
@sumo-drosiek sumo-drosiek deleted the drosiek-custom-metadata branch April 9, 2020 07:39
sumo-drosiek pushed a commit that referenced this pull request Apr 16, 2020
* custom_fields (#56)
* cutom_dimensions (#57)
* compression (#58)
sumo-drosiek added a commit that referenced this pull request Apr 22, 2020
* custom_fields (#56)
* cutom_dimensions (#57)
* compression (#58)
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.

3 participants