Skip to content

Commit

Permalink
[docs] Update events YAML examples (#5250)
Browse files Browse the repository at this point in the history
  • Loading branch information
smyrick authored May 27, 2024
1 parent f4f0ca7 commit 97e7605
Showing 1 changed file with 51 additions and 47 deletions.
98 changes: 51 additions & 47 deletions docs/source/configuration/telemetry/instrumentation/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ Custom events have a level, `trace`, `debug`, `info`, `warn`, `error` or `off` (
To set the level:
```yaml title="future.router.yaml"
telemetry:
events:
router:
acme.event:
level: info # trace, debug, info, warn, error, off
# ...
instrumentation:
events:
router:
acme.event:
level: info # trace, debug, info, warn, error, off
# ...
```

### `condition`
Expand All @@ -134,14 +135,15 @@ In `router.yaml`, set a `condition` with an equality (`eq`) check:

```yaml title="future.router.yaml"
telemetry:
events:
router:
acme.event:
# ...
condition:
eq:
- 200
- response_status: Code
instrumentation:
events:
router:
acme.event:
# ...
condition:
eq:
- 200
- response_status: Code
```
For more details, see [Conditions](./conditions).
Expand All @@ -155,16 +157,17 @@ The attributes available depend on the service of the request lifecycle.

```yaml title="future.router.yaml"
telemetry:
events:
router:
my.event:
# ...
attributes:
# Standard attributes
http.response.status_code: true
# Custom attributes
"my_attribute":
response_header: "x-my-header"
instrumentation:
events:
router:
my.event:
# ...
attributes:
# Standard attributes
http.response.status_code: true
# Custom attributes
"my_attribute":
response_header: "x-my-header"
```

## Event configuration example
Expand All @@ -173,30 +176,31 @@ For example, the router service can be configured with standard events (`request

```yaml title="future.router.yaml"
telemetry:
events:
router:
# Standard events
request: info
response: info
error: info
# Custom events
my.event:
message: "my event message"
level: info
on: request
attributes:
http.response.body.size: false
# Only log when the x-log-request header is `log`
condition:
eq:
- "log"
- request_header: "x-log-request"

supergraph:
# Custom event configuration for supergraph service ...
subgraph:
# Custom event configuration for subgraph service ...
instrumentation:
events:
router:
# Standard events
request: info
response: info
error: info
# Custom events
my.event:
message: "my event message"
level: info
on: request
attributes:
http.response.body.size: false
# Only log when the x-log-request header is `log`
condition:
eq:
- "log"
- request_header: "x-log-request"

supergraph:
# Custom event configuration for supergraph service ...
subgraph:
# Custom event configuration for subgraph service ...
```

## Event configuration reference
Expand Down

0 comments on commit 97e7605

Please sign in to comment.