backend-telemetry.md 3.0 KB
Newer Older
1
# Telemetry for backend
2 3
By default, the telemetry is disabled by setting `selector` to `none`, like this

4 5
```yaml
telemetry:
6
  selector: ${SW_TELEMETRY:none}
7
  none:
8 9 10
  prometheus:
    host: ${SW_TELEMETRY_PROMETHEUS_HOST:0.0.0.0}
    port: ${SW_TELEMETRY_PROMETHEUS_PORT:1234}
11 12 13
    sslEnabled: ${SW_TELEMETRY_PROMETHEUS_SSL_ENABLED:false}
    sslKeyPath: ${SW_TELEMETRY_PROMETHEUS_SSL_KEY_PATH:""}
    sslCertChainPath: ${SW_TELEMETRY_PROMETHEUS_SSL_CERT_CHAIN_PATH:""}
14 15
```

16
but you can set one of `prometheus` to enable them, for more information, refer to the details below.
17

18 19
## Prometheus
Prometheus is supported as telemetry implementor. 
20
By using this, prometheus collects metrics from SkyWalking backend.
21 22

Set `prometheus` to provider. The endpoint open at `http://0.0.0.0:1234/` and `http://0.0.0.0:1234/metrics`.
23 24
```yaml
telemetry:
25
  selector: ${SW_TELEMETRY:prometheus}
26 27 28
  prometheus:
```

29
Set host and port if needed.
30 31
```yaml
telemetry:
32
  selector: ${SW_TELEMETRY:prometheus}
33 34 35
  prometheus:
    host: 127.0.0.1
    port: 1543
36 37
```

38 39 40 41 42 43 44 45 46 47 48 49 50
Set SSL relevant settings to expose a secure endpoint. Notice private key file and cert chain file could be uploaded once
changes are applied to them.
```yaml
telemetry:
  selector: ${SW_TELEMETRY:prometheus}
  prometheus:
    host: 127.0.0.1
    port: 1543
    sslEnabled: true
    sslKeyPath: /etc/ssl/key.pem
    sslCertChainPath: /etc/ssl/cert-chain.pem
```

51
### Grafana Visualization
52 53
Provide the grafana dashboard settings. Check [SkyWalking Telemetry dashboard](grafana.json) config.

54 55 56 57 58 59

## Self Observability

SkyWalking supports to collect telemetry data into OAP backend directly. Users could check them out through UI or
GraphQL API then.

60
Adding following configuration to enable self-observability related modules.
61

62
1. Setting up prometheus telemetry.
63 64
```yaml
telemetry:
65 66 67 68
  selector: ${SW_TELEMETRY:prometheus}
  prometheus:
    host: 127.0.0.1
    port: 1543
69
```
70

71
2. Setting up prometheus fetcher
72 73

```yaml
74 75 76
prometheus-fetcher:
  selector: ${SW_PROMETHEUS_FETCHER:default}
  default:
G
Gao Hongtao 已提交
77
    enabledRules: ${SW_PROMETHEUS_FETCHER_ENABLED_RULES:"self"}
78
``` 
79

80
3. Make sure `config/fetcher-prom-rules/self.yaml` exists. 
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126

Once you deploy an oap-server cluster, the target host should be replaced with a dedicated IP or hostname. For instances,
there are three oap server in your cluster, their host is `service1`, `service2` and `service3` respectively. You should
update each `self.yaml` to twist target host.

service1: 
```yaml
fetcherInterval: PT15S
fetcherTimeout: PT10S
metricsPath: /metrics
staticConfig:
  # targets will be labeled as "instance"
  targets:
    - service1:1234
  labels:
    service: oap-server
...
```

service2: 
```yaml
fetcherInterval: PT15S
fetcherTimeout: PT10S
metricsPath: /metrics
staticConfig:
  # targets will be labeled as "instance"
  targets:
    - service2:1234
  labels:
    service: oap-server
...
```

service3: 
```yaml
fetcherInterval: PT15S
fetcherTimeout: PT10S
metricsPath: /metrics
staticConfig:
  # targets will be labeled as "instance"
  targets:
    - service3:1234
  labels:
    service: oap-server
...
```