Change application telemetry settings with Fleet | Logfire
Change what a running application records and sends: its sampling rate, minimum log level, redaction and scrubbing, and which signals it exports. You change these from Logfire, with no restart or redeploy.
Each application takes its settings from an SDK policy. A policy sets only the settings you choose; every other setting stays as the application configured it (“Application controlled”). See Change policies.
- Your application already sends data to Logfire, with a write token in its environment. Fleet doesn’t change how it sends data: it changes the SDK’s settings.
- You can load a small Fleet package into the application, as shown below for each language.
-
In Fleet management, open SDKs and select Add application.
-
Enter the application’s name, which becomes its
OTEL_SERVICE_NAME, and choose what it uses. Select Get setup instructions.
-
Install Fleet support and load it, as Logfire shows for your setup:
Requires Python 3.11+ and Logfire 5.5.0 or a later 5.x release. If you are upgrading from 4.x, read the 5.x upgrade notes first.
pip install --upgrade 'logfire[fleet]'
Add fleet=True to your logfire.configure() call. Keep its other arguments and your instrumentation calls:
import logfire
logfire.configure(
service_name='checkout-api', # the application name you entered in Fleet
fleet=True,
)
Setting LOGFIRE_FLEET=true in the environment does the same without a code change. The policy then applies to everything the SDK sends, on every exporter, the console included. configure() never raises for Fleet: without the fleet extra or without a Fleet endpoint (OTEL_OPAMP_ENDPOINT or FleetOptions(endpoint=...)), it warns with LogfireFleetWarning and the SDK runs with its own settings, so you can deploy the code before adding the Fleet environment variables. To set the connection in code instead of the environment, pass fleet=FleetOptions(...) from logfire.fleet. See the Python Logfire guide for the full reference.
On Logfire 5.1 to 5.4, install 'logfire-fleet-otel[logfire]' and replace logfire.configure(...) with logfire_fleet_otel.configure_logfire(...), using the same arguments. See the Python Logfire guide.
Requires Python 3.11+. Keeps your existing instrumentations. See the Python OpenTelemetry guide for configuration and deployment examples.
pip install logfire-fleet-otel
export OTEL_PYTHON_DISTRO=opamp
export OTEL_PYTHON_CONFIGURATOR=opamp
opentelemetry-instrument python app.py
Set up in code instead? If your application sets up OpenTelemetry itself, keep that setup and add one call after it. Start the application as usual (python app.py), without the two OTEL_PYTHON_* variables:
import logfire_fleet_otel
# ...your existing OpenTelemetry setup...
logfire_fleet_otel.manage()
No setup of your own yet? Call logfire_fleet_otel.configure() in its place: it builds the SDK from the OTEL_* variables and joins Fleet. See In code for what changes.
Requires Node.js 22+. Uses OpenTelemetry automatic instrumentation. See the Node.js guide for configuration and deployment examples.
npm install @pydantic/logfire-fleet-otel
node --import @pydantic/logfire-fleet-otel/register app.js
Set up in code instead? If your application starts its own NodeSDK, or the Logfire SDK (@pydantic/logfire-node), keep that setup and call manage() after it, in place of --import. Start the application as usual (node app.js):
import { manage } from '@pydantic/logfire-fleet-otel'
sdk.start() // your existing NodeSDK
const fleet = manage()
// On shutdown, await fleet.shutdown() before sdk.shutdown().
With the Logfire SDK, call manage() right after logfire.configure(), and on shutdown await fleet.shutdown() before logfire.shutdown().
See In code for what changes.
Requires Java 17+. Adds the Fleet extension to the OpenTelemetry Java agent 2.31.1.
curl -sSfLo opentelemetry-javaagent.jar https://repo1.maven.org/maven2/io/opentelemetry/javaagent/opentelemetry-javaagent/2.31.1/opentelemetry-javaagent-2.31.1.jar
curl -sSfLo logfire-fleet-javaagent-extension.jar https://repo1.maven.org/maven2/dev/pydantic/logfire-fleet-javaagent-extension/0.2.0/logfire-fleet-javaagent-extension-0.2.0.jar
java -javaagent:opentelemetry-javaagent.jar \
-Dotel.javaagent.extensions=logfire-fleet-javaagent-extension.jar \
-jar app.jar
See the Java guide for configuration and deployment examples.
Requires .NET 8+ on Linux (glibc, x64 or ARM64). Adds the Fleet plugin to OpenTelemetry automatic instrumentation 1.17.0. For Alpine, macOS or Windows, follow the .NET guide.
dotnet add package OpenTelemetry.AutoInstrumentation --version 1.17.0
dotnet add package Logfire.Fleet.AutoInstrumentation
export OTEL_DOTNET_AUTO_PLUGINS="Logfire.Fleet.AutoInstrumentation.Plugin, Logfire.Fleet.AutoInstrumentation"
dotnet publish -c Release -r "linux-$([ "$(uname -m)" = aarch64 ] && echo arm64 || echo x64)" --self-contained false -o ./publish
cd ./publish
./instrument.sh dotnet App.dll
Requires Go 1.26+ for the pinned v0.2.1 below. One call in main sets up OpenTelemetry and keeps your instrumentations.
go get github.com/pydantic/opamp-clients/go/opampotel@v0.2.1
import (
"context"
"log"
"github.com/pydantic/opamp-clients/go/opampotel"
)
func main() {
ctx := context.Background()
// Replaces your OpenTelemetry SDK setup. Keep your instrumentations.
sdk, err := opampotel.Setup(ctx)
if err != nil {
log.Fatal(err)
}
defer sdk.Shutdown(context.Background())
// ...
}
See the Go guide for configuration and deployment examples.
-
Save the Fleet connection key from this Add application setup in your secret manager. Logfire shows it once: you can’t view it again after closing setup. Set these environment variables before starting the application:
Variable Value OTEL_OPAMP_ENDPOINTUS: wss://logfire-us.pydantic.dev/v1/opamp. EU:wss://logfire-eu.pydantic.dev/v1/opamp. Use your project’s region.OTEL_OPAMP_HEADERSAuthorization=Bearer%20<Fleet connection key>. Replace<Fleet connection key>with the key from setup.%20is the encoded space betweenBearerand the key, required by OpenTelemetry’s header format.OTEL_SERVICE_NAMEThe application name you entered in Fleet, for example checkout-api. This names the application in Fleet.For self-hosted Logfire, use your Logfire host with
/v1/opamp, replacinghttps://withwss://: for example,wss://logfire.example.com/v1/opamp. Your operator can set a different URL, so if the Add application setup shows one, use that.In a terminal, Logfire’s setup commands prompt for the key without showing it. In production, set the variables in your deployment instead.
-
Start the application, and select Check connection.
The connection key only manages settings. Your application keeps sending telemetry with its existing write token. Each language has a full guide in pydantic/opamp-clients, including frameworks and deployment examples.
In the Fleet setup, choose In my code under Where does your application set up OpenTelemetry? for Python with OpenTelemetry or Node.js. With manage(), your application keeps its own OpenTelemetry setup, and Fleet places its controls in front of every exporter that setup has:
- Applied: redaction, scrubbing, minimum log level, rate limits and which signals are exported.
- Kept in your code: the sampler and the instrumentations. A policy that changes sampling or instrumentations reports Failed for this application, naming the setting, and the application logs a warning at start.
The connection still comes from OTEL_OPAMP_ENDPOINT and OTEL_OPAMP_HEADERS. Call manage() once, after your setup: with no SDK set up, it warns and the application runs unmanaged. For full control, including sampling, use the launcher (opentelemetry-instrument or --import) or, in Python, logfire_fleet_otel.configure(). The Python and Node.js guides cover manage() in full.
Within a few seconds of starting, the setup shows the application as connected and its policy as applied:

