cmetrics 0.2.3 → 0.3.0.rc

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: a6d09be4c3b10316bbbda3ea927a6324c61adf0d0f73d989d0ace8b420fe7e24
4
- data.tar.gz: 3a58f1d603231ba1c83515fd80e46eeb0a54fd738a3c4b1056e300d4ace8d437
3
+ metadata.gz: f579a0b6b3ddc942bf862fd65e39de1ed065f441ba4d7d9b938e2f9d6d52ca2e
4
+ data.tar.gz: 726e65afae5442c901a026894ef9b2e3007a32b2f7f2e8b2a935cffa6630494f
5
5
  SHA512:
6
- metadata.gz: 21df0101a50fe8669623155eaccd4f8a1fc5da5be72967a710d308142b749765380dd5497ff2e5cec767eb38ccc4868b6c8845483ac2c28d2ea73c6f1e17a417
7
- data.tar.gz: bde2f3c1b4a9791a84b001d40f1f4b10cdba546cab2f252071c46f08e3104763ae08f96db889b1e719b1609ec65374f2c656e4973fde39643911582e640efa9e
6
+ metadata.gz: f49ff3613892bf64866a0b5979e9595733d67a6c2b2e1846b7bd05ba936e687a355e4c9eb60d055e3f5ef2bac1cc4bddbdbc441af160e6581ad8dd54663070dc
7
+ data.tar.gz: 92035694db5e66458bfa13f717491d21ccc93485c57fecea7c584eebb80f9469aa2b7bad3fbe8ac30fe09cf1fbbcda518ad2510b6af801c7541d800c839de18b
@@ -10,15 +10,15 @@ jobs:
10
10
  matrix:
11
11
  label:
12
12
  - CentOS 7 x86_64
13
- - CentOS 8 x86_64
13
+ - RockyLinux OS 8 x86_64
14
14
  - Fedora 34 x86_64
15
15
  - AmazonLinux 2 x86_64
16
16
  include:
17
17
  - label: CentOS 7 x86_64
18
18
  test-docker-image: centos:7
19
19
  test-script: ci/yum-test.sh
20
- - label: CentOS 8 x86_64
21
- test-docker-image: centos:8
20
+ - label: RockyLinux OS 8 x86_64
21
+ test-docker-image: rockylinux:8
22
22
  test-script: ci/yum-test.sh
23
23
  - label: Fedora 34 x86_64
24
24
  test-docker-image: fedora:34
@@ -36,4 +36,4 @@ jobs:
36
36
  --tty \
37
37
  --volume ${PWD}:/cmetrics-ruby \
38
38
  ${{ matrix.test-docker-image }} \
39
- /cmetrics-ruby/${{ matrix.test-script }}
39
+ /cmetrics-ruby/${{ matrix.test-script }}
data/ci/yum-test.sh CHANGED
@@ -30,6 +30,16 @@ case ${distribution} in
30
30
  ;;
31
31
  esac
32
32
  ;;
33
+ rocky)
34
+ case ${version} in
35
+ 8)
36
+ DNF="dnf --enablerepo=powertools"
37
+ ;;
38
+ *)
39
+ DNF="dnf --enablerepo=powertools"
40
+ ;;
41
+ esac
42
+ ;;
33
43
  fedoraproject)
34
44
  case ${version} in
35
45
  33|34)
@@ -55,11 +55,11 @@ counter_free(void* ptr)
55
55
  {
56
56
  struct CMetricsCounter* cmetricsCounter = (struct CMetricsCounter*)ptr;
57
57
 
58
- if (!cmetricsCounter) {
59
- if (!cmetricsCounter->counter) {
58
+ if (cmetricsCounter) {
59
+ if (cmetricsCounter->counter) {
60
60
  cmt_counter_destroy(cmetricsCounter->counter);
61
61
  }
62
- if (!cmetricsCounter->instance) {
62
+ if (cmetricsCounter->instance) {
63
63
  cmt_destroy(cmetricsCounter->instance);
64
64
  }
65
65
  }
@@ -55,11 +55,11 @@ gauge_free(void* ptr)
55
55
  {
56
56
  struct CMetricsGauge* cmetricsGauge = (struct CMetricsGauge*)ptr;
57
57
 
58
- if (!cmetricsGauge) {
59
- if (!cmetricsGauge->gauge) {
58
+ if (cmetricsGauge) {
59
+ if (cmetricsGauge->gauge) {
60
60
  cmt_gauge_destroy(cmetricsGauge->gauge);
61
61
  }
62
- if (!cmetricsGauge->instance) {
62
+ if (cmetricsGauge->instance) {
63
63
  cmt_destroy(cmetricsGauge->instance);
64
64
  }
65
65
  }
@@ -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
 
@@ -46,8 +47,8 @@ serde_free(void* ptr)
46
47
  {
47
48
  struct CMetricsSerde* cmetricsSerde = (struct CMetricsSerde*)ptr;
48
49
 
49
- if (!cmetricsSerde) {
50
- if (!cmetricsSerde->instance) {
50
+ if (cmetricsSerde) {
51
+ if (cmetricsSerde->instance) {
51
52
  cmt_destroy(cmetricsSerde->instance);
52
53
  }
53
54
  }
@@ -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);
@@ -55,11 +55,11 @@ untyped_free(void* ptr)
55
55
  {
56
56
  struct CMetricsUntyped* cmetricsUntyped = (struct CMetricsUntyped*)ptr;
57
57
 
58
- if (!cmetricsUntyped) {
59
- if (!cmetricsUntyped->untyped) {
58
+ if (cmetricsUntyped) {
59
+ if (cmetricsUntyped->untyped) {
60
60
  cmt_untyped_destroy(cmetricsUntyped->untyped);
61
61
  }
62
- if (!cmetricsUntyped->instance) {
62
+ if (cmetricsUntyped->instance) {
63
63
  cmt_destroy(cmetricsUntyped->instance);
64
64
  }
65
65
  }
@@ -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: "c0b239fad559852c0c088879697c26e00ba243cfb1c4b8bca6246d1f50932842e",
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.3.0", 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.3"
4
+ VERSION = "0.3.0.rc"
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.3
4
+ version: 0.3.0.rc
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-17 00:00:00.000000000 Z
11
+ date: 2022-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -143,9 +143,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
143
  version: 2.4.0
144
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  requirements:
146
- - - ">="
146
+ - - ">"
147
147
  - !ruby/object:Gem::Version
148
- version: '0'
148
+ version: 1.3.1
149
149
  requirements: []
150
150
  rubygems_version: 3.2.22
151
151
  signing_key: