Skip to content

Deprecate top-level service selection #1768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions docs/sources/configure/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ aliases:

Beyla can be configured via environment variables or via a YAML configuration file passed either with the `-config` command-line argument or the `BEYLA_CONFIG_PATH` environment variable.
Environment variables have priority over the properties in the configuration file.
For example, in the following command line, the `BEYLA_OPEN_PORT` option overrides any `open_port` settings inside config.yaml:

**Config argument:**

```sh
BEYLA_OPEN_PORT=8080 beyla -config /path/to/config.yaml
```

**Config environment variable:**

```sh
BEYLA_OPEN_PORT=8080 BEYLA_CONFIG_PATH=/path/to/config.yaml beyla
```

Refer to the [example YAML configuration file](../example/) for a configuration file template.

Expand All @@ -41,52 +28,10 @@ The following sections explain the global configuration properties that apply to

| Lowercase YAML option<br>Uppercase environment variable option | Description | Type | Default |
| -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------- | --------------------- |
| `executable_name`<br>`BEYLA_EXECUTABLE_NAME` | Selects the process to instrument by regular expression matching against the full executable path. | string | unset |
| `open_port`<br>`BEYLA_OPEN_PORT` | Selects a process to instrument by open ports. Accepts comma-separated lists of ports and port ranges. | string | unset |
| `service_name`<br>`BEYLA_SERVICE_NAME` | **Deprecated** Overrides the name of the instrumented service for metrics export. | string | see service discovery |
| `service_namespace`<br>`BEYLA_SERVICE_NAMESPACE` | **Deprecated** Assigns a namespace for the selected service. | string | see service discovery |
| `log_level`<br>`BEYLA_LOG_LEVEL` | Sets process logger verbosity. Valid values: `DEBUG`, `INFO`, `WARN`, `ERROR`. | string | `INFO` |
| `trace_printer`<br>`BEYLA_TRACE_PRINTER` | Prints instrumented traces to stdout in a specified format, refer to [trace printer formats](#trace-printer-formats). | string | `disabled` |
| `enforce_sys_caps`<br>`BEYLA_ENFORCE_SYS_CAPS` | Controls how Beyla handles missing system capabilities at startup. | boolean | `false` |

## Executable name matching

This property accepts a regular expression matched against the full executable command line, including the directory where the executable resides on the file system.
Beyla selects one process, or multiple processes with similar characteristics.
For more detailed process selection and grouping, refer to the [service discovery documentation](../service-discovery/).

When you instrument by executable name, choose a non-ambiguous name that matches one executable on the target system.
For example, if you set `BEYLA_EXECUTABLE_NAME=server` and have two processes that match the regular expression Beyla selects both.
Instead use the full application path for exact matches, for example `BEYLA_EXECUTABLE_NAME=/opt/app/server` or `BEYLA_EXECUTABLE_NAME=/server`.

If you set `executable_name`, the executable must also match any `open_port` property.

## Open port matching

This property accepts a comma-separated list of ports or port ranges. If an executable matches any of the ports Beyla selects it. For example:

```yaml
open_port: 80,443,8000-8999
```

In this example, Beyla selects any executable that opens port `80`, `443`, or any port between `8000` and `8999`.
It can select one process or multiple processes with similar characteristics.
For more detailed process selection and grouping, follow the instructions in the [service discovery documentation](../service-discovery/).

If an executable opens multiple ports, specifying one of those ports is enough for Beyla to instrument all HTTP/S and GRPC requests on all application ports.
Currently, there is no way to limit instrumentation to requests on a specific port.

If the specified port range is wide, for example `1-65535`, Beyla tries to execute all processes that own one of the ports in that range.

If you set `executable_name`, the executable must also match any `open_port` property.

## Service name and namespace

These configuration options are deprecated.

Defining these properties is equivalent to adding a `name` entry to the [`discovery.services` YAML section](../service-discovery/).
When a single instance of Beyla instruments multiple processes, they share the same service name even if they differ.
To give multiple services different names, see how to [override the service name and namespace](../service-discovery/) in the service discovery documentation.

## Trace printer formats

Expand Down
4 changes: 0 additions & 4 deletions docs/sources/configure/service-discovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ keywords:

# Configure Beyla service discovery

The `executable_name`, `open_port`, `service_name` and `service_namespace` are top-level
properties that simplify the configuration of Beyla to instrument a single service, or
a group of related services.

In some scenarios, Beyla will instrument a big variety of services; for example,
as a [Kubernetes DaemonSet](../../setup/kubernetes/) that instruments all
the services in a node. The `discovery` YAML section will let you specify a higher
Expand Down
6 changes: 0 additions & 6 deletions docs/sources/quickstart/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ group of services within a single Kubernetes node.
A service selector is a set of properties that let Beyla to query which processes need
to be instrumented.

When Beyla is deployed as a regular operating system process that instrument other processes,
the unique service selectors are the network port where the instrumented process should
be listening to (can be specified with the `BEYLA_OPEN_PORT` environment variable) or
a regular expression to match against the executable file name of the process to
instrument (`BEYLA_EXECUTABLE_NAME` environment variable).

To select multiple groups of processes, the Beyla YAML configuration file format
provides a `discovery.services` section that accepts multiple selector groups:

Expand Down
3 changes: 1 addition & 2 deletions ops/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ check that Beyla is finding any process to instrument. The logs should show a me
level=INFO msg="instrumenting process" component=discover.TraceAttacher cmd=/frontend pid=1
```

If you don't see any message like the preceding, make sure that the process is properly selected, either with the
`BEYLA_EXECUTABLE_NAME`, `BEYLA_OPEN_PORT` or with the [discovery YAML section](https://github.com/grafana/beyla/blob/main/docs/sources/configure/options.md#global-configuration-properties).
If you don't see any message like the preceding, make sure that the process is properly selected with the [discovery YAML section](https://github.com/grafana/beyla/blob/main/docs/sources/configure/options.md#global-configuration-properties).

If you still don't see any message like the preceding, check [Deploy Beyla in Kubernetes](https://github.com/grafana/beyla/blob/main/docs/sources/setup/kubernetes.md) to see if the process is properly selected.

Expand Down
6 changes: 5 additions & 1 deletion pkg/beyla/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,22 @@ type Config struct {
TracePrinter debug.TracePrinter `yaml:"trace_printer" env:"BEYLA_TRACE_PRINTER"`

// Exec allows selecting the instrumented executable whose complete path contains the Exec value.
// Deprecated: use discovery.services instead
Exec services.RegexpAttr `yaml:"executable_name" env:"BEYLA_EXECUTABLE_NAME"`
// nolint:undoc
ExecOtelGo services.RegexpAttr `env:"OTEL_GO_AUTO_TARGET_EXE"`
// Port allows selecting the instrumented executable that owns the Port value. If this value is set (and
// different to zero), the value of the Exec property won't take effect.
// It's important to emphasize that if your process opens multiple HTTP/GRPC ports, the auto-instrumenter
// will instrument all the service calls in all the ports, not only the port specified here.
// Deprecated: use discovery.services instead
Port services.PortEnum `yaml:"open_port" env:"BEYLA_OPEN_PORT"`

// ServiceName is taken from either BEYLA_SERVICE_NAME env var or OTEL_SERVICE_NAME (for OTEL spec compatibility)
// Using env and envDefault is a trick to get the value either from one of either variables
ServiceName string `yaml:"service_name" env:"OTEL_SERVICE_NAME,expand" envDefault:"${BEYLA_SERVICE_NAME}"`
// Deprecated: use discovery.services instead
ServiceName string `yaml:"service_name" env:"OTEL_SERVICE_NAME,expand" envDefault:"${BEYLA_SERVICE_NAME}"`
// Deprecated: use discovery.services instead
ServiceNamespace string `yaml:"service_namespace" env:"BEYLA_SERVICE_NAMESPACE"`

// Discovery configuration
Expand Down
Loading