chewbranca commented on code in PR #4990:
URL: https://github.com/apache/couchdb/pull/4990#discussion_r1511901605
##########
src/mango/src/mango_execution_stats.erl:
##########
@@ -37,12 +37,23 @@
-define(SHARD_STATS_KEY, mango_shard_execution_stats).
to_json(Stats) ->
+ to_json(Stats, true).
+
+to_json(Stats, IncludeDbName) ->
+ Base =
Review Comment:
I'm not quite following your suggestion, we need to include the tuple
`{dbname, Stats#execution_stats.dbname}` in the list conditionally. I think
perhaps you're suggesting to move the construction of the the base into the
arity one function head, like:
```
to_json(Stats) ->
to_json(Stats, [{dbname, Stats#execution_stats.dbname}]).
to_json(Stats, Base) ->
{[
...
| Base
]}.
```
But that would change the caller here
https://github.com/apache/couchdb/pull/4990/files/69f80aa3a270030601ebd111bd3a1dc62a5df8fa#diff-478704bf59b4beb680fc69863dfe63a544cfea5d6dca7507d6ce080c84b6cb35R119
to have to supply the base list into `to_json`, eg `to_json(Stats, [])`
instead of `to_json(Stats, false)`, and I don't think having to supply the base
list instead of a boolean is a cleaner approach.
Is this what you were suggesting or something else? I agree that it's a bit
clunky for sure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]