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 2 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
97 changes: 0 additions & 97 deletions docs/sources/configure/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,103 +43,6 @@ the options for each component.

## Global configuration properties

The properties in this section are first-level YAML properties, as they apply to the
whole Beyla configuration:

| YAML | Environment variable | Type | Default |
| ----------------- | ----------------------- | ------ | ------- |
| `executable_name` | `BEYLA_EXECUTABLE_NAME` | string | (unset) |

Selects the process to instrument by the executable name path. This property accepts
a regular expression to be matched against the full executable command line, including the directory
where the executable resides on the file system.

This property is used to select a single process to instrument, or a group of processes of
similar characteristics. For more fine-grained process selection and grouping, you can
follow the instructions in the [service discovery section](../service-discovery/).

If the `open_port` property is set, the executable to be selected needs to match both properties.

When instrumenting by using the executable name, choose a non-ambiguous name, a name that
will match a single executable on the target system.
For example, if you set `BEYLA_EXECUTABLE_NAME=server`, and you have running two processes whose executables
have the following paths:

```sh
/usr/local/bin/language-server
/opt/app/server
```

Beyla will match indistinctly one of the above processes and instrument both.
If you just want to instrument one of them, you should be as concrete as possible about
the value of the setting. For example, `BEYLA_EXECUTABLE_NAME=/opt/app/server`
or just `BEYLA_EXECUTABLE_NAME=/server`.

| YAML | Environment variable | Type | Default |
| ----------- | ----------------- | ------ | ------- |
| `open_port` | `BEYLA_OPEN_PORT` | string | (unset) |

Selects the process to instrument by the port it has open (listens to). This property
accepts a comma-separated list of ports (for example, `80`), and port ranges (for example, `8000-8999`).
If the executable matching only one of the ports in the list, it is considered to match
the selection criteria.

For example, specifying the following property:

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

Would make Beyla to select any executable that opens port 80, 443, or any of the ports between 8000 and 8999 included.

This property is used to select a single process to instrument, or a group of processes of
similar characteristics. For more fine-grained process selection and grouping, you can
follow the instructions in the [service discovery section](../service-discovery/).

If the `executable_name` property is set, the executable to be selected needs to match both properties.

If an executable opens multiple ports, only one of the ports needs to be specified
for Beyla **to instrument all the
HTTP/S and GRPC requests on all application ports**. At the moment, there is no way to
restrict the instrumentation only to the methods exposed through a specific port.

If the specified port range is wide (e.g. `1-65535`) Beyla will try to execute all the processes
owning one of the ports in the range.

| YAML | Environment variable | Type | Default |
|----------------| ------------------------------------------- | ------ |---------------------------------------------------------------------------------|
| `service_name` | `BEYLA_SERVICE_NAME` | string | (refer to [service discovery](../service-discovery/) section) |

**Deprecated**

Overrides the name of the instrumented service to be reported by the metrics exporter.
Defining this property is equivalent to add a `name` entry into the [`discovery.services` YAML
section](../service-discovery/).

This configuration option is deprecated. If a single instance of Beyla is instrumenting multiple instances of different processes,
they will share the same service name even if they are different. If you need that a
single instance of Beyla report different service names, follow the instructions on how to
[override the service name and namespace](../service-discovery/) in the service discovery documentation
to enable automatic configuration of service name and namespace from diverse metadata sources.

| YAML | Environment variable | Type | Default |
| ------------------- | ------------------------- | ------ |---------------------------------------------------------------------------------|
| `service_namespace` | `BEYLA_SERVICE_NAMESPACE` | string | (refer to [service discovery](../service-discovery/) section) |

**Deprecated**

Optionally, allows assigning a namespace for the service selected from the `executable_name`
or `open_port` properties.

Defining this property is equivalent to add a `name` entry into the [`discovery.services` YAML
section](../service-discovery/).

This configuration option is deprecated, as it assumes a single namespace for all the services instrumented
by Beyla. If you need that a single instance of Beyla groups multiple services
into different namespaces, follow the instructions on how to
[override the service name and namespace](../service-discovery/) in the service discovery documentation
to enable automatic configuration of service name and namespace from diverse metadata sources.

| YAML | Environment variable | Type | Default |
| ----------- | ----------------- | ------ | ------- |
| `log_level` | `BEYLA_LOG_LEVEL` | string | `INFO` |
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