-
Notifications
You must be signed in to change notification settings - Fork 79
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
Conversation
There was a problem hiding this 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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Excellent! Looks good from my side. What about adding the possibility to write tags also for |
I just added tags for customData. Please take a look when you can. |
Thanks very much. To me this looks very good! |
Awesome. Thanks for taking a look. |
Can you fix the merge conflicts please? |
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.