The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/services/ngalert/api/tooling
Santiago 09f8e026a1
Alerting: Expose info about notification delivery errors in a new /receivers endpoint (#55429)
3 years ago
..
cmd/clean-swagger Handle ioutil deprecations (#53526) 3 years ago
definitions Alerting: Expose info about notification delivery errors in a new /receivers endpoint (#55429) 3 years ago
swagger-codegen/templates Alerting: Refactor API types generation with different names. (#51785) 3 years ago
.gitignore Alerting: Add support for documenting which alerting APIs are stable (#49018) 3 years ago
Makefile Rename Acl to ACL (#52342) 3 years ago
README.md Alerting: Add support for documenting which alerting APIs are stable (#49018) 3 years ago
api.json Alerting: Expose info about notification delivery errors in a new /receivers endpoint (#55429) 3 years ago
index.html Swagger: Add integrity attributes (#48396) 3 years ago
post.json Alerting: Expose info about notification delivery errors in a new /receivers endpoint (#55429) 3 years ago
spec.json Alerting: Expose info about notification delivery errors in a new /receivers endpoint (#55429) 3 years ago

README.md

What

This aims to define the unified alerting API as code. It generates OpenAPI definitions from go structs. It also generates server/route stubs based on our documentation.

Running

make - regenerate everything - documentation and server stubs. make serve - regenerate the Swagger document, and host rendered docs on port 80. view api

Requires

Why

The current state of Swagger extraction from golang is relatively limited. It's easier to generate server stubs from an existing Swagger doc, as there are limitations with producing a Swagger doc from a hand-written API stub. The current extractor instead relies on comments describing the routes, but the comments and actual implementation may drift, which we don't want to allow.

Instead, we use a hybrid approach - we define the types in Golang, with comments describing the routes, in a standalone package with minimal dependencies. From this, we produce a Swagger doc, and then turn the Swagger doc back into a full-blown server stub.

Stability

We have some endpoints that we document publically as being stable, and others that we consider unstable. The stable endpoints are documented in api.json, where all endpoints are available in post.json.

To stabilize an endpoint, add the stable tag to its route comment:

// swagger:route GET /api/provisioning/contact-points provisioning stable RouteGetContactpoints