File tree Expand file tree Collapse file tree 4 files changed +276
-94
lines changed
main/java/com/arpnetworking/tsdcore
test/java/com/arpnetworking/tsdcore/sinks Expand file tree Collapse file tree 4 files changed +276
-94
lines changed Original file line number Diff line number Diff line change 18
18
import com .arpnetworking .logback .annotations .Loggable ;
19
19
import com .google .common .base .MoreObjects ;
20
20
import com .google .common .collect .ImmutableMap ;
21
+ import com .google .common .collect .ImmutableSet ;
21
22
23
+ import java .util .Map ;
22
24
import java .util .Objects ;
23
25
24
26
/**
@@ -49,6 +51,17 @@ public String getHost() {
49
51
return _dimensions .get (HOST_DIMENSION_KEY );
50
52
}
51
53
54
+ @ Override
55
+ public Key filter (final ImmutableSet <String > keys ) {
56
+ return new DefaultKey (
57
+ _dimensions .entrySet ()
58
+ .stream ()
59
+ .filter (e -> keys .contains (e .getKey ()))
60
+ .collect (ImmutableMap .toImmutableMap (
61
+ Map .Entry ::getKey ,
62
+ Map .Entry ::getValue )));
63
+ }
64
+
52
65
@ Override
53
66
public boolean equals (final Object other ) {
54
67
if (this == other ) {
Original file line number Diff line number Diff line change 16
16
package com .arpnetworking .tsdcore .model ;
17
17
18
18
import com .google .common .collect .ImmutableMap ;
19
+ import com .google .common .collect .ImmutableSet ;
19
20
20
21
/**
21
22
* Interface for aggregation context (e.g. slice of hyper-cube).
@@ -52,6 +53,15 @@ public interface Key {
52
53
*/
53
54
String getHost ();
54
55
56
+ /**
57
+ * Create a {@link Key} from this key that contains a subset of the
58
+ * parameters by parameter key.
59
+ *
60
+ * @param keys the parameter keys to retain in the returned {@link Key}
61
+ * @return instance of {@link Key} with only specified parameter keys and values
62
+ */
63
+ Key filter (ImmutableSet <String > keys );
64
+
55
65
/**
56
66
* The dimension key for the cluster attribute.
57
67
*/
You can’t perform that action at this time.
0 commit comments