Add webhook/gRPC hooks settings example for backend-alarm.md. (#11658)

This commit is contained in:
Wan Kai 2023-12-15 09:52:12 +08:00 committed by GitHub
parent 0e4c0333e0
commit e57dee45fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -20,5 +20,6 @@
* Update the release doc to remove the announcement as the tests are through e2e rather than manually.
* Update the release notification mail a little.
* Polish docs structure. Move customization docs separately from the introduction docs.
* Add webhook/gRPC hooks settings example for `backend-alarm.md`.
All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/202?closed=1)

View File

@ -163,7 +163,17 @@ hooks:
Currently, SkyWalking supports the following hook types:
### Webhook
The Webhook requires the peer to be a web container. The alarm message will be sent through HTTP post by `application/json` content type. The JSON format is based on `List<org.apache.skywalking.oap.server.core.alarm.AlarmMessage>` with the following key information:
The Webhook requires the peer to be a web container. The alarm message will be sent through HTTP post by `application/json` content type after you have set up Webhook hooks as follows:
```yml
webhook:
default:
is-default: true
urls:
- http://ip:port/xxx
- http://ip:port/yyy
```
The JSON format is based on `List<org.apache.skywalking.oap.server.core.alarm.AlarmMessage>` with the following key information:
- **scopeId**, **scope**. All scopes are defined in `org.apache.skywalking.oap.server.core.source.DefaultScopeDefine`.
- **name**. Target scope entity name. Please follow the [entity name definitions](#entity-name).
- **id0**. The ID of the scope entity that matches with the name. When using the relation scope, it is the source entity ID.
@ -205,7 +215,15 @@ See the following example:
```
### gRPC
The alarm message will be sent through remote gRPC method by `Protobuf` content type.
The alarm message will be sent through remote gRPC method by `Protobuf` content type after you have set up gRPC hooks as follows:
```yml
gRPC:
default:
is-default: true
target-host: ip
target-port: port
```
The message contains key information which are defined in `oap-server/server-alarm-plugin/src/main/proto/alarm-hook.proto`.
Part of the protocol looks like this: