Issue 32 in stajistics: DefaultStatsConfigBuilder does not respect root configuration

0 views
Skip to first unread message

staji...@googlecode.com

unread,
May 21, 2010, 7:31:24 AM5/21/10
to stajist...@googlegroups.com
Status: Accepted
Owner: lorant.p...@gmail.com
Labels: Type-Defect Priority-Medium Milestone-Release0.4

New issue 32 by lorant.p...@gmail.com: DefaultStatsConfigBuilder does not
respect root configuration
http://code.google.com/p/stajistics/issues/detail?id=32

Reproducible with the following code:

StatsManager statsManager = Stats.getManager();
StatsConfig defaultRootConfig =
statsManager.getConfigManager().getRootConfig();
StatsConfig newRootConfig =
statsManager.getConfigFactory().createConfigBuilder(defaultRootConfig)
.withDescription("[description inherited from root]").newConfig();
statsManager.getConfigManager().setRootConfig(newRootConfig);

StatsKey key = Stats.newKey("test");

StatsConfig originalConfig = Stats.getConfigManager().getConfig(key);

Stats.getManager().getConfigFactory().createConfigBuilder(originalConfig).withUnit("[unit
defined in child]")
.setConfigFor(key);

System.out.println(Stats.getConfigManager().getConfig(key).getDescription());
System.out.println(Stats.getConfigManager().getConfig(key).getUnit());

The expected output would be:

[description inherited from root]
[unit defined in child]

Whereas we get:

null
[unit defined in child]

This is against Stajistics 0.3.



--
You received this message because you are subscribed to the Google Groups "stajistics-dev" group.
To post to this group, send email to stajist...@googlegroups.com.
To unsubscribe from this group, send email to stajistics-de...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/stajistics-dev?hl=en.

staji...@googlecode.com

unread,
May 21, 2010, 7:35:26 AM5/21/10
to stajist...@googlegroups.com

Comment #1 on issue 32 by lorant.p...@gmail.com: DefaultStatsConfigBuilder
does not respect root configuration
http://code.google.com/p/stajistics/issues/detail?id=32

There is a simple workaround for this, but it is rather ugly:

StatsConfig originalConfig = Stats.getConfigManager().getConfig(key);
if (originalConfig == null) {
originalConfig = Stats.getConfigManager().getRootConfig();
}

Stats.getManager().getConfigFactory().createConfigBuilder(originalConfig).withUnit("[unit
defined in child]")
.setConfigFor(key);


staji...@googlecode.com

unread,
May 29, 2010, 1:40:45 AM5/29/10
to stajist...@googlegroups.com

Comment #2 on issue 32 by troy.kin...@gmail.com: DefaultStatsConfigBuilder

After examining this test more closely, I realized that this was the
intended
behaviour. The configuration inheritance mechanism was design to inherit
entire
configurations from parents, not individual attributes. The usefulness in
this is
that you can specify a high level configuration for key X, then your
application can
just start using child key Y (without supplying configuration), and the
configuration
would be automatically created as inherited from X.

It might be possible to allow per-attribute inheritance, however, I think
this would
add too much memory overhead for the "benefit" it provides, because each
field would
need to be remembered as inherited or not. Currently only entire configs
remember if
they were inherited.

Clearly, you've found a really good candidate for needing some detailed
documentation.


staji...@googlecode.com

unread,
Jun 16, 2011, 8:51:46 PM6/16/11
to stajist...@googlegroups.com
Updates:
Status: WontFix

Comment #3 on issue 32 by troy.kin...@gmail.com: DefaultStatsConfigBuilder

Closing. Only documentation is needed (which is a general problem).

Reply all
Reply to author
Forward
0 new messages