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

Add option to generate alias from regexp match #94

Closed
wants to merge 1 commit into from

Conversation

alz
Copy link
Contributor

@alz alz commented Apr 18, 2016

This patch allows dynamic creation of metric aliases based on a regex match against .. Example yaml with bean name "metrics:name=COUNTER1":

attribute:
Count:
metric_type: counter
alias_match: metrics:name=(.*)
alias: service.$1

Output alias becomes "services.counter1.count".

This greatly helps the creation of a generic config that splits hundreds (or thousands) of similarly named beans into different aliases, without the difficulty of grouping them under one alias and exceeding the maximum cardinality.

@yannmh
Copy link
Member

yannmh commented Apr 26, 2016

Thanks a lot for tackling the problem @alz.

Out of curiosity, could you let us know which of your Java application is causing these alias conflicts ?
We had to tackle quite a similar problem with Cassandra(>2.2) MBeans: multiple (=a LOT) of MBeans were being reported under the same name, but different tagging. We solved the problem by introducing a new cassandra_aliasing aliasing system (c.f. #50, #79) which instructs JMXFetch to remap metric names following the cassandra.$name.$attribute format rather than cassandra.$attribute.

I just want to make sure that we are not solving twice the same problem :).

@yannmh yannmh added this to the 0.11.0 milestone Apr 26, 2016
@alz
Copy link
Contributor Author

alz commented Apr 26, 2016

Hi @yannmh, we're monitoring one of our internal applications which exposes a very high number of metrics in in the form "metrics:type.#id#" with attributes such as "Count", etc. It's not feasible to add a config for each bean, and by selecting them with domain or bean regex matching it would group all attributes under the same alias and split the different beans into tags. It does sound similar to the Cassandra problem (except we're not using Cassandra) but gives more fine-grained control to how the alias is constructed.

@yannmh
Copy link
Member

yannmh commented Apr 27, 2016

Thanks for the extra explanations @alz.

Your changes look great! I rebased your PR on top of master to fix the tests and added some extra changes: let's move to #97.

@yannmh yannmh closed this Apr 27, 2016
yannmh added a commit to DataDog/dd-agent that referenced this pull request May 13, 2016
**Changes**
* [BUGFIX] Report properly beans with ':' in the name. See [#90][],
* [#91][], [#95][] (Thanks [@Bluestix][])
* [BUGFIX] Sanitize metric names and tags, i.e. remove illegal
* characters. See [#89][]
* [BUGFIX] Support `javax.management.Attribute` attribute types. See
* [#92][] (Thanks [@nwillems][])
* [FEATURE] Add user tags to service checks. See [#96][]
* [FEATURE] Allow group name substitutions in attribute/alias
* parameters. See [#94][], [#97][] (Thanks [@alz][])

<!--- The following link definition list is generated by PimpMyChangelog
--->
[#89]: DataDog/jmxfetch#89
[#90]: DataDog/jmxfetch#90
[#91]: DataDog/jmxfetch#91
[#92]: DataDog/jmxfetch#92
[#94]: DataDog/jmxfetch#94
[#95]: DataDog/jmxfetch#95
[#96]: DataDog/jmxfetch#96
[#97]: DataDog/jmxfetch#97
[@alz]: https://github.com/alz
[@Bluestix]: https://github.com/bluestix
[@nwillems]: https://github.com/nwillems
yannmh added a commit to DataDog/dd-agent that referenced this pull request May 13, 2016
**Changes**
* [BUGFIX] Report properly beans with ':' in the name. See [#90][],
* [#91][], [#95][] (Thanks [@Bluestix][])
* [BUGFIX] Sanitize metric names and tags, i.e. remove illegal
* characters. See [#89][]
* [BUGFIX] Support `javax.management.Attribute` attribute types. See
* [#92][] (Thanks [@nwillems][])
* [FEATURE] Add user tags to service checks. See [#96][]
* [FEATURE] Allow group name substitutions in attribute/alias
* parameters. See [#94][], [#97][] (Thanks [@alz][])

<!--- The following link definition list is generated by PimpMyChangelog
--->
[#89]: DataDog/jmxfetch#89
[#90]: DataDog/jmxfetch#90
[#91]: DataDog/jmxfetch#91
[#92]: DataDog/jmxfetch#92
[#94]: DataDog/jmxfetch#94
[#95]: DataDog/jmxfetch#95
[#96]: DataDog/jmxfetch#96
[#97]: DataDog/jmxfetch#97
[@alz]: https://github.com/alz
[@Bluestix]: https://github.com/bluestix
[@nwillems]: https://github.com/nwillems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants