提交 5f57e561 编写于 作者: wu-sheng's avatar wu-sheng 提交者: Gao Hongtao

Provide grafana settings for telemetry (#2138)

* Change a label name for  sw instance to avoid confict.

* Fix a wrong metric name.

* Fix too many counter instances.

* Set uptime to second.

* Fix format.

* Fix format

* Remove two unnecessary counter.

* Provide grafana dashboard settings and remove unnecessary metric.

* Provide a simple UI brief doc. Fix #2137
上级 6499d4f5
......@@ -20,4 +20,4 @@ SkyWalking already support.
- [Observability Analysis Language](oal.md). Introduces the core languages, which is designed for aggregation behaviour definition.
- [Query in OAP](../protocols/README.md#query-protocol). A set of query protocol provided, based on the Observability Analysis Language metric definition.
- UI
- [Overview](ui-overview.md).
- [Overview](ui-overview.md). A simple brief about SkyWalking UI.
# Visualization
SkyWalking native UI provides the default visualization solution.
It provides observability related graphs
about overview, service, service instance, endpoint, trace and alarm,
including topology, dependency graph, heatmap, etc.
For most open source users, this UI solution should be good enough to use.
And you have other open source options in visualization.
See [UI setup](../setup/backend/ui-setup.md).
Also, we have already known, many of our users have integrated SkyWalking
into their products.
If you want to do that too, please use [SkyWalking query protocol](../protocols/README.md#query-protocol).
\ No newline at end of file
......@@ -5,16 +5,26 @@ telemetry:
none:
```
In order to open, we should set `prometheus` to provider. The endpoint open at http://0.0.0.0:1234/
## Prometheus
Prometheus is supported as telemetry implementor.
By using this, prometheus collects metric from skywalking backend.
Set `prometheus` to provider. The endpoint open at `http://0.0.0.0:1234/` and `http://0.0.0.0:1234/metrics`.
```yaml
telemetry:
prometheus:
```
You could set host and port
Set host and port if needed.
```yaml
telemetry:
prometheus:
host: 127.0.0.1
port: 1543
```
\ No newline at end of file
```
### Grafana Visualization
Provide two grafana dashboard settings.
1. Use [SkyWalking trace-mode dashboard](telemetry/trace-mode-grafana.json) when SkyWalking is used with tracing agent.
1. Use [SkyWalking mesh-mode dashboard](telemetry/mesh-mode-grafana.json) when SkyWalking is used with service mesh
telemetry, including istio, envoy.
\ No newline at end of file
此差异已折叠。
此差异已折叠。
......@@ -38,9 +38,7 @@ public enum PersistenceTimer {
private Boolean isStarted = false;
private final Boolean debug;
private CounterMetric errorCounter;
private CounterMetric prepareCounter;
private HistogramMetric prepareLatency;
private CounterMetric executeCounter;
private HistogramMetric executeLatency;
PersistenceTimer() {
......@@ -57,12 +55,8 @@ public enum PersistenceTimer {
MetricCreator metricCreator = moduleManager.find(TelemetryModule.NAME).provider().getService(MetricCreator.class);
errorCounter = metricCreator.createCounter("persistence_timer_bulk_error_count", "Error execution of the prepare stage in persistence timer",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
prepareCounter = metricCreator.createCounter("persistence_timer_bulk_prepare_count", "Execution of the prepare stage in persistence timer",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
prepareLatency = metricCreator.createHistogramMetric("persistence_timer_bulk_prepare_latency", "Latency of the prepare stage in persistence timer",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
executeCounter = metricCreator.createCounter("persistence_timer_bulk_execute_count", "Execution of the execute stage in persistence timer",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
executeLatency = metricCreator.createHistogramMetric("persistence_timer_bulk_execute_latency", "Latency of the execute stage in persistence timer",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
......@@ -83,7 +77,6 @@ public enum PersistenceTimer {
long startTime = System.currentTimeMillis();
try {
prepareCounter.inc();
HistogramMetric.Timer timer = prepareLatency.createTimer();
List batchAllCollection = new LinkedList();
......@@ -114,7 +107,6 @@ public enum PersistenceTimer {
timer.finish();
}
executeCounter.inc();
HistogramMetric.Timer executeLatencyTimer = executeLatency.createTimer();
try {
batchDAO.batchPersistence(batchAllCollection);
......
......@@ -28,13 +28,10 @@ import org.slf4j.*;
public class MeshGRPCHandler extends ServiceMeshMetricServiceGrpc.ServiceMeshMetricServiceImplBase {
private static final Logger logger = LoggerFactory.getLogger(MeshGRPCHandler.class);
private CounterMetric counter;
private HistogramMetric histogram;
public MeshGRPCHandler(ModuleManager moduleManager) {
MetricCreator metricCreator = moduleManager.find(TelemetryModule.NAME).provider().getService(MetricCreator.class);
counter = metricCreator.createCounter("mesh_grpc_in_count", "The count of service mesh telemetry",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
histogram = metricCreator.createHistogramMetric("mesh_grpc_in_latency", "The process latency of service mesh telemetry",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
}
......@@ -46,7 +43,6 @@ public class MeshGRPCHandler extends ServiceMeshMetricServiceGrpc.ServiceMeshMet
if (logger.isDebugEnabled()) {
logger.debug("Received mesh metric: {}", metric);
}
counter.inc();
HistogramMetric.Timer timer = histogram.createTimer();
try {
TelemetryDataDispatcher.preProcess(metric);
......
......@@ -101,7 +101,7 @@ public class TraceModuleProvider extends ModuleProvider {
SegmentStandardizationWorker standardizationWorker2 = new SegmentStandardizationWorker(getManager(), segmentProducer,
moduleConfig.getBufferPath(), moduleConfig.getBufferOffsetMaxFileSize(), moduleConfig.getBufferDataMaxFileSize(), moduleConfig.isBufferFileCleanWhenRestart(),
false);
true);
segmentProducerV2.setStandardizationWorker(standardizationWorker2);
} catch (IOException e) {
throw new ModuleStartException(e.getMessage(), e);
......
......@@ -37,14 +37,11 @@ public class TraceSegmentReportServiceHandler extends TraceSegmentReportServiceG
private static final Logger logger = LoggerFactory.getLogger(TraceSegmentServiceHandler.class);
private final SegmentParseV2.Producer segmentProducer;
private CounterMetric counter;
private HistogramMetric histogram;
public TraceSegmentReportServiceHandler(SegmentParseV2.Producer segmentProducer, ModuleManager moduleManager) {
this.segmentProducer = segmentProducer;
MetricCreator metricCreator = moduleManager.find(TelemetryModule.NAME).provider().getService(MetricCreator.class);
counter = metricCreator.createCounter("trace_grpc_v6_in_count", "The count of service mesh telemetry",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
histogram = metricCreator.createHistogramMetric("trace_grpc_v6_in_latency", "The process latency of service mesh telemetry",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
}
......@@ -56,7 +53,6 @@ public class TraceSegmentReportServiceHandler extends TraceSegmentReportServiceG
logger.debug("receive segment");
}
counter.inc();
HistogramMetric.Timer timer = histogram.createTimer();
try {
segmentProducer.send(segment, SegmentSource.Agent);
......
......@@ -44,9 +44,9 @@ public class SegmentParse {
private final SegmentParserListenerManager listenerManager;
private final SegmentCoreInfo segmentCoreInfo;
@Setter private SegmentStandardizationWorker standardizationWorker;
private CounterMetric traceBufferFileRetry;
private CounterMetric traceBufferFileOut;
private CounterMetric traceParseError;
private volatile static CounterMetric TRACE_BUFFER_FILE_RETRY;
private volatile static CounterMetric TRACE_BUFFER_FILE_OUT;
private volatile static CounterMetric TRACE_PARSE_ERROR;
private SegmentParse(ModuleManager moduleManager, SegmentParserListenerManager listenerManager) {
this.moduleManager = moduleManager;
......@@ -58,11 +58,11 @@ public class SegmentParse {
this.segmentCoreInfo.setV2(false);
MetricCreator metricCreator = moduleManager.find(TelemetryModule.NAME).provider().getService(MetricCreator.class);
traceBufferFileRetry = metricCreator.createCounter("v5_trace_buffer_file_retry", "The number of retry trace segment from the buffer file, but haven't registered successfully.",
TRACE_BUFFER_FILE_RETRY = metricCreator.createCounter("v5_trace_buffer_file_retry", "The number of retry trace segment from the buffer file, but haven't registered successfully.",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
traceBufferFileOut = metricCreator.createCounter("v5_trace_buffer_file_out", "The number of trace segment out of the buffer file",
TRACE_BUFFER_FILE_OUT = metricCreator.createCounter("v5_trace_buffer_file_out", "The number of trace segment out of the buffer file",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
traceParseError = metricCreator.createCounter("v5_trace_parse_error", "The number of trace segment out of the buffer file",
TRACE_PARSE_ERROR = metricCreator.createCounter("v5_trace_parse_error", "The number of trace segment out of the buffer file",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
}
......@@ -84,19 +84,19 @@ public class SegmentParse {
writeToBufferFile(segmentCoreInfo.getSegmentId(), segment);
} else {
// from SegmentSource.Buffer
traceBufferFileRetry.inc();
TRACE_BUFFER_FILE_RETRY.inc();
}
return false;
} else {
if (logger.isDebugEnabled()) {
logger.debug("This segment id exchange success, id: {}", segmentCoreInfo.getSegmentId());
}
traceBufferFileOut.inc();
TRACE_BUFFER_FILE_OUT.inc();
notifyListenerToBuild();
return true;
}
} catch (Throwable e) {
traceParseError.inc();
TRACE_PARSE_ERROR.inc();
logger.error(e.getMessage(), e);
return true;
}
......@@ -257,7 +257,12 @@ public class SegmentParse {
@Override public boolean call(UpstreamSegment segment) {
SegmentParse segmentParse = new SegmentParse(moduleManager, listenerManager);
segmentParse.setStandardizationWorker(standardizationWorker);
return segmentParse.parse(segment, Source.Buffer);
boolean parseResult = segmentParse.parse(segment, Source.Buffer);
if (parseResult) {
segmentParse.TRACE_BUFFER_FILE_OUT.inc();
}
return parseResult;
}
}
}
......@@ -47,9 +47,9 @@ public class SegmentParseV2 {
private final SegmentParserListenerManager listenerManager;
private final SegmentCoreInfo segmentCoreInfo;
@Setter private SegmentStandardizationWorker standardizationWorker;
private CounterMetric traceBufferFileRetry;
private CounterMetric traceBufferFileOut;
private CounterMetric traceParseError;
private volatile static CounterMetric TRACE_BUFFER_FILE_RETRY;
private volatile static CounterMetric TRACE_BUFFER_FILE_OUT;
private volatile static CounterMetric TRACE_PARSE_ERROR;
private SegmentParseV2(ModuleManager moduleManager, SegmentParserListenerManager listenerManager) {
this.moduleManager = moduleManager;
......@@ -60,13 +60,15 @@ public class SegmentParseV2 {
this.segmentCoreInfo.setEndTime(Long.MIN_VALUE);
this.segmentCoreInfo.setV2(true);
MetricCreator metricCreator = moduleManager.find(TelemetryModule.NAME).provider().getService(MetricCreator.class);
traceBufferFileRetry = metricCreator.createCounter("v6_trace_buffer_file_retry", "The number of retry trace segment from the buffer file, but haven't registered successfully.",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
traceBufferFileOut = metricCreator.createCounter("v6_trace_buffer_file_out", "The number of trace segment out of the buffer file",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
traceParseError = metricCreator.createCounter("v6_trace_parse_error", "The number of trace segment out of the buffer file",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
if (TRACE_BUFFER_FILE_RETRY == null) {
MetricCreator metricCreator = moduleManager.find(TelemetryModule.NAME).provider().getService(MetricCreator.class);
TRACE_BUFFER_FILE_RETRY = metricCreator.createCounter("v6_trace_buffer_file_retry", "The number of retry trace segment from the buffer file, but haven't registered successfully.",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
TRACE_BUFFER_FILE_OUT = metricCreator.createCounter("v6_trace_buffer_file_out", "The number of trace segment out of the buffer file",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
TRACE_PARSE_ERROR = metricCreator.createCounter("v6_trace_parse_error", "The number of trace segment out of the buffer file",
MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE);
}
}
public boolean parse(UpstreamSegment segment, SegmentSource source) {
......@@ -87,19 +89,19 @@ public class SegmentParseV2 {
writeToBufferFile(segmentCoreInfo.getSegmentId(), segment);
} else {
// from SegmentSource.Buffer
traceBufferFileRetry.inc();
TRACE_BUFFER_FILE_RETRY.inc();
}
return false;
} else {
if (logger.isDebugEnabled()) {
logger.debug("This segment id exchange success, id: {}", segmentCoreInfo.getSegmentId());
}
traceBufferFileOut.inc();
notifyListenerToBuild();
return true;
}
} catch (Throwable e) {
traceParseError.inc();
TRACE_PARSE_ERROR.inc();
logger.error(e.getMessage(), e);
return true;
}
......@@ -256,7 +258,12 @@ public class SegmentParseV2 {
@Override public boolean call(UpstreamSegment segment) {
SegmentParseV2 segmentParse = new SegmentParseV2(moduleManager, listenerManager);
segmentParse.setStandardizationWorker(standardizationWorker);
return segmentParse.parse(segment, SegmentSource.Buffer);
boolean parseResult = segmentParse.parse(segment, SegmentSource.Buffer);
if (parseResult) {
segmentParse.TRACE_BUFFER_FILE_OUT.inc();
}
return parseResult;
}
}
}
......@@ -20,7 +20,6 @@ package org.apache.skywalking.oap.server.starter;
import org.apache.skywalking.oap.server.core.RunningMode;
import org.apache.skywalking.oap.server.library.module.*;
import org.apache.skywalking.oap.server.library.util.TimeBucketUtils;
import org.apache.skywalking.oap.server.starter.config.*;
import org.apache.skywalking.oap.server.telemetry.TelemetryModule;
import org.apache.skywalking.oap.server.telemetry.api.*;
......@@ -45,7 +44,8 @@ public class OAPServerStartUp {
manager.find(TelemetryModule.NAME).provider().getService(MetricCreator.class).createGauge("uptime",
"oap server start up time", MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE)
.setValue(TimeBucketUtils.INSTANCE.getMinuteTimeBucket(System.currentTimeMillis()));
// Set uptime to second
.setValue(System.currentTimeMillis() / 1000);
if (RunningMode.isInitMode()) {
logger.info("OAP starts up in init mode successfully, exit now...");
......
......@@ -57,7 +57,7 @@ public abstract class BaseMetric<T extends SimpleCollector, C> {
try {
if (metricInstance == null) {
String[] labelNames = new String[labels.getKeys().length + 1];
labelNames[0] = "instance";
labelNames[0] = "sw_backend_instance";
for (int i = 0; i < labels.getKeys().length; i++) {
labelNames[i + 1] = labels.getKeys()[i];
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册