Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add custom tags property #28

Merged
merged 12 commits into from
Apr 30, 2018
Merged

Conversation

joejstuart
Copy link
Contributor

This PR adds a property to the publisher that allows for custom tags to be added with any measurement sent with CustomDataMap. This will allow for more flexibility while querying with GROUP BY.

Copy link

@OliverNocon OliverNocon left a comment

Choose a reason for hiding this comment

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

Thanks this will be very helpful.

The tag functionality has been requested in our use case as well which we have with https://github.com/SAP/jenkins-library/blob/master/vars/influxWriteData.groovy.

I would suggest to handle it similar to customData vs. customDataMap though and do not force the same tags into all measurements. See my detailed comment. Let me know if you have further questions ...

.fields(customDataMap.get(key));

if (customDataMapTags != null && customDataMapTags.size() > 0) {
pointBuilder = pointBuilder.tag(customDataMapTags);

Choose a reason for hiding this comment

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

Currently, this is writing the same tags for all measurements.
I would suggest to do it similar to line 38 and allow different tags per measurement.

Usage would be then like

def myCustomTags = [:]
myTags1 = [buildResult: currentBuild.result, NODE_LABELS: env.NODE_LABELS]
myTags2 = [testTag: 'testTag']
myCustomTags["series1"] = myTags1
myCustomTags["series2"] = myTags2

This is similar to usage of customDataMap: https://github.com/jenkinsci/influxdb-plugin/blob/master/src/main/java/jenkinsci/plugins/influxdb/InfluxDbPublisher.java#L95

Above behavior fits better to customData: https://github.com/jenkinsci/influxdb-plugin/blob/master/src/main/java/jenkinsci/plugins/influxdb/InfluxDbPublisher.java#L72

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback. I agree that would better mirror how cutomDataMap is used. I've updated the code to reflect the changes.

@OliverNocon
Copy link

Excellent! Looks good from my side.

What about adding the possibility to write tags also for customData?

@joejstuart
Copy link
Contributor Author

I just added tags for customData. Please take a look when you can.

@OliverNocon
Copy link

Thanks very much. To me this looks very good!

@joejstuart
Copy link
Contributor Author

Awesome. Thanks for taking a look.

@asimell
Copy link
Contributor

asimell commented Apr 30, 2018

Can you fix the merge conflicts please?

@asimell asimell merged commit 24227da into jenkinsci:development Apr 30, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants