Skip to content

Commit ad1c052

Browse files
committed
developer docs for andromde-akamai-reports app
1 parent 054aea3 commit ad1c052

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# `andromeda-akamai-reports` app
2+
3+
This worker will bind a Prometheus HTTP to `0.0.0.0:9090` (or the host and port provided by `PROMETHEUS_LISTEN`) and register a collector (`AndromedaAkamaiCollector`) that implements the `prometheus.Collector` interface. Whenever its `/metrics` endpoint is requested, Prometheus invokes `Collect()`, which in turn:
4+
5+
* Iterates over each property using the Akamai GTM API
6+
* For each property...
7+
* Queries the Akamai GTM API for its [traffic report][traffic-report]
8+
* Retrieves its respective Keystone project ID from the Andromeda database
9+
* Writes the results of the API call to two gauge metrics:
10+
* `andromeda_akamai_requests_5m`
11+
* `andromeda_akamai_status_5m`
12+
13+
[traffic-report]: <https://techdocs.akamai.com/gtm-reporting/reference/get-traffic-property>
14+
15+
The Akamai metrics will be exposed at <http://localhost:9091/metrics>.
16+
17+
## Manually testing the main flow
18+
19+
Ensure the `akamai.yaml` file points to the desired Akamai domain (`akamai.domain` property).
20+
21+
Ensure that, for each property/domain/server combination that you'd like to test for, there's one respective `datacenter` table record in place. Navigate to the Akamai property details page and copy the the server UUID you'd like to test. Then, create a record in the local Andromeda `datacenter` table by providing some value (a real Keystone project ID is not necessary) for `datacenter.project_id` and the Akamai property server UUID for `datacenter.id`:
22+
23+
```sql
24+
INSERT INTO datacenter (id, project_id, provider, admin_state_up) VALUES
25+
("...", "...", "akamai", 1);
26+
```
27+
28+
On shell 1, start the RPC server.
29+
30+
```sh
31+
go run cmd/andromemeda-server/main.go \
32+
--config-file ./tmp/andromeda.yaml \
33+
--config-file ./tmp/akamai.yaml
34+
```
35+
36+
On Shell 2, start the Akamai Reports app:
37+
38+
```sh
39+
export PROMETHEUS_LISTEN=0.0.0.0:9091
40+
go run cmd/andromemeda-akamai-reports/main.go \
41+
--config-file ./tmp/andromeda.yaml \
42+
--config-file ./tmp/akamai.yaml
43+
```
44+
45+
In order for Prometheus to invoke the Andromeda Akamai Collector, either browse or curl the `/metrics` endpoint:
46+
47+
```sh
48+
curl http://0.0.0.0:9091/metrics | grep '_5m'
49+
```
50+
51+
The output should include data for both `andromeda_akamai_requests_5m` and `andromeda_akamai_status_5m` custom metrics.

0 commit comments

Comments
 (0)