The SDKs tab then lists the application with its connection, health, policy status and SDK policy. One row covers every running instance of the application.

- Open the application’s SDK policy from the SDKs tab or Policies.
- Set Minimum log level to Warn.
- Select Review policy, then publish it.
Within seconds the application stops sending info logs to the Live view, with no restart or deploy. Set it back to Application controlled to undo.
| Symptom | Check |
|---|---|
| The application never connects | Check that the Fleet package loads before your application starts, and that OTEL_OPAMP_ENDPOINT and OTEL_OPAMP_HEADERS are set in the application’s environment. Its logs name connection and authentication errors. |
| Connected, but Policy status shows Failed | Open the application in SDKs. It reports which setting it couldn’t apply and why. An application set up in code can’t take sampling or instrumentation changes. |
| A setting shows as unsupported | Not every setup supports every setting. Unsupported clients are left out of a rollout’s preview. |
| No telemetry arrives | Fleet doesn’t send telemetry. Check the application’s write token and region settings. |
Node.js prints MetadataLookupWarning at start | OpenTelemetry’s Google Cloud resource detector found no GCP metadata server, so it is harmless outside GCP. To skip the cloud detectors, set OTEL_NODE_RESOURCE_DETECTORS=env,host,os,process,serviceinstance. |
- Change policies: sampling rules, redaction, scrubbing and exports, and how to roll out a change to a few instances first.
- Scrubbing: what Logfire redacts by default.