MetricType decoration to be consumed by the web api
- Dominant language
- Java
- Stars
- 14.9k
- Forks
- 3.5k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 88
Description
Hi,
in the current branch for the metrics feature, there is a mechanism to provide only the relevant data to the webapi, while delivering all the metrics fields to the store. This is archived by something like
``` ruby
def to_hash
{
"namespaces" => namespaces,
"key" => key,
"type" => type,
"value" => value
}
end
def to_json_data
value
end
```
And then using JSON serialization to provide all necessary fields for the web api. This is doing it's work, but is an obscure method to select only relevant data.
I propose we introduce a decorator that transform this class by only providing the relevant data (aka minimal data). This will allow us remove the usage of `to_json_data` method, only required by jrjackson and allow us to have a more clever code to understand in the long run.
Contributor guide
Research direction
Start by reading the MetricType serialization methods shown in the issue, especially to_hash and to_json_data, and review how JSON serialization and jrjackson consume them. Determine the decorator's scope and how removing to_json_data would preserve the web API's minimal data while still exposing all metrics fields to the store.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100