Skip to content

Commit

Permalink
Fix attributes filter network documentation (#863)
Browse files Browse the repository at this point in the history
Backport of (#861)

* Fix documentation

* Fix unit test

* Edit

---------

Co-authored-by: Sean Packham <[email protected]>
  • Loading branch information
mariomac and grafsean authored May 23, 2024
1 parent c48b336 commit 6400ede
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 25 deletions.
19 changes: 13 additions & 6 deletions docs/sources/network/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,20 @@ For example:
```yaml
network:
enable: true
allowed_attributes:
- k8s.src.owner.name
- k8s.src.namespace
- k8s.dst.owner.name
- k8s.dst.namespace
- k8s.cluster.name
attributes:
kubernetes:
enable: true
select:
beyla_network_flow_bytes:
include:
- k8s.src.owner.name
- k8s.src.namespace
- k8s.dst.owner.name
- k8s.dst.namespace
- k8s.cluster.name
```
In this example, the bytes metric is the aggregated by the source and destination owners. This is, all the
pods from a given Deployment/StatefulSet/ReplicaSet/DaemonSet.
For more information about the `attributes.select` section, check the [Configuration options]({{< relref "../configure/options" >}}).
19 changes: 12 additions & 7 deletions docs/sources/network/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,22 @@ Example YAML:
```yaml
network:
enable: true
allowed_attributes:
- k8s.src.owner.name
- k8s.src.namespace
- k8s.dst.owner.name
- k8s.dst.namespace
- src.cidr
- dst.cidr
cidrs:
- 10.10.0.0/24
- 10.0.0.0/8
- 10.30.0.0/16
attributes:
kubernetes:
enable: true
select:
beyla_network_flow_bytes:
include:
- k8s.src.owner.name
- k8s.src.namespace
- k8s.dst.owner.name
- k8s.dst.namespace
- src.cidr
- dst.cidr
otel_metrics_export:
endpoint: http://localhost:4318
```
Expand Down
30 changes: 21 additions & 9 deletions docs/sources/network/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ keywords:
Network metrics is an [experimental](/docs/release-life-cycle/) under development feature, expect breaking changes.
{{% /admonition %}}

{{% admonition type="note" %}}
This tutorial describes how to deploy Beyla in Kubernetes from scratch.
To use Helm, consult the [Deploy Beyla in Kubernetes with Helm]({{< relref "../setup/kubernetes-helm" >}}) documentation.
{{% /admonition %}}

# Beyla network metrics quickstart

Beyla can generate network metrics in any environment (physical host, virtual host, or container). While the feature is in experimental development, it is recommended to use a Kubernetes environment, as Beyla is able to decorate each metric with the metadata of the source and destination Kubernetes entities.
Expand Down Expand Up @@ -226,7 +231,9 @@ The `attributes.select.<metric-name>.include` YAML subsection makes it possible
network:
enable: true
attributes:
allow:
kubernetes:
enable: true
select:
beyla.network.flow.bytes:
include:
- k8s.src.owner.name
Expand All @@ -247,21 +254,26 @@ The `cidrs` YAML subsection in `network` (or the `BEYLA_NETWORK_CIDRS` environme
subnets in [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing), in both IPv4 and IPv6 format.

The existence of the `cidrs` section leaves the `src.address` and `dst.address` fields untouched,
and adds the `src.cidr` and `dst.cidr` attributes. Don't forget to add them to the `attributes.allow`
and adds the `src.cidr` and `dst.cidr` attributes. Don't forget to add them to the `attributes.select`
section:

```yaml
network:
enable: true
allowed_attributes:
- k8s.src.owner.name
- k8s.src.namespace
- k8s.dst.owner.name
- k8s.dst.namespace
- src.cidr
- dst.cidr
cidrs:
- 10.10.0.0/24
- 10.0.0.0/8
- 10.30.0.0/16
attributes:
kubernetes:
enable: true
select:
beyla_network_flow_bytes:
include:
- k8s.src.owner.name
- k8s.src.namespace
- k8s.dst.owner.name
- k8s.dst.namespace
- src.cidr
- dst.cidr
```
7 changes: 4 additions & 3 deletions pkg/beyla/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,11 @@ otel_metrics_export:
attributes:
kubernetes:
enable: true
allow:
select:
beyla_network_flow_bytes:
- k8s.src.name
- k8s.dst.name
include:
- k8s.src.name
- k8s.dst.name
network:
enable: true
`)
Expand Down

0 comments on commit 6400ede

Please sign in to comment.