cmetrics 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f7a2ed53936604ee92cc24e2aa15bfa07389c54e1612170c266d8953fb113a2
4
- data.tar.gz: e25ebd242bbfc84b994545675c3de1fa66276e643b57d6acaff2e8009e611c89
3
+ metadata.gz: 17d74002b1bf99b4f6be2b1b2ce5d79409da9305d7915e2006014f42c8c01429
4
+ data.tar.gz: 75fc26e6fa974c990f83fae2e16484b185bf00262713ac24d07e607e6d2a7095
5
5
  SHA512:
6
- metadata.gz: 3848618b6b384afb7867db62133784c9492335757f53f92641c11a75ee82269a9a21150a8a73e81361ff2a6be252bfc6477c2269392ce75cb50f356d62b2ebb9
7
- data.tar.gz: 360bf386dfb723f5daf2cf14e028c23ed7a546aa9e51a5ef9a403c19ffc9f380199f47eed82f0e8978991b939e64418a38839e88b4a333680888a5e64ed9842b
6
+ metadata.gz: bd95645446f591377adfa1b4561a45bb22cc20446e60ebe577c13b4c67325cd9d1c9c87c3c215f786585853da71eb05449a37ace48339f12c2e3c422c69b68f4
7
+ data.tar.gz: 85ccdb531c1cb45df65b477352e1a9c555b105a6a658b5cea977e987123d92e05b827148b4ddc4e11e1f129413c602bacccd77da32e0ded9bee6e51a68e1e5d1
@@ -21,6 +21,7 @@
21
21
  #include <cmetrics/cmt_map.h>
22
22
  #include <cmetrics/cmt_metric.h>
23
23
  #include <cmetrics/cmt_cat.h>
24
+ #include <cmetrics/cmt_encode_prometheus_remote_write.h>
24
25
 
25
26
  VALUE rb_cSerde;
26
27
 
@@ -103,7 +104,7 @@ rb_cmetrics_serde_from_msgpack(int argc, VALUE *argv, VALUE self)
103
104
  rb_scan_args(argc, argv, "12", &rb_msgpack_buffer, &rb_msgpack_length, &rb_offset);
104
105
  if (!NIL_P(rb_msgpack_length)) {
105
106
  Check_Type(rb_msgpack_length, T_FIXNUM);
106
- msgpack_length = INT2NUM(rb_msgpack_length);
107
+ msgpack_length = ULONG2NUM(rb_msgpack_length);
107
108
  } else {
108
109
  msgpack_length = RSTRING_LEN(rb_msgpack_buffer);
109
110
  }
@@ -208,6 +209,29 @@ rb_cmetrics_serde_concat_metric(VALUE self, VALUE rb_data)
208
209
  return Qnil;
209
210
  }
210
211
 
212
+ static VALUE
213
+ rb_metrics_serde_prometheus_remote_write(VALUE self)
214
+ {
215
+ struct CMetricsSerde* cmetricsSerde;
216
+ cmt_sds_t prom;
217
+ VALUE str;
218
+
219
+ TypedData_Get_Struct(
220
+ self, struct CMetricsSerde, &rb_cmetrics_serde_type, cmetricsSerde);
221
+
222
+ if (cmetricsSerde->instance == NULL) {
223
+ rb_raise(rb_eRuntimeError, "Invalid cmt context");
224
+ }
225
+
226
+ prom = cmt_encode_prometheus_remote_write_create(cmetricsSerde->instance);
227
+
228
+ str = rb_str_new2(prom);
229
+
230
+ cmt_encode_prometheus_remote_write_destroy(prom);
231
+
232
+ return str;
233
+ }
234
+
211
235
  static VALUE
212
236
  rb_cmetrics_serde_to_prometheus(VALUE self)
213
237
  {
@@ -457,6 +481,7 @@ void Init_cmetrics_serde(VALUE rb_mCMetrics)
457
481
  rb_define_method(rb_cSerde, "initialize", rb_cmetrics_serde_initialize, 0);
458
482
  rb_define_method(rb_cSerde, "concat", rb_cmetrics_serde_concat_metric, 1);
459
483
  rb_define_method(rb_cSerde, "from_msgpack", rb_cmetrics_serde_from_msgpack, -1);
484
+ rb_define_method(rb_cSerde, "prometheus_remote_write", rb_metrics_serde_prometheus_remote_write, 0);
460
485
  rb_define_method(rb_cSerde, "to_prometheus", rb_cmetrics_serde_to_prometheus, 0);
461
486
  rb_define_method(rb_cSerde, "to_influx", rb_cmetrics_serde_to_influx, 0);
462
487
  rb_define_method(rb_cSerde, "to_msgpack", rb_cmetrics_serde_to_msgpack, 0);
@@ -46,7 +46,7 @@ class BuildCMetrics
46
46
  @recipe.target = File.join(ROOT, "ports")
47
47
  @recipe.files << {
48
48
  url: "https://codeload.github.com/calyptia/cmetrics/tar.gz/v#{version}",
49
- sha256sum: "f0c79707ad4d18980bf0d1d64ed8cb73a40c586c36a4caf38233ae8d9a4c6cc7",
49
+ sha256sum: "922965a3ccc5aeb9a423d9b82be06e7aaf37f2bc8736ad6e70ac1c8845155710",
50
50
  }
51
51
  end
52
52
 
@@ -70,7 +70,7 @@ class BuildCMetrics
70
70
  end
71
71
  end
72
72
 
73
- cmetrics = BuildCMetrics.new("0.2.1", cmake_command: determine_preferred_command("cmake3", "cmake"))
73
+ cmetrics = BuildCMetrics.new("0.2.2", cmake_command: determine_preferred_command("cmake3", "cmake"))
74
74
  cmetrics.build
75
75
 
76
76
  libdir = RbConfig::CONFIG["libdir"]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CMetrics
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmetrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Hatake
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-27 00:00:00.000000000 Z
11
+ date: 2021-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler