MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / parseTagkCustomRule

Method parseTagkCustomRule

src/tree/TreeBuilder.java:832–872  ·  view source on GitHub ↗

Processes the custom tag value paired with a custom tag name. Routes to the #processParsedValue method after processing if successful. If the custom tag group is null or empty for the tagk, or the tagk couldn't be found, we just return. @throws IllegalStateException if the tags UIDMeta array

()

Source from the content-addressed store, hash-verified

830 * @throws IllegalStateException if the tags UIDMeta array has not been set
831 */
832 private void parseTagkCustomRule() {
833 if (meta.getTags() == null || meta.getTags().isEmpty()) {
834 throw new IllegalStateException(
835 "Timeseries meta data was missing tags");
836 }
837
838 // first, find the tagk UIDMeta we're matching against
839 UIDMeta tagk = null;
840 for (UIDMeta tag: meta.getTags()) {
841 if (tag.getType() == UniqueIdType.TAGK &&
842 tag.getName().equals(rule.getField())) {
843 tagk = tag;
844 break;
845 }
846 }
847
848 if (tagk == null) {
849 testMessage("No match on tagk [" + rule.getField() + "] for rule: " +
850 rule);
851 return;
852 }
853
854 // now scan the custom tags for a matching tag name and it's value
855 testMessage("Matched tagk [" + rule.getField() + "] for rule: " +
856 rule);
857 final Map<String, String> custom = tagk.getCustom();
858 if (custom != null && custom.containsKey(rule.getCustomField())) {
859 if (custom.get(rule.getCustomField()) == null) {
860 throw new IllegalStateException(
861 "Value for custom tagk field [" + rule.getCustomField() +
862 "] was null");
863 }
864 processParsedValue(custom.get(rule.getCustomField()));
865 testMessage("Matched custom tag [" + rule.getCustomField() +
866 "] for rule: " + rule);
867 } else {
868 testMessage("No match on custom tag [" + rule.getCustomField() +
869 "] for rule: " + rule);
870 return;
871 }
872 }
873
874 /**
875 * Processes the custom tag value paired with a custom tag name. Routes to the

Callers 1

processRulesetMethod · 0.95

Calls 11

testMessageMethod · 0.95
getCustomMethod · 0.95
processParsedValueMethod · 0.95
isEmptyMethod · 0.80
getFieldMethod · 0.80
getCustomFieldMethod · 0.80
getTagsMethod · 0.65
getNameMethod · 0.65
getTypeMethod · 0.45
equalsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected