Current handling of groups leaves room for user error/confusion
Envek opened this issue · 2 comments
Given the current implementation of group
method for DSL:
yabeda/lib/yabeda/dsl/class_methods.rb
Lines 31 to 37 in bd3b49f
We can configure sibling groups
Yabeda.configure do
group :g1
# config
group :g2
# config
end
or attempt to have nested groups
Yabeda.configure do
group :g1 do
# config
group :g2 do
# config
end
# more g1 config
end
The nested groups are really the same as the first situation where we create two siblings. Both default_tags and looking up metrics would be handled the same in both cases with an additional surprise that the 'more g1 config'j would apply to the global scope.
I think that it would be good to raise an exception or at least warn when someone attempts to nest two groups to prevent the issue until there is a need for deeper nesting?
Originally posted by @liaden in #19 (comment)
We can configure sibling groups:
Yabeda.configure do group :g1 # metrics, default tags, etc group :g2 # metrics, default tags, etc end
I think that this is absolutely fine. Hard to maintain in gem code, but while group contents are reasonably small (fits into single screen) it is both understandable and clean.
Yabeda.configure do group :g1 do # config group :g2 do # config end # more g1 config end
That one implies that nesting groups are supported (which is not true). Here, IMO, we should raise an exception. Or add support for nested groups (however no one has ever asked for this AFAIR)