prometheus-client-mmap 0.7.0.beta40 → 0.7.0.beta41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/fast_mmaped_file/extconf.rb +1 -1
- data/ext/fast_mmaped_file/fast_mmaped_file.c +0 -3
- data/ext/fast_mmaped_file/file_parsing.c +7 -16
- data/ext/fast_mmaped_file/file_parsing.h +2 -0
- data/ext/fast_mmaped_file/file_reading.c +1 -1
- data/ext/fast_mmaped_file/globals.h +0 -1
- data/ext/fast_mmaped_file/mmap.h +2 -12
- data/ext/fast_mmaped_file/rendering.c +7 -0
- data/ext/fast_mmaped_file/value_access.c +8 -5
- data/ext/fast_mmaped_file/value_access.h +0 -2
- data/lib/fast_mmaped_file.bundle +0 -0
- data/lib/prometheus/client/version.rb +1 -1
- data/lib/prometheus/client/version.rb.orig +3 -3
- metadata +1 -2
- data/ext/fast_mmaped_file/file_aggregation.c +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49ac78e6bb20f940989a545386f5a8340dd3a046
|
4
|
+
data.tar.gz: e11aeb1946d4c4afa0f09e5037bbb7b7e5c23a6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 961b21816d5e183e2ea030512481b9627671d66b632ed2be9644eda9ed512a933a4f96a6fef06163ea21998675c6a226e6571f3bda4a10b97c83189d066f489c
|
7
|
+
data.tar.gz: 2351c759ee985a918c5aecaa752cb4071fb0686f4185944ea13559b9bc3cb1fd7b8b8c2e1a166be689f0a960a02204d6a277243c331ddde97814f1a393f632c5
|
@@ -6,7 +6,6 @@
|
|
6
6
|
#include <value_access.h>
|
7
7
|
#include <globals.h>
|
8
8
|
|
9
|
-
|
10
9
|
#include <jsmn.h>
|
11
10
|
#include <hashmap.h>
|
12
11
|
#include <file_reading.h>
|
@@ -21,7 +20,6 @@ ID sym_livesum;
|
|
21
20
|
ID sym_gauge;
|
22
21
|
ID sym_pid;
|
23
22
|
ID sym_samples;
|
24
|
-
ID sym_key_name;
|
25
23
|
|
26
24
|
int aggregate_files(struct hashmap *map, VALUE list_of_files){
|
27
25
|
buffer_t reading_buffer = (buffer_t) { .buffer = NULL };
|
@@ -91,7 +89,6 @@ void Init_fast_mmaped_file() {
|
|
91
89
|
sym_livesum = rb_intern("livesum");
|
92
90
|
sym_pid = rb_intern("pid");
|
93
91
|
sym_samples = rb_intern("samples");
|
94
|
-
sym_key_name = rb_intern("__key_name");
|
95
92
|
|
96
93
|
MMAPED_FILE = rb_define_module("FastMmapedFile");
|
97
94
|
rb_define_singleton_method(MMAPED_FILE, "to_metrics", method_to_metrics, 1);
|
@@ -5,20 +5,10 @@
|
|
5
5
|
#include <jsmn.h>
|
6
6
|
#include "file_parsing.h"
|
7
7
|
|
8
|
-
//ID sym_gauge;
|
9
|
-
//ID sym_min;
|
10
|
-
//ID sym_max;
|
11
|
-
//ID sym_livesum;
|
12
|
-
|
13
8
|
HASHMAP_FUNCS_CREATE(entry, const entry_struct, entry_struct)
|
14
9
|
|
15
10
|
typedef int (*compare_fn) (const void *a, const void *b);
|
16
11
|
|
17
|
-
inline int is_pid_significant(const entry_struct *a){
|
18
|
-
ID mp = a->multiprocess_mode;
|
19
|
-
return a->type == sym_gauge && !(mp == sym_min || mp == sym_max || mp == sym_livesum);
|
20
|
-
}
|
21
|
-
|
22
12
|
size_t hashmap_hash_entry(const entry_struct *entry){
|
23
13
|
size_t hash = 0;
|
24
14
|
|
@@ -78,7 +68,7 @@ void merge_entry(entry_struct *found, const entry_struct *entry){
|
|
78
68
|
} else if (entry->multiprocess_mode == sym_livesum) {
|
79
69
|
found->value += entry->value;
|
80
70
|
} else {
|
81
|
-
found->value
|
71
|
+
found->value = entry->value;
|
82
72
|
}
|
83
73
|
} else {
|
84
74
|
found->value += entry->value;
|
@@ -174,17 +164,14 @@ int process_buffer(file_t *file_info, buffer_t *source, struct hashmap *map){
|
|
174
164
|
entry.pid = file_info->pid;
|
175
165
|
entry.type = file_info->type;
|
176
166
|
|
177
|
-
|
178
|
-
|
179
|
-
pos += value_offset;
|
180
|
-
memcpy(&entry.value, source->buffer + pos, sizeof(double)); //too
|
167
|
+
memcpy(&entry.value, entry.json + value_offset, sizeof(double));
|
181
168
|
|
182
169
|
if (!process_entry(map, &entry)) {
|
183
170
|
entries_destroy(map);
|
184
171
|
return 0;
|
185
172
|
}
|
186
173
|
|
187
|
-
pos += sizeof(double);
|
174
|
+
pos += value_offset + sizeof(double);
|
188
175
|
}
|
189
176
|
return 1;
|
190
177
|
}
|
@@ -220,3 +207,7 @@ int sort_map_entries(const struct hashmap *map, entry_struct ***sorted_entries){
|
|
220
207
|
return 1;
|
221
208
|
}
|
222
209
|
|
210
|
+
int is_pid_significant(const entry_struct *e){
|
211
|
+
ID mp = e->multiprocess_mode;
|
212
|
+
return e->type == sym_gauge && !(mp == sym_min || mp == sym_max || mp == sym_livesum);
|
213
|
+
}
|
@@ -20,4 +20,6 @@ void entries_destroy(struct hashmap *map);
|
|
20
20
|
int process_buffer(file_t *file_info, buffer_t *source, struct hashmap *map);
|
21
21
|
int sort_map_entries(const struct hashmap *map, entry_struct ***sorted_entries);
|
22
22
|
|
23
|
+
int is_pid_significant(const entry_struct *e);
|
24
|
+
|
23
25
|
#endif
|
@@ -9,7 +9,7 @@ int file_open(file_t *file, const char *filepath){
|
|
9
9
|
file->path = malloc(filepath_len);
|
10
10
|
memcpy(file->path, filepath, filepath_len + 1);
|
11
11
|
|
12
|
-
if (file->fd
|
12
|
+
if (file->fd == NULL){
|
13
13
|
save_exception(rb_eArgError, "Can't open %s, errno: %d", filepath, errno);
|
14
14
|
|
15
15
|
return 0;
|
data/ext/fast_mmaped_file/mmap.h
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#ifndef MMAP_H
|
2
2
|
#define MMAP_H
|
3
3
|
|
4
|
+
#include <unistd.h>
|
4
5
|
#include <ruby.h>
|
5
6
|
|
6
7
|
#define MM_MODIFY 1
|
@@ -16,18 +17,7 @@
|
|
16
17
|
#define MM_TMP (1 << 5)
|
17
18
|
|
18
19
|
#ifndef MMAP_RETTYPE
|
19
|
-
#
|
20
|
-
#define _POSIX_C_SOURCE 199309
|
21
|
-
#endif /* !_POSIX_C_SOURCE */
|
22
|
-
#ifdef _POSIX_VERSION
|
23
|
-
#if _POSIX_VERSION >= 199309
|
24
|
-
#define MMAP_RETTYPE void *
|
25
|
-
#endif /* _POSIX_VERSION >= 199309 */
|
26
|
-
#endif /* _POSIX_VERSION */
|
27
|
-
#endif /* !MMAP_RETTYPE */
|
28
|
-
|
29
|
-
#ifndef MMAP_RETTYPE
|
30
|
-
#define MMAP_RETTYPE caddr_t
|
20
|
+
#define MMAP_RETTYPE void *
|
31
21
|
#endif
|
32
22
|
|
33
23
|
typedef struct {
|
@@ -46,6 +46,13 @@ void append_entry(VALUE string, const entry_struct *entry){
|
|
46
46
|
rb_str_cat(string, ",", 1);
|
47
47
|
}
|
48
48
|
}
|
49
|
+
|
50
|
+
if (is_pid_significant(entry)){
|
51
|
+
rb_str_cat(string, ",pid=\"", 6);
|
52
|
+
rb_str_append(string, entry->pid);
|
53
|
+
rb_str_cat(string, "\"", 1);
|
54
|
+
}
|
55
|
+
|
49
56
|
rb_str_cat(string, "}", 1);
|
50
57
|
}
|
51
58
|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include <ruby/intern.h>
|
3
|
+
|
1
4
|
#include <sys/mman.h>
|
2
5
|
#include <unistd.h>
|
3
6
|
#include <fcntl.h>
|
@@ -16,7 +19,7 @@ int open_and_extend_file(mm_ipc *i_mm, size_t len) {
|
|
16
19
|
|
17
20
|
if (lseek(fd, len - i_mm->t->len - 1, SEEK_END) == -1) {
|
18
21
|
close(fd);
|
19
|
-
rb_raise(rb_eIOError, "Can't lseek %
|
22
|
+
rb_raise(rb_eIOError, "Can't lseek %zu", len - i_mm->t->len - 1);
|
20
23
|
}
|
21
24
|
|
22
25
|
if (write(fd, "\000", 1) != 1) {
|
@@ -124,8 +127,8 @@ VALUE method_add_entry(VALUE self, VALUE positions, VALUE key, VALUE value) {
|
|
124
127
|
rb_error_frozen("mmap");
|
125
128
|
}
|
126
129
|
|
127
|
-
if (RSTRING_LEN(key) >
|
128
|
-
rb_raise(rb_eArgError, "string length gt %
|
130
|
+
if (RSTRING_LEN(key) > INT32_MAX) {
|
131
|
+
rb_raise(rb_eArgError, "string length gt %d", INT32_MAX);
|
129
132
|
}
|
130
133
|
|
131
134
|
uint32_t key_length = (uint32_t)RSTRING_LEN(key);
|
@@ -150,11 +153,11 @@ VALUE method_get_double(VALUE self, VALUE index) {
|
|
150
153
|
size_t idx = NUM2UINT(index);
|
151
154
|
|
152
155
|
if ((i_mm->t->real + sizeof(double)) <= idx) {
|
153
|
-
rb_raise(rb_eIndexError, "index %
|
156
|
+
rb_raise(rb_eIndexError, "index %zu out of string", idx);
|
154
157
|
}
|
155
158
|
|
156
159
|
double tmp;
|
157
160
|
|
158
161
|
memcpy(&tmp, (char *)i_mm->t->addr + idx, sizeof(double));
|
159
162
|
return DBL2NUM(tmp);
|
160
|
-
}
|
163
|
+
}
|
data/lib/fast_mmaped_file.bundle
CHANGED
Binary file
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Prometheus
|
2
2
|
module Client
|
3
3
|
<<<<<<< HEAD
|
4
|
-
VERSION = '0.7.0.
|
4
|
+
VERSION = '0.7.0.beta40'.freeze
|
5
5
|
=======
|
6
|
-
VERSION = '0.7.0.
|
7
|
-
>>>>>>>
|
6
|
+
VERSION = '0.7.0.beta38'.freeze
|
7
|
+
>>>>>>> upstream/master
|
8
8
|
end
|
9
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus-client-mmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0.
|
4
|
+
version: 0.7.0.beta41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schmidt
|
@@ -105,7 +105,6 @@ files:
|
|
105
105
|
- README.md
|
106
106
|
- ext/fast_mmaped_file/extconf.rb
|
107
107
|
- ext/fast_mmaped_file/fast_mmaped_file.c
|
108
|
-
- ext/fast_mmaped_file/file_aggregation.c
|
109
108
|
- ext/fast_mmaped_file/file_format.h
|
110
109
|
- ext/fast_mmaped_file/file_parsing.c
|
111
110
|
- ext/fast_mmaped_file/file_parsing.h
|
File without changes
|