TeamDewberry / jmxdatamart

A Data Mart for JMX Statistics
BSD 2-Clause "Simplified" License
3 stars 8 forks source link

Aliasing patterned Beans / attributes #40

Open ankel opened 11 years ago

ankel commented 11 years ago

One of the requirement was to be able to extract using patterns, but then this means aliasing is an issue since we don't know how many are needed.

Right now, bean name / attribute name can have " . ? * = etc while I'm requiring alias to be only alphanumeric characters (so that they can be used as table / column name). However SQL also supports underscore () in table / column name. So I'm thinking about getting their name at run time, then replace all non-alphanumeric character with and use that as alias.

What do you think?

DavidWhitlock commented 11 years ago

Replacing characters that are not allowed in column names with underscore is fine.

ankel commented 11 years ago

Can pattern appears in the middle level? Such as Foo.*.Bar ?

DavidWhitlock commented 11 years ago

Yes, the wildcard can appear in the middle of the attribute name. Consider the java.lang:type=Memory bean. You may want to extract only the committed and used memory for all kinds of heap usage. In that case, you'd have something like

<Attribute>
    <name>*.committed</name>
</Attribute>
<Attribute>
    <name>*.used</name>
</Attribute>