Boburmirzo commented on code in PR #9897:
URL: https://github.com/apache/apisix/pull/9897#discussion_r1274445649
##########
docs/en/latest/config.json:
##########
@@ -26,11 +26,18 @@
"items": [
"tutorials/expose-api",
"tutorials/protect-api",
- "tutorials/observe-your-api",
+ {
Review Comment:
Yes, it is good to group them when we have 3 related topics.
##########
docs/en/latest/tutorials/monitor-api-health-check.md:
##########
@@ -0,0 +1,180 @@
+---
+title: Monitor API Health Check with Prometheus
+keywords:
+ - API Health Check
+ - Monitoring with Prometheus
+ - API Gateway
+description: In this tutorial, we'll guide you on how to enable and monitor
API health checks using APISIX and Prometheus.
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+[APISIX](https://apisix.apache.org/) has a [health
check](https://apisix.apache.org/docs/apisix/tutorials/health-check/)
mechanism, which proactively checks the health status of the upstream nodes in
your system. Also, APISIX integrates with [Prometheus](https://prometheus.io/)
through its [plugin](https://apisix.apache.org/docs/apisix/plugins/prometheus/)
that exposes upstream nodes (multiple instances of a backend API service that
APISIX manages) health check metrics on the Prometheus metrics endpoint
typically, on URL path **`/apisix/prometheus/metrics`**.
+
+In this tutorial, we'll guide you on how to **enable and monitor API health
checks** using APISIX and Prometheus.
+
+## Prerequisite(s)
+
+- Before you start, it is good to have a basic understanding of APISIX.
Familiarity with [API
gateway](https://apisix.apache.org/docs/apisix/terminology/api-gateway/), and
its key concepts such as
[routes](https://docs.api7.ai/apisix/key-concepts/routes),
[upstream](https://docs.api7.ai/apisix/key-concepts/upstreams), [Admin
API](https://apisix.apache.org/docs/apisix/admin-api/),
[plugins](https://docs.api7.ai/apisix/key-concepts/plugins), and HTTP protocol
will also be beneficial.
+- [Docker](https://docs.docker.com/get-docker/) is used to install the
containerized etcd and APISIX.
+- Install [cURL](https://curl.se/) to send requests to the services for
validation.
+
+## Start the APISIX demo project
+
+This project leverages existing the pre-defined [Docker Compose
configuration](https://github.com/apache/apisix-docker/blob/master/example/docker-compose.yml)
file to set up, deploy and run APISIX, etcd, Prometheus, and other services
with a single command. First, clone the
[apisix-docker](https://github.com/apache/apisix-docker) repo on GitHub and
open it in your favorite editor, navigate to `/example` folder, and start the
project by simply running `docker compose up` from the folder.
+
+When you start the project, Docker downloads any images it needs to run. You
can see the full list of services in
[docker-compose.yaml](https://github.com/apache/apisix-docker/blob/master/example/docker-compose.yml)
file.
+
+## Add health check API endpoints in upstream
+
+To check API health periodically, APISIX needs an HTTP path of the health
endpoint of the upstream service. So, you need first to add `/health` endpoint
for your backend service. From there, you inspect the most relevant metrics
for that service such as memory usage, database connectivity, response
duration, and more. Assume that we have two backend REST API services web1 and
web2 running using the demo project and each has its **own health check**
endpoint at URL path `/health`. At this point, you do not need to make
additional configurations. In reality, you can replace them with your backend
services.
+
+> The simplest and standardized way to validate the status of a service is to
define a new [health
check](https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/monitor-app-health)
endpoint like `/health` or `/status`
Review Comment:
Replace the link
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]