未验证 提交 53e42bce 编写于 作者: G Gao Hongtao 提交者: GitHub

Insert group name into services of so11y and istio relevant metrics (#5897)

上级 127782f1
...@@ -54,10 +54,14 @@ Release Notes. ...@@ -54,10 +54,14 @@ Release Notes.
* Fix "transaction too large error" when use TiDB as storage. * Fix "transaction too large error" when use TiDB as storage.
* Add otel rules to ui template to observe Istio control plane. * Add otel rules to ui template to observe Istio control plane.
* Remove istio mixer * Remove istio mixer
* Insert group name into services of so11y and istio relevant metrics
#### UI #### UI
* Fix incorrect label in radial chart in topology. * Fix incorrect label in radial chart in topology.
* Replace node-sass with dart-sass. * Replace node-sass with dart-sass.
* Replace serviceFilter with serviceGroup
* Removed "Les Miserables" from radial chart in topology.
* Add the Promise dropdown option
#### Documentation #### Documentation
* Add VNode FAQ doc. * Add VNode FAQ doc.
......
...@@ -46,10 +46,10 @@ staticConfig: ...@@ -46,10 +46,10 @@ staticConfig:
# Labels assigned to all metrics fetched from the targets. # Labels assigned to all metrics fetched from the targets.
labels: labels:
[ <labelname>: <labelvalue> ... ] [ <labelname>: <labelvalue> ... ]
# insert group_name into metric name, for example, meter_<group_name>_<raw_metric_name> # expSuffix is appended to all expression in this file.
group: <group_name> expSuffix: <string>
# default metric level function appends to all expression in this file. # insert metricPrefix into metric name: <metricPrefix>_<raw_metric_name>
defaultMetricLevel: <exp> metricPrefix: <string>
# Metrics rule allow you to recompute queries. # Metrics rule allow you to recompute queries.
metricsRules: metricsRules:
[ - <metric_rules> ] [ - <metric_rules> ]
......
...@@ -48,9 +48,9 @@ public class MetricConvert { ...@@ -48,9 +48,9 @@ public class MetricConvert {
private final List<Analyzer> analyzers; private final List<Analyzer> analyzers;
public MetricConvert(Rule rule, MeterSystem service) { public MetricConvert(Rule rule, MeterSystem service) {
Preconditions.checkState(!Strings.isNullOrEmpty(rule.getGroup())); Preconditions.checkState(!Strings.isNullOrEmpty(rule.getMetricPrefix()));
this.analyzers = rule.getMetricsRules().stream().map(r -> Analyzer.build(formatMetricName(rule, r.getName()), this.analyzers = rule.getMetricsRules().stream().map(r -> Analyzer.build(formatMetricName(rule, r.getName()),
Strings.isEmpty(rule.getDefaultMetricLevel()) ? r.getExp() : String.format("(%s).%s", r.getExp(), rule.getDefaultMetricLevel()), service)) Strings.isEmpty(rule.getExpSuffix()) ? r.getExp() : String.format("(%s).%s", r.getExp(), rule.getExpSuffix()), service))
.collect(toList()); .collect(toList());
} }
...@@ -75,7 +75,7 @@ public class MetricConvert { ...@@ -75,7 +75,7 @@ public class MetricConvert {
private String formatMetricName(Rule rule, String meterRuleName) { private String formatMetricName(Rule rule, String meterRuleName) {
StringJoiner metricName = new StringJoiner("_"); StringJoiner metricName = new StringJoiner("_");
metricName.add("meter").add(rule.getGroup()).add(meterRuleName); metricName.add(rule.getMetricPrefix()).add(meterRuleName);
return metricName.toString(); return metricName.toString();
} }
} }
...@@ -33,7 +33,7 @@ public class Rule { ...@@ -33,7 +33,7 @@ public class Rule {
private String fetcherTimeout; private String fetcherTimeout;
private String metricsPath; private String metricsPath;
private StaticConfig staticConfig; private StaticConfig staticConfig;
private String group; private String metricPrefix;
private String defaultMetricLevel; private String expSuffix;
private List<MetricsRule> metricsRules; private List<MetricsRule> metricsRules;
} }
...@@ -81,6 +81,13 @@ public class FunctionTest { ...@@ -81,6 +81,13 @@ public class FunctionTest {
Result.success(SampleFamily.build(Sample.builder().labels(of("region", "zh")).build())), Result.success(SampleFamily.build(Sample.builder().labels(of("region", "zh")).build())),
false, false,
}, },
{
"tag-append",
of("instance_cpu_percentage", SampleFamily.build(Sample.builder().labels(of("region", "us")).build())),
"instance_cpu_percentage.tag({tags -> tags.region = 'prefix::' + tags.region})",
Result.success(SampleFamily.build(Sample.builder().labels(of("region", "prefix::us")).build())),
false,
},
{ {
"histogram", "histogram",
of("instance_cpu_percentage", SampleFamily.build( of("instance_cpu_percentage", SampleFamily.build(
......
...@@ -38,8 +38,8 @@ staticConfig: ...@@ -38,8 +38,8 @@ staticConfig:
sslCaFilePath: sslCaFilePath:
labels: labels:
service: oap-server service: oap-server
defaultMetricLevel: instance(['service'], ['instance']) expSuffix: tag({tags -> tags.service = 'oap::' + tags.service}).instance(['service'], ['instance'])
group: oap metricPrefix: meter_oap
metricsRules: metricsRules:
- name: instance_cpu_percentage - name: instance_cpu_percentage
exp: (process_cpu_seconds_total * 100).sum(['service', 'instance']).rate('PT1M') exp: (process_cpu_seconds_total * 100).sum(['service', 'instance']).rate('PT1M')
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
# </pre> # </pre>
group: istio group: istio
defaultMetricLevel: service(['cluster', 'app']) defaultMetricLevel: service(['cluster', 'app'])
expSuffix: tag({tags -> tags.cluster = 'istio-ctrl::' + tags.cluster}).service(['cluster', 'app'])
metricPrefix: meter_istio
metricsRules: metricsRules:
## Resource usage ## Resource usage
# Pilot Versions # Pilot Versions
......
...@@ -28,9 +28,8 @@ ...@@ -28,9 +28,8 @@
# "-P6H3M" -- parses as "-6 hours and -3 minutes" # "-P6H3M" -- parses as "-6 hours and -3 minutes"
# "-P-6H+3M" -- parses as "+6 hours and -3 minutes" # "-P-6H+3M" -- parses as "+6 hours and -3 minutes"
# </pre> # </pre>
group: oap expSuffix: tag({tags -> tags.service = 'oap::' + tags.service}).instance(['service'], ['host_name'])
# Self-monitoring defaults to prometheus fetcher. metricPrefix: meter_oap
defaultMetricLevel: instance(['service'], ['host_name'])
metricsRules: metricsRules:
- name: instance_cpu_percentage - name: instance_cpu_percentage
exp: (process_cpu_seconds_total * 100).sum(['service', 'host_name']).rate('PT1M') exp: (process_cpu_seconds_total * 100).sum(['service', 'host_name']).rate('PT1M')
......
...@@ -30,6 +30,7 @@ templates: ...@@ -30,6 +30,7 @@ templates:
{ {
"name": "Istio", "name": "Istio",
"type": "service", "type": "service",
"serviceGroup": "istio-ctrl",
"children": [ "children": [
{ {
"name": "Control Plane", "name": "Control Plane",
......
...@@ -26,6 +26,7 @@ templates: ...@@ -26,6 +26,7 @@ templates:
{ {
"name": "SelfObservability", "name": "SelfObservability",
"type": "service", "type": "service",
"serviceGroup": "oap",
"children": [ "children": [
{ {
"name": "oap-server", "name": "oap-server",
......
Subproject commit 00fedacc5fe842f44952f58719fc6a9659147367 Subproject commit eb7717e9daf5dd13eb561c4905301017470ec528
...@@ -101,7 +101,7 @@ public class PythonE2E extends SkyWalkingTestAdapter { ...@@ -101,7 +101,7 @@ public class PythonE2E extends SkyWalkingTestAdapter {
@RetryableTest @RetryableTest
void services() throws Exception { void services() throws Exception {
List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now())); List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now()));
services = services.stream().filter(s -> !s.getLabel().equals("oap-server")).collect(Collectors.toList()); services = services.stream().filter(s -> !s.getLabel().equals("oap::oap-server")).collect(Collectors.toList());
LOGGER.info("services: {}", services); LOGGER.info("services: {}", services);
load("expected/python/services.yml").as(ServicesMatcher.class).verify(services); load("expected/python/services.yml").as(ServicesMatcher.class).verify(services);
......
...@@ -109,7 +109,7 @@ public class KafkaE2E extends SkyWalkingTestAdapter { ...@@ -109,7 +109,7 @@ public class KafkaE2E extends SkyWalkingTestAdapter {
void services() throws Exception { void services() throws Exception {
List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now())); List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now()));
services = services.stream().filter(s -> !s.getLabel().equals("oap-server")).collect(Collectors.toList()); services = services.stream().filter(s -> !s.getLabel().equals("oap::oap-server")).collect(Collectors.toList());
LOGGER.info("services: {}", services); LOGGER.info("services: {}", services);
load("expected/simple/services.yml").as(ServicesMatcher.class).verify(services); load("expected/simple/services.yml").as(ServicesMatcher.class).verify(services);
...@@ -171,7 +171,7 @@ public class KafkaE2E extends SkyWalkingTestAdapter { ...@@ -171,7 +171,7 @@ public class KafkaE2E extends SkyWalkingTestAdapter {
void so11y() throws Exception { void so11y() throws Exception {
List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now())); List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now()));
services = services.stream().filter(s -> s.getLabel().equals("oap-server")).collect(Collectors.toList()); services = services.stream().filter(s -> s.getLabel().equals("oap::oap-server")).collect(Collectors.toList());
LOGGER.info("services: {}", services); LOGGER.info("services: {}", services);
load("expected/simple/so11y-services.yml").as(ServicesMatcher.class).verify(services); load("expected/simple/so11y-services.yml").as(ServicesMatcher.class).verify(services);
for (final Service service : services) { for (final Service service : services) {
......
...@@ -77,7 +77,7 @@ public class MeterE2E extends SkyWalkingTestAdapter { ...@@ -77,7 +77,7 @@ public class MeterE2E extends SkyWalkingTestAdapter {
void meters() throws Exception { void meters() throws Exception {
List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now())); List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now()));
services = services.stream().filter(s -> !s.getLabel().equals("oap-server")).collect(Collectors.toList()); services = services.stream().filter(s -> !s.getLabel().equals("oap::oap-server")).collect(Collectors.toList());
LOGGER.info("services: {}", services); LOGGER.info("services: {}", services);
load("expected/meter/services.yml").as(ServicesMatcher.class).verify(services); load("expected/meter/services.yml").as(ServicesMatcher.class).verify(services);
......
...@@ -141,7 +141,7 @@ public class SimpleE2E extends SkyWalkingTestAdapter { ...@@ -141,7 +141,7 @@ public class SimpleE2E extends SkyWalkingTestAdapter {
void services() throws Exception { void services() throws Exception {
List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now())); List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now()));
services = services.stream().filter(s -> !s.getLabel().equals("oap-server")).collect(Collectors.toList()); services = services.stream().filter(s -> !s.getLabel().equals("oap::oap-server")).collect(Collectors.toList());
LOGGER.info("services: {}", services); LOGGER.info("services: {}", services);
load("expected/simple/services.yml").as(ServicesMatcher.class).verify(services); load("expected/simple/services.yml").as(ServicesMatcher.class).verify(services);
...@@ -203,7 +203,7 @@ public class SimpleE2E extends SkyWalkingTestAdapter { ...@@ -203,7 +203,7 @@ public class SimpleE2E extends SkyWalkingTestAdapter {
void so11y() throws Exception { void so11y() throws Exception {
List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now())); List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now()));
services = services.stream().filter(s -> s.getLabel().equals("oap-server")).collect(Collectors.toList()); services = services.stream().filter(s -> s.getLabel().equals("oap::oap-server")).collect(Collectors.toList());
LOGGER.info("services: {}", services); LOGGER.info("services: {}", services);
load("expected/simple/so11y-services.yml").as(ServicesMatcher.class).verify(services); load("expected/simple/so11y-services.yml").as(ServicesMatcher.class).verify(services);
for (final Service service : services) { for (final Service service : services) {
......
...@@ -123,7 +123,7 @@ public class StorageE2E extends SkyWalkingTestAdapter { ...@@ -123,7 +123,7 @@ public class StorageE2E extends SkyWalkingTestAdapter {
void services() throws Exception { void services() throws Exception {
List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now())); List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now()));
services = services.stream().filter(s -> !s.getLabel().equals("oap-server")).collect(Collectors.toList()); services = services.stream().filter(s -> !s.getLabel().equals("oap::oap-server")).collect(Collectors.toList());
LOGGER.info("services: {}", services); LOGGER.info("services: {}", services);
load("expected/storage/services.yml").as(ServicesMatcher.class).verify(services); load("expected/storage/services.yml").as(ServicesMatcher.class).verify(services);
...@@ -233,7 +233,7 @@ public class StorageE2E extends SkyWalkingTestAdapter { ...@@ -233,7 +233,7 @@ public class StorageE2E extends SkyWalkingTestAdapter {
void so11y() throws Exception { void so11y() throws Exception {
List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now())); List<Service> services = graphql.services(new ServicesQuery().start(startTime).end(now()));
services = services.stream().filter(s -> s.getLabel().equals("oap-server")).collect(Collectors.toList()); services = services.stream().filter(s -> s.getLabel().equals("oap::oap-server")).collect(Collectors.toList());
LOGGER.info("services: {}", services); LOGGER.info("services: {}", services);
load("expected/simple/so11y-services.yml").as(ServicesMatcher.class).verify(services); load("expected/simple/so11y-services.yml").as(ServicesMatcher.class).verify(services);
for (final Service service : services) { for (final Service service : services) {
......
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
services: services:
- key: not null - key: not null
label: "oap-server" label: "oap::oap-server"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册