From fcd7497fc3a542931cdb1506ee26fb5653e0988b Mon Sep 17 00:00:00 2001 From: Andras Toth <4157749+tothandras@users.noreply.github.com> Date: Sun, 14 Jan 2024 20:09:16 +0100 Subject: [PATCH] docs(examples): small fixes --- examples/clickhouse/README.md | 11 ++++++++++- examples/http-server/README.md | 7 ++++--- examples/http-server/seed/batch.json | 3 --- examples/http-server/seed/event.json | 1 - examples/kubernetes-pod-exec-time/README.md | 3 ++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/examples/clickhouse/README.md b/examples/clickhouse/README.md index 4076700..6491a6c 100644 --- a/examples/clickhouse/README.md +++ b/examples/clickhouse/README.md @@ -9,6 +9,15 @@ Benthos will read messages from a message log table and send the calculated usag The example also demonstrates that certain business logic can also be implemented during the transformation (for example: users on the enterprise plan do not get charged for message length). +## Table of Contents + +- [Prerequisites](#prerequisites) +- [Launch the example](#launch-the-example) +- [Checking events](#checking-events) +- [Cleanup](#cleanup) +- [Advanced configuration](#advanced-configuration) +- [Production use](#production-use) + ## Prerequisites This example uses [Docker](https://docker.com) and [Docker Compose](https://docs.docker.com/compose/), but you are free to run the components in any other way. @@ -33,7 +42,7 @@ cp .env.dist .env Create the following meters in OpenMeter with the following details: | Description | Event type | Aggregation | Value property | Group by (optional) | -|--------------------------|----------------|-------------|-----------------------------|---------------------| +| ------------------------ | -------------- | ----------- | --------------------------- | ------------------- | | All message lenghts | `chat-message` | `SUM` | `$.message_length` | - `plan`: `$.plan` | | Billable message lengths | `chat-message` | `SUM` | `$.message_length_billable` | - `plan`: `$.plan` | | Message count | `chat-message` | `COUNT` | - | - `plan`: `$.plan` | diff --git a/examples/http-server/README.md b/examples/http-server/README.md index d822710..3133838 100644 --- a/examples/http-server/README.md +++ b/examples/http-server/README.md @@ -7,10 +7,11 @@ The nice thing about this solution is that you can use it as a drop-in replaceme This means you can use our existing SDKs; the only thing you need to change is the API endpoint. That is, of course, optional: you can use any client library or payload format you prefer and handle the mapping to the [CloudEvents](https://cloudevents.io/) format in a Benthos [`mapping` processor](https://www.benthos.dev/docs/components/processors/mapping/). -## Table of Contents +## Table of Contents - [Prerequisites](#prerequisites) - [Launch the example](#launch-the-example) +- [Checking events](#checking-events) - [Cleanup](#cleanup) - [Advanced configuration](#advanced-configuration) - [Production use](#production-use) @@ -67,7 +68,7 @@ docker compose logs -f forwarder Open another terminal and send a test event: ```shell -curl -vvv http://localhost:4196/api/v1/events -H "Content-Type: application/cloudevents+json" -d @seed/event.json +curl -vvv http://127.0.0.1:4196/api/v1/events -H "Content-Type: application/cloudevents+json" -d @seed/event.json ``` _Inspect the logs in the other terminal._ @@ -75,7 +76,7 @@ _Inspect the logs in the other terminal._ Send a batch of events: ```shell -curl -vvv http://localhost:4196/api/v1/events -H "Content-Type: application/cloudevents-batch+json" -d @seed/batch.json +curl -vvv http://127.0.0.1:4196/api/v1/events -H "Content-Type: application/cloudevents-batch+json" -d @seed/batch.json ``` _Inspect the logs in the other terminal._ diff --git a/examples/http-server/seed/batch.json b/examples/http-server/seed/batch.json index c58789c..3f4e257 100644 --- a/examples/http-server/seed/batch.json +++ b/examples/http-server/seed/batch.json @@ -5,7 +5,6 @@ "type": "api-calls", "source": "api-gateway", "subject": "customer-1", - "time": "2024-01-09T13:06:04.715Z", "data": { "method": "POST", "path": "/", @@ -20,7 +19,6 @@ "type": "api-calls", "source": "api-gateway", "subject": "customer-2", - "time": "2024-01-09T13:07:04.715Z", "data": { "method": "GET", "path": "/contact", @@ -35,7 +33,6 @@ "type": "api-calls", "source": "api-gateway", "subject": "customer-3", - "time": "2024-01-09T13:08:04.715Z", "data": { "method": "GET", "path": "/home", diff --git a/examples/http-server/seed/event.json b/examples/http-server/seed/event.json index 99f0af0..68c54af 100644 --- a/examples/http-server/seed/event.json +++ b/examples/http-server/seed/event.json @@ -4,7 +4,6 @@ "type": "api-calls", "source": "api-gateway", "subject": "customer-1", - "time": "2024-01-09T13:05:04.715Z", "data": { "method": "POST", "path": "/", diff --git a/examples/kubernetes-pod-exec-time/README.md b/examples/kubernetes-pod-exec-time/README.md index 86ddf3f..77943ee 100644 --- a/examples/kubernetes-pod-exec-time/README.md +++ b/examples/kubernetes-pod-exec-time/README.md @@ -2,11 +2,12 @@ This example demonstrates metering execution time of Pods running in Kubernetes. -## Table of Contents +## Table of Contents - [Prerequisites](#prerequisites) - [Preparations](#preparations) - [Deploy the example](#deploy-the-example) +- [Checking events](#checking-events) - [Cleanup](#cleanup) - [Advanced configuration](#advanced-configuration) - [Production use](#production-use)