diff --git a/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/TSDBEntity.java b/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/TSDBEntity.java index 3ffacb5c6..48b099d24 100644 --- a/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/TSDBEntity.java +++ b/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/TSDBEntity.java @@ -256,7 +256,6 @@ private String getTag(String key, boolean isUserTag) { public static enum ReservedField { META("meta"), - METRIC("metric"), UNITS("units"), DISPLAY_NAME("displayName"); diff --git a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/NamespaceService.java b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/NamespaceService.java index ba82f15da..7814e96c4 100644 --- a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/NamespaceService.java +++ b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/NamespaceService.java @@ -43,11 +43,6 @@ */ public interface NamespaceService extends Service { - //~ Instance fields ****************************************************************************************************************************** - - /** The namespace prefix used to delineate the namespace. */ - String NAMEPSACE_PREFIX = "-__-"; - //~ Methods ************************************************************************************************************************************** /** diff --git a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/TSDBService.java b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/TSDBService.java index 8d05140ae..9b6438c8e 100644 --- a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/TSDBService.java +++ b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/TSDBService.java @@ -79,34 +79,6 @@ public interface TSDBService extends Service { * @return The query results. Will never be null, but may be empty. */ List getAnnotations(List queries); - - /** - * Constructs a native TSDB metric name from supplied scope and namespace - * - * @param scope - TSDB scope of a metric - * @param namespace - namespace for a metric - * - * @return The native TSDB metric name for this metric. This method should never return null. - */ - String constructTSDBMetricName(String scope, String namespace); - - /** - * Calculates the scope of a metric given it's native TSDB name. - * - * @param tsdbMetricName The native TSDB metric name. - * - * @return The scope of the metric. May return null. - */ - String getScopeFromTSDBMetric(String tsdbMetricName); - - /** - * Calculates the namespace of a metric given it's native TSDB name. - * - * @param tsdbMetricName The TSDB metric name. - * - * @return The namespace of the metric. May return null. - */ - String getNamespaceFromTSDBMetric(String tsdbMetricName); /** * Enumeration of time window for a query diff --git a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/jpa/DefaultNamespaceService.java b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/jpa/DefaultNamespaceService.java index 6868dfed8..f1accc94f 100644 --- a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/jpa/DefaultNamespaceService.java +++ b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/jpa/DefaultNamespaceService.java @@ -106,34 +106,29 @@ public List findNamespacesByOwner(PrincipalUser owner) { /** * Creates a new namespace. * - * @param newNamespace The namespace to create. Cannot be null. + * @param namespace The namespace to create. Cannot be null. * - * @return The update namespace object having the ID field populated. + * @return The updated namespace object having the ID field populated. * * @throws SystemException If a duplicate namespace exists. */ @Override - public Namespace createNamespace(Namespace newNamespace) { + public Namespace createNamespace(Namespace namespace) { requireNotDisposed(); - requireArgument(newNamespace != null, "null namespace cannot be created."); - if (!_validateQualifier(newNamespace.getQualifier())) { + requireArgument(namespace != null, "null namespace cannot be created."); + + if (!_validateQualifier(namespace.getQualifier())) { throw new SystemException(new IllegalArgumentException( "Illegal characters found while generating namespace. Cannot generate a namespace with this qualifier.")); } - - String qualifierWithPrefix = - (newNamespace.getQualifier().length() >= NAMEPSACE_PREFIX.length() && - newNamespace.getQualifier().substring(0, NAMEPSACE_PREFIX.length()).equals(NAMEPSACE_PREFIX)) - ? newNamespace.getQualifier() : NAMEPSACE_PREFIX + newNamespace.getQualifier(); - Namespace namespace = Namespace.findByQualifier(emf.get(), qualifierWithPrefix); - - if (namespace != null) { + + if (Namespace.findByQualifier(emf.get(), namespace.getQualifier()) != null) { throw new SystemException(new IllegalArgumentException("Namespace already exists. Please try a different namespace.")); } - newNamespace.setQualifier(qualifierWithPrefix); - newNamespace = updateNamespace(newNamespace); - _logger.debug("Generated namespace {}.", newNamespace); - return newNamespace; + + namespace = updateNamespace(namespace); + _logger.debug("Generated namespace {}.", namespace); + return namespace; } private boolean _validateQualifier(String qualifierSuffix) { diff --git a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/AnnotationQuery.java b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/AnnotationQuery.java index dbb9bc75d..42e7906c7 100644 --- a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/AnnotationQuery.java +++ b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/AnnotationQuery.java @@ -35,6 +35,7 @@ import com.salesforce.dva.argus.entity.Metric; import com.salesforce.dva.argus.entity.TSDBEntity.ReservedField; import com.salesforce.dva.argus.system.SystemException; + import java.io.UnsupportedEncodingException; import java.text.MessageFormat; import java.util.HashMap; @@ -263,21 +264,23 @@ protected void setMetric(String metric) { * @throws UnsupportedEncodingException If UTF-8 is not supported. */ protected String toTagParameterArray(Map tags) throws UnsupportedEncodingException { + if(tags == null || tags.isEmpty()) { + return ""; + } + StringBuilder sb = new StringBuilder(encode("{", "UTF-8")); + for (Map.Entry tagEntry : tags.entrySet()) { + sb.append(tagEntry.getKey()).append("="); - if (tags != null && !tags.isEmpty()) { - for (Map.Entry tagEntry : tags.entrySet()) { - sb.append(tagEntry.getKey()).append("="); - - String tagV = tagEntry.getValue().replaceAll("\\|", encode("|", "UTF-8")); + String tagV = tagEntry.getValue().replaceAll("\\|", encode("|", "UTF-8")); - sb.append(tagV).append(","); - } + sb.append(tagV).append(","); } sb.replace(sb.length() - 1, sb.length(), encode("}", "UTF-8")); + return sb.toString(); } - + @Override public int hashCode() { final int prime = 31; @@ -363,12 +366,14 @@ public String toString() { String pattern = "start={0,number,#}&end={1,number,#}&m=avg:{2}{3}&ms=true&show_tsuids=true"; long start = Math.max(0, getStartTimestamp() - 1); long end = Math.max(start, getEndTimestamp() + 1); + String scope = DefaultTSDBService.toAnnotationKey(_scope, _metric, _type, _tags); + //When creating the corresponding argus Metric for the annotations, _type is used as metric name. + String tsdbMetricName = DefaultTSDBService.constructTSDBMetricName(new Metric(scope, _type)); Map tags = new HashMap<>(getTags()); - - tags.put(ReservedField.METRIC.getKey(), _type); + try { - return MessageFormat.format(pattern, start, end, scope, toTagParameterArray(tags)); + return MessageFormat.format(pattern, start, end, tsdbMetricName, toTagParameterArray(tags)); } catch (UnsupportedEncodingException ex) { throw new SystemException(ex); } diff --git a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java index 975c525b1..1556ffe20 100644 --- a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java +++ b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java @@ -579,21 +579,6 @@ public void putAnnotations(List annotations) { public List getAnnotations(List queries) { return _defaultTsdbService.getAnnotations(queries); } - - @Override - public String constructTSDBMetricName(String scope, String namespace) { - return _defaultTsdbService.constructTSDBMetricName(scope, namespace); - } - - @Override - public String getScopeFromTSDBMetric(String tsdbMetricName) { - return _defaultTsdbService.getScopeFromTSDBMetric(tsdbMetricName); - } - - @Override - public String getNamespaceFromTSDBMetric(String tsdbMetricName) { - return _defaultTsdbService.getNamespaceFromTSDBMetric(tsdbMetricName); - } private void instrumentQueryLatency(final MonitorService monitorService, final AnnotationQuery query, final long start) { String timeWindow = QueryTimeWindow.getWindow(query.getEndTimestamp() - query.getStartTimestamp()); diff --git a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/DefaultTSDBService.java b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/DefaultTSDBService.java index 5c8d83acf..ed924d107 100644 --- a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/DefaultTSDBService.java +++ b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/DefaultTSDBService.java @@ -78,7 +78,8 @@ public class DefaultTSDBService extends DefaultService implements TSDBService { private static final int CHUNK_SIZE = 50; private static final int TSDB_DATAPOINTS_WRITE_MAX_SIZE = 100; private static final String QUERY_LATENCY_COUNTER = "query.latency"; - private static final String QUERY_COUNT_COUNTER = "query.count"; + private static final String QUERY_COUNT_COUNTER = "query.count"; + static final String DELIMITER = "-__-"; //~ Instance fields ****************************************************************************************************************************** @@ -158,17 +159,67 @@ private static String toAnnotationKey(Annotation annotation) { return toAnnotationKey(scope, metric, type, tags); } + + /** + * We construct OpenTSDB metric name as a combination of Argus metric, scope and namespace as follows: + * + * metric(otsdb) = metric(argus)scope(argus)namespace(argus) + * + * @param metric + * @return OpenTSDB metric name constructed from scope, metric and namespace. + */ + public static String constructTSDBMetricName(Metric metric) { + StringBuilder sb = new StringBuilder(); + + sb.append(metric.getMetric()).append(DELIMITER).append(metric.getScope()); - private ObjectMapper getMapper() { - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); + if (metric.getNamespace() != null && !metric.getNamespace().isEmpty()) { + sb.append(DELIMITER).append(metric.getNamespace()); + } + return sb.toString(); + } - module.addSerializer(Metric.class, new MetricTransform.Serializer(this)); - module.addDeserializer(Metric.class, new MetricTransform.Deserializer(this)); - module.addSerializer(AnnotationWrapper.class, new AnnotationTransform.Serializer()); - module.addDeserializer(AnnotationWrappers.class, new AnnotationTransform.Deserializer()); - mapper.registerModule(module); - return mapper; + /** + * Given otsdb metric name, return argus metric. + * We construct OpenTSDB metric name as a combination of Argus metric, scope and namespace as follows: + * + * metric(otsdb) = metric(argus)scope(argus)namespace(argus) + * + * + * @param tsdbMetricName + * @return Argus metric name. + */ + public static String getMetricFromTSDBMetric(String tsdbMetricName) { + return tsdbMetricName.split(DELIMITER)[0]; + } + + /** + * Given otsdb metric name, return argus scope. + * We construct OpenTSDB metric name as a combination of Argus metric, scope and namespace as follows: + * + * metric(otsdb) = metric(argus)scope(argus)namespace(argus) + * + * + * @param tsdbMetricName + * @return Argus scope. + */ + public static String getScopeFromTSDBMetric(String tsdbMetricName) { + return tsdbMetricName.split(DELIMITER)[1]; + } + + /** + * Given otsdb metric name, return argus namespace. + * We construct OpenTSDB metric name as a combination of Argus metric, scope and namespace as follows: + * + * metric(otsdb) = metric(argus)scope(argus)namespace(argus) + * + * + * @param tsdbMetricName + * @return Argus namespace. + */ + public static String getNamespaceFromTSDBMetric(String tsdbMetricName) { + String[] splits = tsdbMetricName.split(DELIMITER); + return (splits.length == 3) ? splits[2] : null; } //~ Methods ************************************************************************************************************************************** @@ -302,26 +353,17 @@ public List getAnnotations(List queries) { } return annotations; } + + private ObjectMapper getMapper() { + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); - @Override - public String constructTSDBMetricName(String scope, String namespace) { - StringBuilder sb = new StringBuilder(scope); - - if (namespace != null && !namespace.isEmpty()) { - sb.append(namespace); - } - return sb.toString(); - } - - @Override - public String getScopeFromTSDBMetric(String tsdbMetricName) { - return tsdbMetricName.split(NamespaceService.NAMEPSACE_PREFIX)[0]; - } - - @Override - public String getNamespaceFromTSDBMetric(String tsdbMetricName) { - String[] splits = tsdbMetricName.split(NamespaceService.NAMEPSACE_PREFIX); - return (splits.length == 2) ? NamespaceService.NAMEPSACE_PREFIX + splits[1] : null; + module.addSerializer(Metric.class, new MetricTransform.Serializer(this)); + module.addDeserializer(Metric.class, new MetricTransform.Deserializer(this)); + module.addSerializer(AnnotationWrapper.class, new AnnotationTransform.Serializer()); + module.addDeserializer(AnnotationWrappers.class, new AnnotationTransform.Deserializer()); + mapper.registerModule(module); + return mapper; } /* Writes objects in chunks. */ diff --git a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/MetricQuery.java b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/MetricQuery.java index b71b300db..541c00bdf 100644 --- a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/MetricQuery.java +++ b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/MetricQuery.java @@ -34,9 +34,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.salesforce.dva.argus.entity.TSDBEntity.ReservedField; import com.salesforce.dva.argus.system.SystemAssert; import com.salesforce.dva.argus.system.SystemException; + import java.io.UnsupportedEncodingException; import java.text.MessageFormat; import java.util.HashMap; @@ -177,10 +177,12 @@ public void setDownsamplingPeriod(Long downsamplingPeriod) { */ @JsonIgnore public String getTSDBMetricName() { - StringBuilder sb = new StringBuilder(getScope()); + StringBuilder sb = new StringBuilder(); + + sb.append(getMetric()).append(DefaultTSDBService.DELIMITER).append(getScope()); if (_namespace != null && !_namespace.isEmpty()) { - sb.append(getNamespace()); + sb.append(DefaultTSDBService.DELIMITER).append(getNamespace()); } return sb.toString(); } @@ -256,8 +258,7 @@ public String toString() { sb.append(getTSDBMetricName()); Map tags = new HashMap<>(getTags()); - - tags.put(ReservedField.METRIC.getKey(), getMetric()); + try { return MessageFormat.format(pattern, start, end, sb.toString(), toTagParameterArray(tags)); } catch (UnsupportedEncodingException ex) { diff --git a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/MetricTransform.java b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/MetricTransform.java index 8c94e2f70..b75883620 100644 --- a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/MetricTransform.java +++ b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/MetricTransform.java @@ -89,15 +89,16 @@ public Metric deserialize(JsonParser jp, DeserializationContext dc) throws IOExc Map meta = fromMeta(tags.get(ReservedField.META.getKey())); String tsdbMetricName = node.get("metric").asText(); - String scope = tsdbService.getScopeFromTSDBMetric(tsdbMetricName); - String namespace = tsdbService.getNamespaceFromTSDBMetric(tsdbMetricName); - + // Post filtering metric , since in some cases TSDB metric can be empty https://github.com/OpenTSDB/opentsdb/issues/540 - if (scope.isEmpty()) { + if (tsdbMetricName.isEmpty()) { return null; } - String metric = tags.get(ReservedField.METRIC.getKey()); + String scope = DefaultTSDBService.getScopeFromTSDBMetric(tsdbMetricName); + String metric = DefaultTSDBService.getMetricFromTSDBMetric(tsdbMetricName); + String namespace = DefaultTSDBService.getNamespaceFromTSDBMetric(tsdbMetricName); + Map userTags = new HashMap<>(); for (Map.Entry entry : tags.entrySet()) { @@ -171,7 +172,7 @@ public void serialize(Metric metric, JsonGenerator jgen, SerializerProvider sp) for (Map.Entry entry : datapoints.entrySet()) { jgen.writeStartObject(); - jgen.writeStringField("metric", tsdbService.constructTSDBMetricName(metric.getScope(), metric.getNamespace())); + jgen.writeStringField("metric", DefaultTSDBService.constructTSDBMetricName(metric)); jgen.writeNumberField("timestamp", entry.getKey()); jgen.writeStringField("value", entry.getValue()); serializeTags(metric, jgen); @@ -184,7 +185,7 @@ private void serializeTags(Metric metric, JsonGenerator jgen) throws IOException Map tags = new HashMap<>(metric.getTags()); - tags.put(ReservedField.METRIC.getKey(), metric.getMetric()); + //tags.put(ReservedField.METRIC.getKey(), metric.getMetric()); tags.put(ReservedField.META.getKey(), toMeta(metric)); for (Map.Entry tagEntry : tags.entrySet()) { jgen.writeStringField(tagEntry.getKey(), tagEntry.getValue()); diff --git a/ArgusCore/src/main/javacc/MetricReader.jj b/ArgusCore/src/main/javacc/MetricReader.jj index c2dd833ff..51b3e44ad 100644 --- a/ArgusCore/src/main/javacc/MetricReader.jj +++ b/ArgusCore/src/main/javacc/MetricReader.jj @@ -120,7 +120,6 @@ SKIP : { "\n" | "\r" | "\r\n" } TOKEN : { < #TSDB_ALLOWED_TEXT : ( | | | | | | | | | | )+ > } TOKEN : { < #TAGK : > } -//TOKEN : { < #TAGV : ()* > } TOKEN : { < #TAGV : > } TOKEN : { < #TAG : "=" > } TOKEN : { < #DIGIT : ["0"-"9"] > } @@ -203,7 +202,7 @@ TOKEN : { < AGGREGATOR : "avg" | "sum" | "min" | "max" | "dev" | "zimsum" | "min TOKEN : { < TIME : ()+ | ()+ > } TOKEN : { < DOWNSAMPLER : ()+ > } -TOKEN : { < NAMESPACE : > } +TOKEN : { < NAMESPACE : > } TOKEN : { < SCOPE : > } TOKEN : { < METRIC : > } TOKEN : { < TAGS : ()* > } @@ -472,6 +471,18 @@ private List evaluateFunction(String functionName, List result, List expression(long offsetInMillis, boolean syntaxOnly, Class clazz) : { Long startTimestamp = null; @@ -485,14 +496,14 @@ private List expression(long offsetInMillis, boolean syntaxOnly, Class cla Long downsamplingPeriod = null; String downsampleTokenStr = null; } -{ +{ startTimestamp = getTime() (endTimestamp = getTime())? - (namespace = getNamespace())? scope = getString() metric = getString() ( tags = getTags() )? aggregator = getAggregator() - (downsampleTokenStr = getDownsampleToken())? + (LOOKAHEAD(2) downsampleTokenStr = getDownsampleToken())? + (namespace = getString())? { if(MetricQuery.class.equals(clazz)) { downsampler = downsampleTokenStr != null ? getDownsampler(downsampleTokenStr) : null; @@ -568,6 +579,9 @@ private String getString() : | t = { return t.image; } + | + t = + { return t.image; } | t = { return t.image; } diff --git a/ArgusCore/src/test/java/com/salesforce/dva/argus/service/NamespaceServiceTest.java b/ArgusCore/src/test/java/com/salesforce/dva/argus/service/NamespaceServiceTest.java index 4823f0e8e..79c62ce8e 100644 --- a/ArgusCore/src/test/java/com/salesforce/dva/argus/service/NamespaceServiceTest.java +++ b/ArgusCore/src/test/java/com/salesforce/dva/argus/service/NamespaceServiceTest.java @@ -34,26 +34,18 @@ import com.salesforce.dva.argus.AbstractTest; import com.salesforce.dva.argus.entity.Namespace; import com.salesforce.dva.argus.entity.PrincipalUser; -import com.salesforce.dva.argus.service.metric.MetricReader; import com.salesforce.dva.argus.system.SystemException; + import org.junit.Before; import org.junit.Test; -import java.text.MessageFormat; + +import java.math.BigInteger; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; public class NamespaceServiceTest extends AbstractTest { - - private static final String exp_all_fileds_with_namespace = "123000:234000:{0}:na1:app_record.count'{'tagk=tagv'}':avg:15m-avg"; - private static final String exp_without_downsampler_with_namespace = "123000:234000:{0}:na1:app_record.count'{'tak=tagv'}':avg"; - private static final String exp_without_tags_with_namespace = "123000:234000:{0}:na1:app_record.count:avg:15m-avg"; - private static final String exp_without_tags_and_downsampler_with_namespace = "123000:234000:{0}:na1:app_record.count:avg"; - private static final String exp_without_endTs_with_namespace = "123000:{0}:na1:app_record.count'{'tagk=tagv'}':avg:15m-avg"; - private static final String exp_without_endTs_and_downsampler_with_namespace = "123000:" + NamespaceService.NAMEPSACE_PREFIX + - "12345__:na1:app_record.count{tagk=tagv}:avg"; - private static final String exp_without_endTs_and_tags_with_namespace = "123000:" + NamespaceService.NAMEPSACE_PREFIX + - "123____:na1:app_record.count:avg:15m-avg"; + private NamespaceService _namespaceService; private UserService _userService; @@ -64,27 +56,12 @@ public void setupNamespaceServiceTest() { } @Test - public void testNamespaceGeneratedWithProperPrefix() { - PrincipalUser user = _userService.findAdminUser(); - Namespace namespace = new Namespace("namespace", user); - - namespace = _namespaceService.createNamespace(namespace); - assertTrue(namespace.getQualifier().startsWith(NamespaceService.NAMEPSACE_PREFIX)); - } - - @Test - public void testMetricExpressionWithNamespace() { + public void testCreateNamespace() { PrincipalUser user = _userService.findAdminUser(); Namespace namespace = new Namespace("namespace", user); namespace = _namespaceService.createNamespace(namespace); - assertTrue(MetricReader.isValid(MessageFormat.format(exp_all_fileds_with_namespace, namespace.getQualifier()))); - assertTrue(MetricReader.isValid(MessageFormat.format(exp_without_downsampler_with_namespace, namespace.getQualifier()))); - assertTrue(MetricReader.isValid(MessageFormat.format(exp_without_tags_with_namespace, namespace.getQualifier()))); - assertTrue(MetricReader.isValid(MessageFormat.format(exp_without_tags_and_downsampler_with_namespace, namespace.getQualifier()))); - assertTrue(MetricReader.isValid(MessageFormat.format(exp_without_endTs_with_namespace, namespace.getQualifier()))); - assertTrue(MetricReader.isValid(exp_without_endTs_and_downsampler_with_namespace)); - assertTrue(MetricReader.isValid(exp_without_endTs_and_tags_with_namespace)); + assertTrue(namespace.getId() != null && namespace.getId().compareTo(BigInteger.ZERO) > 0); } @Test(expected = SystemException.class) diff --git a/ArgusCore/src/test/resources/com/salesforce/dva/argus/service/metric/MetricReaderTest.testInvalidExpressions.properties b/ArgusCore/src/test/resources/com/salesforce/dva/argus/service/metric/MetricReaderTest.testInvalidExpressions.properties index c83d2c2a1..cbb4f4d90 100644 --- a/ArgusCore/src/test/resources/com/salesforce/dva/argus/service/metric/MetricReaderTest.testInvalidExpressions.properties +++ b/ArgusCore/src/test/resources/com/salesforce/dva/argus/service/metric/MetricReaderTest.testInvalidExpressions.properties @@ -1,6 +1,6 @@ expression-missing-aggregator=IDENTITY(123000:234000:na1:app_record.count{tagk=tagv}) expression-missing-scope=IDENTITY(123000:234000:app_record.count{tagk=tagv}:avg) expression-with-incorrect-tagkey-value-separator=-5h:argus.jvm:mem.physical.free{host:localhost}:avg -expression-all-fields-with-incorrect-namespace=123000:234000:namespace:na1:app_record.count{tagk=tagv}:avg:15m-avg +expression-all-fields-with-incorrect-namespace=123000:234000:na1:app_record.count{tagk=tagv}:avg:15m-avg:123 expression-colon-separator-within-tags=-3h:-1h:dc_log_hub.na26.was:size{core_host:na26-cbatch2-1-was}:max:30m-max diff --git a/ArgusCore/src/test/resources/com/salesforce/dva/argus/service/metric/MetricReaderTest.testValidExpressions.properties b/ArgusCore/src/test/resources/com/salesforce/dva/argus/service/metric/MetricReaderTest.testValidExpressions.properties index 30b1fedce..24fbfe1a3 100644 --- a/ArgusCore/src/test/resources/com/salesforce/dva/argus/service/metric/MetricReaderTest.testValidExpressions.properties +++ b/ArgusCore/src/test/resources/com/salesforce/dva/argus/service/metric/MetricReaderTest.testValidExpressions.properties @@ -1,4 +1,9 @@ -exp-all-fileds=123000:234000:na1:app_record.count{tagk=tagv}:avg:15m-avg +exp-all-fileds=123000:234000:scope:metric{tagk=tagv}:avg:15m-avg:namespace +exp-without-downsampler-with-namespace=123000:234000:na1:app_record.count{tak=tagv}:avg:namepsace +exp-all-fileds4=123000:234000:scope:metric:avg:15m-avg:namespace +exp-all-fileds6=123000:234000:scope:metric:avg:namespace + +exp-without-namespace=123000:234000:scope:metric{tagk=tagv}:avg:15m-avg exp-without-downsampler=123000:234000:na1:app_record.count{tak=tagv}:avg exp-without-tags=123000:234000:na1:app_record.count:avg:15m-avg exp-without-tags-and-downsampler=123000:234000:na1:app_record.count:avg