|
7 | 7 | Monitor Python web apps using |
8 | 8 | [Spring Boot Admin](https://github.com/codecentric/spring-boot-admin). |
9 | 9 |
|
10 | | -Pyctuator supports **Flask** and **FastAPI**. **Django** support is planned as well. |
| 10 | +Pyctuator supports **Flask**, **FastAPI** and **aiohttp**. **Django** support is planned as well. |
11 | 11 |
|
12 | 12 | The following video shows a FastAPI web app being monitored and controled using Spring Boot Admin. |
13 | 13 |
|
@@ -63,9 +63,9 @@ It currently supports the following Actuator features: |
63 | 63 | * **HTTP traces** - Tail recent HTTP requests, including status codes and latency |
64 | 64 |
|
65 | 65 | ## Quickstart |
66 | | -The examples below show a minimal integration of **FastAPI** and **Flask** applications with **Pyctuator**. |
| 66 | +The examples below show a minimal integration of **FastAPI**, **Flask** and **aiohttp** applications with **Pyctuator**. |
67 | 67 |
|
68 | | -After installing Flask/FastAPI and Pyctuator, start by launching a local Spring Boot Admin instance: |
| 68 | +After installing Flask/FastAPI/aiohttp and Pyctuator, start by launching a local Spring Boot Admin instance: |
69 | 69 |
|
70 | 70 | ```sh |
71 | 71 | docker run --rm --name spring-boot-admin -p 8080:8080 michayaak/spring-boot-admin:2.2.3-1 |
@@ -139,6 +139,36 @@ The application will automatically register with Spring Boot Admin upon start up |
139 | 139 |
|
140 | 140 | Log in to the Spring Boot Admin UI at `http://localhost:8080` to interact with the application. |
141 | 141 |
|
| 142 | +### aiohttp |
| 143 | +The following example is complete and should run as is. |
| 144 | + |
| 145 | +```python |
| 146 | +from aiohttp import web |
| 147 | +from pyctuator.pyctuator import Pyctuator |
| 148 | + |
| 149 | +app = web.Application() |
| 150 | +routes = web.RouteTableDef() |
| 151 | + |
| 152 | +@routes.get("/") |
| 153 | +def hello(): |
| 154 | + return web.Response(text="Hello World!") |
| 155 | + |
| 156 | +Pyctuator( |
| 157 | + app, |
| 158 | + "aiohttp Pyctuator", |
| 159 | + app_url="http://host.docker.internal:8888", |
| 160 | + pyctuator_endpoint_url="http://host.docker.internal:8888/pyctuator", |
| 161 | + registration_url="http://localhost:8080/instances" |
| 162 | +) |
| 163 | + |
| 164 | +app.add_routes(routes) |
| 165 | +web.run_app(app, port=8888) |
| 166 | +``` |
| 167 | + |
| 168 | +The application will automatically register with Spring Boot Admin upon start up. |
| 169 | + |
| 170 | +Log in to the Spring Boot Admin UI at `http://localhost:8080` to interact with the application. |
| 171 | + |
142 | 172 | ### Registration Notes |
143 | 173 | When registering a service in Spring Boot Admin, note that: |
144 | 174 | * **Docker** - If the Spring Boot Admin is running in a container while the managed service is running in the docker-host directly, the `app_url` and `pyctuator_endpoint_url` should use `host.docker.internal` as the url's host so Spring Boot Admin will be able to connect to the monitored service. |
@@ -279,7 +309,7 @@ To run these examples, you'll need to have Spring Boot Admin running in a local |
279 | 309 |
|
280 | 310 | Unless the example includes a docker-compose file, you'll need to start Spring Boot Admin using docker directly: |
281 | 311 | ```sh |
282 | | -docker run -p 8080:8080 michayaak/spring-boot-admin:2.2.3-1 |
| 312 | +docker run --rm -p 8080:8080 michayaak/spring-boot-admin:2.2.3-1 |
283 | 313 | ``` |
284 | 314 | (the docker image's tag represents the version of Spring Boot Admin, so if you need to use version `2.0.0`, use `michayaak/spring-boot-admin:2.0.0` instead, note it accepts connections on port 8082). |
285 | 315 |
|
|
0 commit comments