Skip to content

Commit 552697b

Browse files
committed
feat!: [torrust#1514] rename ffield kind to type in JSON metrics
"kind" has been renamed to "type" to follow Prometheus name. ```json { "type": "counter", "name": "http_tracker_core_requests_received_total", "samples": [] } ```
1 parent 33e69ff commit 552697b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/metrics/src/metric_collection.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl Serialize for MetricCollection {
234234
S: Serializer,
235235
{
236236
#[derive(Serialize)]
237-
#[serde(tag = "kind", rename_all = "lowercase")]
237+
#[serde(tag = "type", rename_all = "lowercase")]
238238
enum SerializableMetric<'a> {
239239
Counter(&'a Metric<Counter>),
240240
Gauge(&'a Metric<Gauge>),
@@ -260,7 +260,7 @@ impl<'de> Deserialize<'de> for MetricCollection {
260260
D: Deserializer<'de>,
261261
{
262262
#[derive(Deserialize)]
263-
#[serde(tag = "kind", rename_all = "lowercase")]
263+
#[serde(tag = "type", rename_all = "lowercase")]
264264
enum MetricPayload {
265265
Counter(Metric<Counter>),
266266
Gauge(Metric<Gauge>),
@@ -540,7 +540,7 @@ mod tests {
540540
r#"
541541
[
542542
{
543-
"kind":"counter",
543+
"type":"counter",
544544
"name":"http_tracker_core_announce_requests_received_total",
545545
"samples":[
546546
{
@@ -564,7 +564,7 @@ mod tests {
564564
]
565565
},
566566
{
567-
"kind":"gauge",
567+
"type":"gauge",
568568
"name":"udp_tracker_server_performance_avg_announce_processing_time_ns",
569569
"samples":[
570570
{

0 commit comments

Comments
 (0)