Not sure if it is a bug or a feature, but to me the behavior does not seem to be logical, so raising as a Bug, pending clarification whether the behavior is intended.
The issue is that there seem to be a hierarchy between the Product "hits" metric and the related Backend "hits" metric. When Backend "hits" is incremented, Product "hits" increments also.
Example setup:
The Product and the corresponding Backend have the same methods and mapping rules (request => method name):
GET / => 'get' GET /status => 'status' POST / => 'post'
I do a request of each type:
GET / GET /status POST /
The resulting stats on the Backend are as expected (method: count):
'get': 2 'status': 1 'post': 1 hits: 4
However on the Product I see the following counts:
'get': 2 'status': 1 'post': 1 hits: 8 (!)
In the Analytics section there also seems to be hierarchy between the Product's and the Backend's "hits".
While it can be argued that the Product hits should be an aggregation of the hits made to the Backends that this Product is associated with, I think there is a problem here. And it is that "hits" metric of each Product and Backend are also incremented by hitting the "methods" according to the mapping rules that are defined separately on Backend and Product. It means that if we define "methods", not "metrics" on the backend, we will inevitably get double counting of the hits (incremented through the mapping rules of the product, AND the mapping rule of the backend). I think it's a very unexpected behavior.
As possible solutions I see:
Option 1. Make "hits" metrics independent, so that backend's hits does not increment the related Product's hits.
Option 2. Remove the possibility to add "methods" on Backends (keep "metrics" as they don't increase the "hits" metric)
Option 3. Put a big red banner on the Backend's mapping rules creation page saying that incrementing backend's "hits" metric or any method will also increase the Product's "hits" metric.
Related discussion: https://chat.google.com/room/AAAAdbt0MpQ/AgBxE0gMvZM
- is related to
-
THREESCALE-8035 Make hierarchy between the Product and Backends "hits" metric configurable
- Closed