Class TimeseriesUtils
- java.lang.Object
-
- org.opennms.netmgt.timeseries.util.TimeseriesUtils
-
public final class TimeseriesUtils extends java.lang.Object
Utility functions and constants.- Author:
- jwhite
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
WILDCARD_INDEX
static int
WILDCARD_INDEX_NO
-
Constructor Summary
Constructors Constructor Description TimeseriesUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addIndicesToAttributes(ResourcePath path, java.util.Map<java.lang.String,java.lang.String> attributes)
Extends the attribute map with indices used by theTimeseriesResourceStorageDao
.static org.opennms.integration.api.v1.timeseries.Sample
createSampleForIndexingStrings(java.lang.String resourceId, java.util.Map<java.lang.String,java.lang.String> attributes)
Creates a sample used to index string attributes.static java.lang.String
toMetricName(java.lang.String resourceId)
Extracts the metric name from the resource id.static java.lang.String
toResourceId(ResourcePath path)
Converts aResourcePath
to a Newts resource id.static ResourcePath
toResourcePath(java.lang.String resourceId)
Converts a Newts resource id to aResourcePath
.
-
-
-
Field Detail
-
WILDCARD_INDEX_NO
public static final int WILDCARD_INDEX_NO
- See Also:
- Constant Field Values
-
WILDCARD_INDEX
public static final java.lang.String WILDCARD_INDEX
- See Also:
- Constant Field Values
-
-
Method Detail
-
addIndicesToAttributes
public static void addIndicesToAttributes(ResourcePath path, java.util.Map<java.lang.String,java.lang.String> attributes)
Extends the attribute map with indices used by theTimeseriesResourceStorageDao
. A resource path of the form [a, b, c, d] will be indexed with:- _idx1: (a, 4)
- _idx2: (a:b, 4)
- _idx2w=(a:b,*) // wildcard index to query for all resources under that resource
- _idx3: (a:b:c, 4)
-
toResourceId
public static java.lang.String toResourceId(ResourcePath path)
Converts aResourcePath
to a Newts resource id.- Parameters:
path
- path to convert- Returns:
- Newts resource id
-
toResourcePath
public static ResourcePath toResourcePath(java.lang.String resourceId)
Converts a Newts resource id to aResourcePath
.- Parameters:
resourceId
- Newts resource id- Returns:
- path
-
toMetricName
public static java.lang.String toMetricName(java.lang.String resourceId)
Extracts the metric name from the resource id.- Parameters:
resourceId
- Newts resource id- Returns:
- metric name
-
createSampleForIndexingStrings
public static org.opennms.integration.api.v1.timeseries.Sample createSampleForIndexingStrings(java.lang.String resourceId, java.util.Map<java.lang.String,java.lang.String> attributes)
Creates a sample used to index string attributes. These should only be index and not be persisted.
-
-