diff --git a/examples/ingest-logs/README.md b/examples/ingest-logs/README.md index 3343faefa..237d2f694 100644 --- a/examples/ingest-logs/README.md +++ b/examples/ingest-logs/README.md @@ -18,6 +18,6 @@ Transformations in Vector uses the [Vector Remap Language](https://vector.dev/do 1. First, start OpenMeter. Refer to the [quickstart guide](/quickstart) for instructions. 2. Execute `docker compose up` within this example directory. -3. To query meters, use the following command: `curl http://localhost:8888/api/v1/meters/api_requests_total/values`. +3. To query meters, use the following command: `curl 'http://localhost:8888/api/v1/meters/api_requests_duration/query?groupBy=subject'`. Note: It's important that you run quickstart's `docker compose` first. diff --git a/examples/ingest-logs/docker-compose.yaml b/examples/ingest-logs/docker-compose.yaml index 81beee967..4f5a7aa91 100644 --- a/examples/ingest-logs/docker-compose.yaml +++ b/examples/ingest-logs/docker-compose.yaml @@ -1,5 +1,3 @@ -version: '3.9' - services: # Container to generate demo logs demologs: @@ -19,7 +17,7 @@ services: sleep 1; done' vector: - image: timberio/vector:0.32.X-alpine + image: timberio/vector:0.40.X-alpine hostname: vector container_name: vector command: --config /etc/vector/vector.yaml diff --git a/examples/ingest-logs/vector.yaml b/examples/ingest-logs/vector.yaml index 5e6865f02..03a91f199 100644 --- a/examples/ingest-logs/vector.yaml +++ b/examples/ingest-logs/vector.yaml @@ -30,16 +30,16 @@ transforms: - filter_requests source: | .cloudevent.specversion = "1.0" - .cloudevent.id = .timestamp + .cloudevent.id = uuid_v7() .cloudevent.source = .container_id - .cloudevent.type = "api-calls" + .cloudevent.type = "request" .cloudevent.subject = .message.user .cloudevent.time = .timestamp response_time, err = to_string(.message.response_time) if err != null { log(err, level: "error") } .cloudevent.data.duration_ms = response_time .cloudevent.data.method = .message.method - .cloudevent.data.path = .message.path + .cloudevent.data.route = .message.route . = .cloudevent sinks: @@ -55,7 +55,7 @@ sinks: type: http inputs: - cloudevents - uri: http://openmeter:8888/api/v1alpha1/events + uri: http://openmeter:8888/api/v1/events method: post request: headers: diff --git a/quickstart/config.yaml b/quickstart/config.yaml index 73061bae2..db80c949e 100644 --- a/quickstart/config.yaml +++ b/quickstart/config.yaml @@ -12,7 +12,7 @@ sink: meters: # Sample meter to count API requests - - slug: api_requests_total # Unique identifier for the meter + - slug: api_requests_total # Unique identifier for the meter description: API Requests eventType: request # Filter events by type aggregation: COUNT # Aggregation method: COUNT, SUM, etc. @@ -20,6 +20,16 @@ meters: method: $.method # HTTP Method: GET, POST, etc. route: $.route # Route: /products/:product_id + # Sample meter to sum API request duration + - slug: api_requests_duration + description: API Request Duration + eventType: request + aggregation: SUM + valueProperty: $.duration_ms # JSONPath to parse usage value + groupBy: + method: $.method + route: $.route + # Sample meter to count LLM Token Usage - slug: tokens_total description: AI Token Usage