120 {
121 const auto& j = json_arg.payload;
123
124 const auto type = j.at( "type" ).get<std::string>();
125
126 std::string_view type_key{ type };
127
128 auto entry = registry.find( type_key );
129
130 auto sep = type_key.rfind( ':' );
131 while ( sep != type_key.npos && entry == registry.end() ) {
132
133 type_key.remove_suffix( type_key.size() - sep );
134
135 sep = type_key.rfind( ':' );
136
137 entry = registry.find( type_key );
138 }
139
140 if ( entry == registry.end() ) entry = registry.find( "counter" );
141 assert( entry != registry.end() );
142
143
144 return fmt::format_to( ctx.out(), fmt::runtime( entry->second ), json_arg );
145 } else {
146
149 case 'd':
150 return fmt::format_to( ctx.out(), fmt::runtime( actualFormat ),
151 j.at(
currentName ).template get<unsigned int>() );
152 case 'g':
153 return fmt::format_to( ctx.out(), fmt::runtime( actualFormat ), j.at(
currentName ).template get<double>() );
154 case 'p':
155 actualFormat[actualFormat.size() - 2] = 'g';
156 return fmt::format_to( ctx.out(), fmt::runtime( actualFormat ),
157 j.at(
currentName ).template get<double>() * 100 );
158 default:
159 return fmt::format_to( ctx.out(),
"Unknown counter format : {}",
currentFormat );
160 }
161 }
162 }