-
Notifications
You must be signed in to change notification settings - Fork 105
Conversation
eb04240
to
7a111e8
Compare
Is it possible to make this behaviour optional via a config setting? I see some value in being able to have tagged series in the index tree.
|
@woodsaj I'm not sure I understand. |
The issue i see is that with this change, once you start sending tags with a series you can no longer use the query editor to explore the data you have (metric names). If your series are mostly in the old format with only a couple of tags, that is a problem. So you would go from being able to navigate the tree from |
I think awood's problem consists of 2 aspects:
|
Ok, I understand what you mean now. I think at least for graphite running in front of MT it should be no problem to just forward |
I think if we do that then |
47a11c1
to
084c6d3
Compare
this also means that they don't need to be deleted in the delete() method, because the delete() method is only for series without tags.
in order to loop over all defs metric defs we loop over m.DefById. This is better than looping over the tree and the tag index because it guarantees that we check every MetricDefinition exactly one time, while this wouldn't be possible on the tag index because on MetricDefinition can be referred to by many tags.
In order to include all series from both indexes (tags & tree) we iterate over DefById now.
cc0c3d1
to
352c61e
Compare
|
||
// DeleteTagged deletes the specified series from the tag index and also the | ||
// DefById index. | ||
DeleteTagged(int, []string) ([]Archive, error) |
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.
now that things are separated out, it's due time for us to document in MemoryIdx
struct, which attributes are for what use case. it seems some properties are solely for tree index, some are for just tagged index, and some (just DefById ?) are for both. this can be documented/organized better.
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.
while doing that, i realized that defByTagSet
needs to be keyed by orgId
, so I did that, plus added comments to the properties of MemoryIdx
: f319903
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 think you misunderstood what i meant. I meant we need to comment the use case for each attribute (for tag index, for hierarchy index, or for both). there was no need to describe the internals of the structures again since you already described that where the structures are defined, which is the right thing to do.
internals of stuff should be documented where the stuff is defined, not where they are used.
I changed this via 20a4ba2 please let me know what you think or if you see any mistakes
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.
yep, that works
@@ -122,6 +122,19 @@ func (t IndexAutoCompleteTagValues) Trace(span opentracing.Span) { | |||
func (i IndexAutoCompleteTagValues) TraceDebug(span opentracing.Span) { | |||
} | |||
|
|||
type IndexTagDelSeries struct { | |||
OrgId int `json:"orgId" binding:"Required"` | |||
Paths []string `json:"path" form:"path"` |
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.
interesting that is called "paths". afaik the term "path" is not commonly used yet. but i see it's the same on http://graphite.readthedocs.io/en/latest/tags.html
it looks like these values are used for the values for name tags, so why not just call this "names" instead of "paths" ( @DanCech question for you ) :) anyway not worth holding back this PR for my nitpickery but it just caught my eye.
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 think the term name
already has an implied meaning of name
wihout any tags in the context of MT, because we also have a virtual tag called name
which has that content.
So we need an alternative word to describe name;<tags>...
and because nameWithTags
is long, path
might be better
idx/memory/memory.go
Outdated
@@ -103,6 +103,29 @@ func (t *TagIndex) delTagId(name, value string, id idx.MetricID) { | |||
} | |||
} | |||
|
|||
// <name>;<key>=<name> -> Set of references to schema.MetricDefinition | |||
type defByTagSet map[string]map[*schema.MetricDefinition]struct{} |
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.
why *schema.MetricDefinition
and not schema.MetricDefinition
? would save a lot of pointers.
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.
If we copy the MDs then we'd need to make sure that all updates to MetricDefinitions are made to all instances of each. F.e. if we update LastUpdate
we'd need to make sure that the update is done to all instances of that MetricDefinition, which seems to be complicated and prone to errors.
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.
right. bummer.
idx/memory/memory.go
Outdated
return | ||
} | ||
|
||
func (m *MemoryIdx) deindexTags(tags TagIndex, def *schema.MetricDefinition) bool { |
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.
please document what the bool means
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.
done: f3b644d
@@ -483,55 +487,6 @@ func TestGetByTag(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestDeleteTaggedSeries(t *testing.T) { |
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.
why is this removed? is it replaced by something else? if so, what?
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.
The interface to delete tagged series has changed. Previously Delete()
could be used to delete tagged series, while now those methods have been separated into Delete()
and DeleteTagged()
. There are other tests for DeleteTagged()
, so this one is not necessary anymore.
idx/memory/memory_test.go
Outdated
// testWithAndWithoutTagSupport calls a test with all combinations of | ||
// the settings TagSupport and tagsInTree. In some cases those settings can | ||
// affect the logic quite a lot, so we need to test all combinations | ||
func testWithAndWithoutTagSupport(t *testing.T, f func(*testing.T)) { |
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.
this is a cool idea, but the mentioned tagsInTree parameter does not exist
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.
wouldn't it be more meaningful though, if the called functions actually did more with tags?
e.g. testWithAndWithoutTagSupport(t, testPrune)
testPrune doesn't have any tagged data, so the tagsupport enabling won't do much. so the tag support aspect of this is a bit misleading. or should we just document that the purpose here is testing solely non-tag-related stuff in context of an enabled and disabled index?
(maybe out of scope for this PR?)
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.
sorry, that comment is old, the tagsInTree
parameter did exist but then we decided to remove it.
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 think even if a function shouldn't do anything related to tagged series, it's still a good idea to test it with both settings, since doing so is basically free and it just gives a little more assurance that everything works as expected.
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.
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 think even if a function shouldn't do anything related to tagged series, it's still a good idea to test it with both settings, since doing so is basically free and it just gives a little more assurance that everything works as expected.
yep, completely agree
8021fac
to
f3b644d
Compare
remove documentation that is redundant wrt declaration of the used types
i pushed a few tweaks, otherwise I think this is pretty much good to go. @woodsaj does it look good to you? |
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.
LGTM
As described in #798, tagged series should not be added into the tree index anymore.
This also means that we'll now need separate methods to delete by tag expressions, as described here: http://graphite.readthedocs.io/en/latest/tags.html#removing-series-from-the-tagdb
Furthermore, pruning needs to be fixed so it also takes the tag index into account.
Fixes #798