cmetrics 0.2.4 → 0.3.0

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: 9cb75c4c4235b1607ae66658ec6985ef20dc2338ea06dd38b624fa1265c7d4c8
4
+ data.tar.gz: 3141eb411cacb661df52cd1d9da91f73d07615cb1a1fa9fea8db346e29bdfabd
5
5
  SHA512:
6
- metadata.gz: 3848618b6b384afb7867db62133784c9492335757f53f92641c11a75ee82269a9a21150a8a73e81361ff2a6be252bfc6477c2269392ce75cb50f356d62b2ebb9
7
- data.tar.gz: 360bf386dfb723f5daf2cf14e028c23ed7a546aa9e51a5ef9a403c19ffc9f380199f47eed82f0e8978991b939e64418a38839e88b4a333680888a5e64ed9842b
6
+ metadata.gz: 3b55f676d133462f592903c479e1e07603cb3b1c1b9fc8443bfd3ac80e791fc10173bcfc164d4ce3f30b0939ff72c0689c3f0dea1a8795a8a2856b6c03f11965
7
+ data.tar.gz: a8e2310516436a3a2a85cd79bb844501d0e1f37b3203a10f68913326cc4668ec570f4da20b08acf3eafd5b8c8c8df518133ab45117ac3ee18dbec919da056633
@@ -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)
@@ -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: "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.4"
4
+ VERSION = "0.3.0"
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.3.0
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: 2022-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  requirements: []
150
- rubygems_version: 3.2.22
150
+ rubygems_version: 3.2.32
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: C binding for cmetric library.