-
Notifications
You must be signed in to change notification settings - Fork 504
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
InfluxDBWriter : Add "attributesAsTag" parameter #686
base: master
Are you sure you want to change the base?
Conversation
274df62
to
1d13d04
Compare
2 months after, anybody wants to check this PR? |
jmxtrans-core/src/main/java/com/googlecode/jmxtrans/JmxTransformer.java
Outdated
Show resolved
Hide resolved
/** | ||
* The {@link ImmutableSet} of {@link ResultAttribute} attributes of | ||
* {@link Result} that will be written as {@link Point} tags | ||
*/ | ||
private final ImmutableSet<ResultAttribute> resultAttributesToWriteAsTags; | ||
@Nonnull private final ImmutableSet<ResultAttribute> resultAttributesToWriteAsTags; |
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.
tags, resultAttributesToWriteAsTags, typeNamesAsTags, attributesAsTags...
I wonder whether it would be cleaner to have a List<TagSupplier>
, TagSupplier being a poorly named functional interface to extract tags from server/query/result.
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.
I'll see if I can do something like that.
//Creates a tag map, associated by the typeName. | ||
//Results fields with the same typeName will receive the same tag values. | ||
HashMap<String,HashMap<String, String>> attrTagByTypeName = newHashMap(); | ||
if (!attributesAsTags.isEmpty()) { |
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.
Extracting a method may make it more readable.
Is it possible to convert HashMap<HashMap>
into a Map<Map>
?
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.
No problem, it will be done in the next commit.
...trans-output-influxdb/src/main/java/com/googlecode/jmxtrans/model/output/InfluxDbWriter.java
Show resolved
Hide resolved
6d3e5b0
to
1d13d04
Compare
List of attributes which won't be written as fields in InfluxDB, but as tags associated to the results-fields with the same typeNames value.
1d13d04
to
ed09588
Compare
- Change HashMap to Map - extract "attributeAsTag" process into a method
In InfluxDB, you can store values as tag or as fields. Tags are indexed but can only be Strings, fields are not indexed but suuports more data formats. (See here.) Actually, the InfluxDbWriter stores every attributes value (results from queries) as fields. If this format is adapted for metrics (counters, averages, etc...), you can have performance issues when reading if you try to filter with them. Tags are more adapted for filtering, that's why it is recommended to store IDs, names, metadata, etc... as tags. Actually, only JMX port (with reportJmxPortAsTag parameter), typeName, objDomain, className, attributeName (with resultTags parameter) and full custom tags are written. "attributesAsTag" is a list of attributes to write as tags instead of fields.
I also have a question: How can I also edit the Wiki pages in order to document features?