CollecTor should use new metrics-lib json classes

As described in #19791 (moved). The new classes should be used for creating index.json

Depends on #19791 (moved).