-
Notifications
You must be signed in to change notification settings - Fork 231
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
Aggregation based custom metrics #1973
Aggregation based custom metrics #1973
Conversation
@alstanchev I will try to look at the PR soon, thanks :) In the meantime: the GitHub unit tests build fail because of these command registry tests. |
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.
Hi @alstanchev
I did a first round of review.
I found some potential concurrency issues in the added OperatorSearchMetricsProviderActor
.
Also, the added dependency to ditto-edge-service
is not in line with keeping services only to the minimum dependencies they really need to know about.
Please have a look at my remarks, the concurrency thing is concerning me ..
.../service/src/main/java/org/eclipse/ditto/thingsearch/service/starter/actors/SearchActor.java
Show resolved
Hide resolved
...org/eclipse/ditto/thingsearch/service/starter/actors/OperatorSearchMetricsProviderActor.java
Outdated
Show resolved
Hide resolved
...org/eclipse/ditto/thingsearch/service/starter/actors/OperatorSearchMetricsProviderActor.java
Outdated
Show resolved
Hide resolved
...org/eclipse/ditto/thingsearch/service/starter/actors/OperatorSearchMetricsProviderActor.java
Outdated
Show resolved
Hide resolved
...org/eclipse/ditto/thingsearch/service/starter/actors/OperatorSearchMetricsProviderActor.java
Outdated
Show resolved
Hide resolved
.../main/java/org/eclipse/ditto/thingsearch/service/common/config/CustomSearchMetricConfig.java
Outdated
Show resolved
Hide resolved
.../main/java/org/eclipse/ditto/thingsearch/service/common/config/CustomSearchMetricConfig.java
Outdated
Show resolved
Hide resolved
...org/eclipse/ditto/thingsearch/service/starter/actors/OperatorSearchMetricsProviderActor.java
Outdated
Show resolved
Hide resolved
...org/eclipse/ditto/thingsearch/service/starter/actors/OperatorSearchMetricsProviderActor.java
Outdated
Show resolved
Hide resolved
The overall approach works of course, it however has some significant problems when the provided It is of course better than doing this "outside" of Ditto, using the HTTP API and doing the aggregation outside .. but it still is not ideal. I would however suggested another way to do those "aggregations", which would be a lot more efficient and resource friendly: So on the MongoDB
Which would provide a DB result (without any need to page internally) like: [
{
"_id": "Berlin",
"sumOnline": 6,
"sumOffline": 23
},
{
"_id": "Immenstaad",
"sumOnline": 8,
"sumOffline": 42
}
] So FMPOV this could even simplify the PR a lot .. e.g. the "operator" of Ditto could "just" configure the MongoDB aggregation query to perform in the configuration file. What do you think, @alstanchev ? |
Awsome review, @thjaeckle, thanks. Sorry for the late reply i was out of office. I realy like the idea to move the aggregation to mongodb. Will look in to your suggestions and come back to discuss it. |
@thjaeckle i have refactored the whole PR and the aggregation is now done in the db. |
@alstanchev awesome, will do a review.. |
4b62f71
to
1c45ffc
Compare
Signed-off-by: Aleksandar Stanchev <[email protected]>
Signed-off-by: Aleksandar Stanchev <[email protected]>
Signed-off-by: Aleksandar Stanchev <[email protected]>
Signed-off-by: Aleksandar Stanchev <[email protected]>
Signed-off-by: Aleksandar Stanchev <[email protected]>
Signed-off-by: Aleksandar Stanchev <[email protected]>
Signed-off-by: Aleksandar Stanchev <[email protected]>
Signed-off-by: Aleksandar Stanchev <[email protected]>
Signed-off-by: Aleksandar Stanchev <[email protected]>
Signed-off-by: Aleksandar Stanchev <[email protected]>
8263efa
to
1e2ca4c
Compare
Signed-off-by: Aleksandar Stanchev <[email protected]>
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.
@alstanchev I did a first deeper review
This looks like a really great approach - I like how you reused the Visitor
for just creating an "aggregation visitor" 👍
I added remarks/requests inline.
In general, I think, that it would make sense to update configuration, code and documentation to not name this "custom search metrics" - but e.g. "custom aggregated metrics".
As the Ditto search is not used any longer for obtaining the metrics.
What do you think?
documentation/src/main/resources/pages/ditto/installation-operating.md
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/installation-operating.md
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/installation-operating.md
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/installation-operating.md
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/installation-operating.md
Outdated
Show resolved
Hide resolved
...search/service/persistence/read/criteria/visitors/CreateBsonAggregationPredicateVisitor.java
Outdated
Show resolved
Hide resolved
...search/service/persistence/read/criteria/visitors/CreateBsonAggregationPredicateVisitor.java
Outdated
Show resolved
Hide resolved
...search/service/persistence/read/criteria/visitors/CreateBsonAggregationPredicateVisitor.java
Outdated
Show resolved
Hide resolved
...tto/thingsearch/service/persistence/read/criteria/visitors/CreateBsonAggregationVisitor.java
Outdated
Show resolved
Hide resolved
...tto/thingsearch/service/persistence/read/criteria/visitors/CreateBsonAggregationVisitor.java
Outdated
Show resolved
Hide resolved
ef4fa29
to
bba9e5c
Compare
Signed-off-by: Aleksandar Stanchev <[email protected]>
bba9e5c
to
cde6c87
Compare
Thanks a lot for the adjustments @alstanchev |
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.
Hi @alstanchev
Looks almost good :)
I did a commit, doing some more missed renamings .. but I do not have the permission to push to your branch.
I will attach a patch.
And 2 more things:
- I noticed, when testing this feature, that also a "filter" tag is added to the metric, e.g. I had configured for testing a filter
above_8
:
my_test_metric{huge="true",bool="false",location="bath",filter="above_8"} 2.0
- I understood that this should not be the case - at least I couldn't read it in the documentation .. is a matching "filter" added on purpose as tag to the metric?
- I also noticed a lot of WARN logs:
2024-09-13 14:09:43,100 WARN [][] o.e.d.i.u.m.i.t.StartedKamonTimer - Tried to stop the already stopped timer <aggregate_things_metrics> with segment <overall>.
- Do you also get those WARN logs and could you look into them? I would not want to flood the Ditto search logs with WARN logs like those ..
Apart from that, this is a really awesome feature. Cannot wait to try it out on real data :)
Great thanks, will look into the WARN logs. There was a double call on stop but i tought i fixed it. |
- removed leftover hardcoded filter name tag. - renamed the Operator name from Search to Aggregate - timer is now stopped он termination of the source not at each element Signed-off-by: Aleksandar Stanchev <[email protected]>
@thjaeckle i have applied the changes you have requested and also minor other fix. |
@alstanchev did you fix the WARN logs as well? |
should be, i am not getting it locally. The problem was that stop was called on each element of the stream. Now it is in a .watchTermination() of the stream. |
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.
Cool, had another look - all fine for me now :)
Thanks again and a lot for this great addition 👍
Merge whenever you are ready to :)
Adds the posibility to define search based custom metrics.
Things can be tagged with predefined values in the config as well as with resolved ones from the things themselves.
All devices that match a filter and have the same tags ar aggregated under one metric instrument.
A cleanup is implemented so that no metric instruments are left after they are no longer used based on last time used
Resolves #1972