Label Formatting
Use the label-format
setting to customize series labels displayed in the widget legend as an alternative to specifying a custom label for each series.
The default label-format
pattern is:
entity: metric: tags: statistics: period: dataType - forecastName: rate
Supported keywords in the label-format
pattern are:
entity
metric
tags
: Semicolon-separated list of alltag=value
pairs.tagName
: Semicolon-separated list of all tag names.tagValue
: Semicolon-separated list of all tag values.tags.tagName
: Value of tag with nametagName
.statistics
period
dataType
forecastName
rate
label
: Value of the label setting in the current series.alias
: Value of the alias setting in the current series.value
: Formatted last value of the current series.
Create a new label format configuration using a combination of the supported keywords.
label-format = statistics : metric
See Examples for other usage.
String Functions
Invoke built-in string functions to format series fields.
Function | Description |
---|---|
keepAfter | Removes part of the string before the first occurrence of the given substring. |
keepAfterLast | Removes part of the string before the last occurrence of the given substring. |
keepbefore | Removes part of the string that starts with the first occurrence of the given substring. |
keepBeforeLast | Removes part of the string that starts with the last occurrence of the given substring. |
replace | Replace all occurrences of the given string in the original string with another string. |
capFirst | Capitalize first word. |
capitalize | Capitalize all words. |
coalesce | Returns the first object from arguments that is not undefined , not null and not empty.Returns an empty string "" if all elements are null or empty.Alias: ifEmpty |
lowerCase | Convert to lower case. |
upperCase | Convert to upper case. |
removeBeginning | Removes the given substring from the beginning of the string. |
removeEnding | Removes the given substring from the end of the string. |
label-format = javascript:keepAfterLast(tags.logger, '.')
#returns AuthenticationFilter
[series]
[tags]
logger = com.axibase.app.web.AuthenticationFilter
Use nested functions to apply multiple format settings.
label-format = javascript:capitalize(replace(metric, '_', ' '))
/* replace underscores with whitespace and capitalize all words */
[series]
metric = swap_space_used
#swap_space_used -> Swap Space Used
Metadata
Use the label-format
setting to replace entity
and metric
names with labels loaded from metadata.
Include the addMeta = true
expression on the [configuration]
level.
[configuration]
add-meta = true
/* Format label using metadata identifiers */
label-format = javascript: [coalesce(meta.entity.label, entity), ifEmpty(meta.metric.label, metric), ifEmpty(tags), (statistics && statistics !== "detail" ? statistics : ""), (period ? " - " + period : ""), ifEmpty(dataType), (rate ? " ∇ " + rate : "")].filter(s => s !== "").join(": ")
Examples
entity
label-format = entity
/* Display only the entity name in the legend */
[series]
entity = nurswgvml007
metric = cpu_busy
[series]
entity = nurswgvml006
metric = cpu_busy
tags.tagName
label-format = tags.mount_point
/* Displays labels from tag mount_point in the legend */
[series]
entity = nurswgvml006
metric = disk_used_percent
[tags]
mount_point = *
file_system = *
entity : tagValue
label-format = entity: tagValue
/* Displays labels from entity followed by tagValue in the legend */
[tags]
mount_point = /
[series]
entity = nurswgvml006
value
label-format = entity\ntags.mount_point\nvalue
/* Displays labels from entity followed by tagValue and last value in the legend */
metric = disk_used_percent
entity = nurswgvml0*
tag-expression = tags.mount_point not like '/mnt*'