Skip to content

Commit d5ef9ef

Browse files
Merge pull request #202 from splitio/telemetry-storage-inmemory
Telemetry storage inmemory
2 parents e92f321 + a963764 commit d5ef9ef

29 files changed

+1299
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package io.split.telemetry.domain;
2+
3+
import java.util.ArrayList;
4+
import java.util.Arrays;
5+
import java.util.List;
6+
import java.util.concurrent.atomic.AtomicLong;
7+
import java.util.stream.IntStream;
8+
9+
public class AtomicLongArray {
10+
private AtomicLong[] array;
11+
12+
public AtomicLongArray(int size) throws Exception {
13+
if(size == 0) {
14+
throw new Exception("Invalid array size");
15+
}
16+
array = new AtomicLong[size];
17+
IntStream.range(0, array.length).forEach(x -> array[x] = new AtomicLong());
18+
}
19+
20+
public void increment(int index) {
21+
if (index < 0 || index >= array.length) {
22+
throw new ArrayIndexOutOfBoundsException();
23+
}
24+
array[index].getAndIncrement();
25+
}
26+
27+
public List<Long> fetchAndClearAll() {
28+
List<Long> listValues = new ArrayList<>();
29+
for (AtomicLong a: array) {
30+
listValues.add(a.longValue());
31+
}
32+
33+
IntStream.range(0, array.length).forEach(x -> array[x] = new AtomicLong());
34+
35+
return listValues;
36+
}
37+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
package io.split.telemetry.domain;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
5+
import java.util.Map;
6+
import java.util.concurrent.ConcurrentHashMap;
7+
8+
public class HTTPErrors {
9+
/* package private */ static final String FIELD_SPLIT = "sp";
10+
/* package private */ static final String FIELD_SEGMENTS = "se";
11+
/* package private */ static final String FIELD_IMPRESSIONS = "im";
12+
/* package private */ static final String FIELD_IMPRESSIONS_COUNT = "ic";
13+
/* package private */ static final String FIELD_EVENTS = "ev";
14+
/* package private */ static final String FIELD_TOKEN = "to";
15+
/* package private */ static final String FIELD_TELEMETRY = "te";
16+
17+
@SerializedName(FIELD_SPLIT)
18+
private Map<Long, Long> _splits;
19+
@SerializedName(FIELD_SEGMENTS)
20+
private Map<Long, Long> _segments;
21+
@SerializedName(FIELD_IMPRESSIONS)
22+
private Map<Long, Long> _impressions;
23+
@SerializedName(FIELD_IMPRESSIONS_COUNT)
24+
private Map<Long, Long> _impressionsCount;
25+
@SerializedName(FIELD_EVENTS)
26+
private Map<Long, Long> _events;
27+
@SerializedName(FIELD_TOKEN)
28+
private Map<Long, Long> _token;
29+
@SerializedName(FIELD_TELEMETRY)
30+
private Map<Long, Long> _telemetry;
31+
32+
public HTTPErrors() {
33+
_splits = new ConcurrentHashMap<>();
34+
_segments = new ConcurrentHashMap<>();
35+
_impressions = new ConcurrentHashMap<>();
36+
_impressionsCount = new ConcurrentHashMap<>();
37+
_events = new ConcurrentHashMap<>();
38+
_token = new ConcurrentHashMap<>();
39+
_telemetry = new ConcurrentHashMap<>();
40+
}
41+
42+
public Map<Long, Long> get_splits() {
43+
return _splits;
44+
}
45+
46+
public void set_splits(Map<Long, Long> _splits) {
47+
this._splits = _splits;
48+
}
49+
50+
public Map<Long, Long> get_segments() {
51+
return _segments;
52+
}
53+
54+
public void set_segments(Map<Long, Long> _segments) {
55+
this._segments = _segments;
56+
}
57+
58+
public Map<Long, Long> get_impressions() {
59+
return _impressions;
60+
}
61+
62+
public void set_impressions(Map<Long, Long> _impressions) {
63+
this._impressions = _impressions;
64+
}
65+
66+
public Map<Long, Long> get_events() {
67+
return _events;
68+
}
69+
70+
public void set_events(Map<Long, Long> _events) {
71+
this._events = _events;
72+
}
73+
74+
public Map<Long, Long> get_token() {
75+
return _token;
76+
}
77+
78+
public void set_token(Map<Long, Long> _token) {
79+
this._token = _token;
80+
}
81+
82+
public Map<Long, Long> get_telemetry() {
83+
return _telemetry;
84+
}
85+
86+
public void set_telemetry(Map<Long, Long> _telemetry) {
87+
this._telemetry = _telemetry;
88+
}
89+
90+
public Map<Long, Long> get_impressionsCount() {
91+
return _impressionsCount;
92+
}
93+
94+
public void set_impressionsCount(Map<Long, Long> _impressionsCount) {
95+
this._impressionsCount = _impressionsCount;
96+
}
97+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
package io.split.telemetry.domain;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
5+
import java.util.ArrayList;
6+
import java.util.List;
7+
8+
public class HTTPLatencies {
9+
/* package private */ static final String FIELD_SPLIT = "sp";
10+
/* package private */ static final String FIELD_SEGMENTS = "se";
11+
/* package private */ static final String FIELD_IMPRESSIONS = "im";
12+
/* package private */ static final String FIELD_IMPRESSIONS_COUNT = "ic";
13+
/* package private */ static final String FIELD_EVENTS = "ev";
14+
/* package private */ static final String FIELD_TOKEN = "to";
15+
/* package private */ static final String FIELD_TELEMETRY = "te";
16+
17+
@SerializedName(FIELD_SPLIT)
18+
private List<Long> _splits;
19+
@SerializedName(FIELD_SEGMENTS)
20+
private List<Long>_segments;
21+
@SerializedName(FIELD_IMPRESSIONS)
22+
private List<Long> _impressions;
23+
@SerializedName(FIELD_IMPRESSIONS_COUNT)
24+
private List<Long> _impressionsCount;
25+
@SerializedName(FIELD_EVENTS)
26+
private List<Long> _events;
27+
@SerializedName(FIELD_TOKEN)
28+
private List<Long> _token;
29+
@SerializedName(FIELD_TELEMETRY)
30+
private List<Long> _telemetry;
31+
32+
public HTTPLatencies() {
33+
_splits = new ArrayList<>();
34+
_segments = new ArrayList<>();
35+
_impressions = new ArrayList<>();
36+
_impressionsCount = new ArrayList<>();
37+
_events = new ArrayList<>();
38+
_token = new ArrayList<>();
39+
_telemetry = new ArrayList<>();
40+
}
41+
42+
public List<Long> get_splits() {
43+
return _splits;
44+
}
45+
46+
public void set_splits(List<Long> _splits) {
47+
this._splits = _splits;
48+
}
49+
50+
public List<Long> get_segments() {
51+
return _segments;
52+
}
53+
54+
public void set_segments(List<Long> _segments) {
55+
this._segments = _segments;
56+
}
57+
58+
public List<Long> get_impressions() {
59+
return _impressions;
60+
}
61+
62+
public void set_impressions(List<Long> _impressions) {
63+
this._impressions = _impressions;
64+
}
65+
66+
public List<Long> get_events() {
67+
return _events;
68+
}
69+
70+
public void set_events(List<Long> _events) {
71+
this._events = _events;
72+
}
73+
74+
public List<Long> get_token() {
75+
return _token;
76+
}
77+
78+
public void set_token(List<Long> _token) {
79+
this._token = _token;
80+
}
81+
82+
public List<Long> get_telemetry() {
83+
return _telemetry;
84+
}
85+
86+
public void set_telemetry(List<Long> _telemetry) {
87+
this._telemetry = _telemetry;
88+
}
89+
90+
public List<Long> get_impressionsCount() {
91+
return _impressionsCount;
92+
}
93+
94+
public void set_impressionsCount(List<Long> _impressionsCount) {
95+
this._impressionsCount = _impressionsCount;
96+
}
97+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package io.split.telemetry.domain;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
5+
public class LastSynchronization {
6+
/* package private */ static final String FIELD_SPLIT = "sp";
7+
/* package private */ static final String FIELD_SEGMENTS = "se";
8+
/* package private */ static final String FIELD_IMPRESSIONS = "im";
9+
/* package private */ static final String FIELD_IMPRESSIONS_COUNT = "ic";
10+
/* package private */ static final String FIELD_EVENTS = "ev";
11+
/* package private */ static final String FIELD_TOKEN = "to";
12+
/* package private */ static final String FIELD_TELEMETRY = "te";
13+
14+
@SerializedName(FIELD_SPLIT)
15+
private long _splits;
16+
@SerializedName(FIELD_SEGMENTS)
17+
private long _segments;
18+
@SerializedName(FIELD_IMPRESSIONS)
19+
private long _impressions;
20+
@SerializedName(FIELD_IMPRESSIONS_COUNT)
21+
private long _impressionsCount;
22+
@SerializedName(FIELD_EVENTS)
23+
private long _events;
24+
@SerializedName(FIELD_TOKEN)
25+
private long _token;
26+
@SerializedName(FIELD_TELEMETRY)
27+
private long _telemetry;
28+
29+
public long get_splits() {
30+
return _splits;
31+
}
32+
33+
public void set_splits(long _splits) {
34+
this._splits = _splits;
35+
}
36+
37+
public long get_segments() {
38+
return _segments;
39+
}
40+
41+
public void set_segments(long _segments) {
42+
this._segments = _segments;
43+
}
44+
45+
public long get_impressions() {
46+
return _impressions;
47+
}
48+
49+
public void set_impressions(long _impressions) {
50+
this._impressions = _impressions;
51+
}
52+
53+
public long get_events() {
54+
return _events;
55+
}
56+
57+
public void set_events(long _events) {
58+
this._events = _events;
59+
}
60+
61+
public long get_token() {
62+
return _token;
63+
}
64+
65+
public void set_token(long _token) {
66+
this._token = _token;
67+
}
68+
69+
public long get_telemetry() {
70+
return _telemetry;
71+
}
72+
73+
public void set_telemetry(long _telemetry) {
74+
this._telemetry = _telemetry;
75+
}
76+
77+
public long get_impressionsCount() {
78+
return _impressionsCount;
79+
}
80+
81+
public void set_impressionsCount(long _impressionsCount) {
82+
this._impressionsCount = _impressionsCount;
83+
}
84+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package io.split.telemetry.domain;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
5+
public class MethodExceptions {
6+
/* package private */ static final String FIELD_TREATMENT = "t";
7+
/* package private */ static final String FIELD_TREATMENTS = "ts";
8+
/* package private */ static final String FIELD_TREATMENT_WITH_CONFIG = "tc";
9+
/* package private */ static final String FIELD_TREATMENTS_WITH_CONFIG = "tcs";
10+
/* package private */ static final String FIELD_TRACK = "tr";
11+
12+
@SerializedName(FIELD_TREATMENT)
13+
private long _treatment;
14+
@SerializedName(FIELD_TREATMENTS)
15+
private long _treatments;
16+
@SerializedName(FIELD_TREATMENT_WITH_CONFIG)
17+
private long _treatmentWithConfig;
18+
@SerializedName(FIELD_TREATMENTS_WITH_CONFIG)
19+
private long _treatmentsWithConfig;
20+
@SerializedName(FIELD_TRACK)
21+
private long _track;
22+
23+
public long get_treatment() {
24+
return _treatment;
25+
}
26+
27+
public void set_treatment(long _treatment) {
28+
this._treatment = _treatment;
29+
}
30+
31+
public long get_treatments() {
32+
return _treatments;
33+
}
34+
35+
public void set_treatments(long _treatments) {
36+
this._treatments = _treatments;
37+
}
38+
39+
public long get_treatmentsWithConfig() {
40+
return _treatmentsWithConfig;
41+
}
42+
43+
public void set_treatmentsWithConfig(long _treatmentsWithConfig) {
44+
this._treatmentsWithConfig = _treatmentsWithConfig;
45+
}
46+
47+
public long get_treatmentWithConfig() {
48+
return _treatmentWithConfig;
49+
}
50+
51+
public void set_treatmentWithConfig(long _treatmentWithConfig) {
52+
this._treatmentWithConfig = _treatmentWithConfig;
53+
}
54+
55+
public long get_track() {
56+
return _track;
57+
}
58+
59+
public void set_track(long _track) {
60+
this._track = _track;
61+
}
62+
}

0 commit comments

Comments
 (0)