otel
OTEL commands for the Datalayer CLI.
Provides subcommands to query and interact with the Datalayer OTEL service::
datalayer otel traces # List / get traces datalayer otel metrics # Query metrics datalayer otel logs # Query logs datalayer otel query # Run ad-hoc SQL via SQL Engine (user-scoped) datalayer otel sql # Run arbitrary SQL as platform_admin (no user filter) datalayer otel stats # Show storage statistics datalayer otel services # List observed service names datalayer otel flush # Force-flush buffered data datalayer otel smoke-test # Send traces/metrics/logs and query them back datalayer otel load-test # Continuously send test data at a configurable interval datalayer otel logfire-test # Send test traces/metrics/logs via Logfire to local OTLP
def main(ctx: 'typer.Context')
OpenTelemetry observability commands – query traces, metrics, logs.
def traces(trace_id: 'Optional[str]' = <typer.models.ArgumentInfo object at 0x7f965a511090>, service_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a5110d0>, limit: 'int' = <typer.models.OptionInfo object at 0x7f965a5115d0>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a513a90>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a510690>) -> 'None'
List or get traces from the OTEL service.
def metrics(metric_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a512310>, service_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a510dd0>, limit: 'int' = <typer.models.OptionInfo object at 0x7f965a511390>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a5120d0>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a510ed0>) -> 'None'
Query metrics from the OTEL service.
def logs(service_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a510f10>, severity: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a511c50>, trace_id: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a5101d0>, limit: 'int' = <typer.models.OptionInfo object at 0x7f965a5124d0>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a510510>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a512510>) -> 'None'
Query log records from the OTEL service.
def query(sql: 'str' = <typer.models.ArgumentInfo object at 0x7f965a512d10>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a513190>, raw: 'bool' = <typer.models.OptionInfo object at 0x7f965a510950>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a510910>) -> 'None'
Run an ad-hoc SQL query via the SQL Engine engine.
def admin_sql(sql: 'str' = <typer.models.ArgumentInfo object at 0x7f965a510550>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a513310>, raw: 'bool' = <typer.models.OptionInfo object at 0x7f965a5123d0>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a511dd0>) -> 'None'
Run an arbitrary SQL query as platform_admin (no user-scope filtering).
Useful for inspecting raw table contents across all accounts. Requires the DATALAYER_API_KEY to belong to a platform_admin user.
def stats(base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a510290>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a510210>) -> 'None'
Show storage statistics from the running OTEL service.
def list_services(base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a6f7f10>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a6f6990>) -> 'None'
List all observed service names.
def flush(base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a6f6e50>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a6f4390>) -> 'None'
Force-flush all buffered telemetry data to Parquet storage.
def smoke_test(otlp_endpoint: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a6f40d0>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a6f4b90>, service_name: 'str' = <typer.models.OptionInfo object at 0x7f965a6f5190>, wait: 'int' = <typer.models.OptionInfo object at 0x7f965a6f5690>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a6f5c10>) -> 'None'
End-to-end smoke test: send traces, metrics and logs, then query them back.
This command exercises the full OTEL pipeline:
- Emit test traces (spans) via the OpenTelemetry SDK
- Emit test metrics via the OpenTelemetry SDK
- Emit test logs via the OpenTelemetry SDK
- Wait for ingestion
- Flush the service buffers
- Query traces, metrics and logs back via REST endpoints
- Run ad-hoc SQL queries via SQL Engine
def load_test(otlp_endpoint: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a512cd0>, service_name: 'str' = <typer.models.OptionInfo object at 0x7f965a6f6410>, interval: 'float' = <typer.models.OptionInfo object at 0x7f965a6f47d0>, count: 'int' = <typer.models.OptionInfo object at 0x7f965a6f4bd0>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a6f6d90>) -> 'None'
Continuously send traces, metrics and logs at a configurable interval.
Exercises the full OTEL ingest pipeline in a loop:
- Emit test traces, metrics and logs via the OpenTelemetry SDK
- Wait for --interval seconds
- Repeat until --count is reached or Ctrl+C is pressed
Examples:
Send data every 5 seconds indefinitely:
datalayer otel load-test
Send 10 bursts every 2 seconds using a specific service name:
datalayer otel load-test --count 10 --interval 2 --service my-service
def logfire_test(otlp_endpoint: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a6f4910>, service_name: 'str' = <typer.models.OptionInfo object at 0x7f965a6f62d0>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a6f7bd0>, verbose: 'bool' = <typer.models.OptionInfo object at 0x7f965a6f45d0>) -> 'None'
Send test traces, metrics and logs via the Logfire library to the local OTLP endpoint.
Uses the pydantic logfire library for traces and logs, and the OpenTelemetry SDK for metrics. All data is forwarded to the local OTLP collector (--otlp-endpoint) so it is visible in the Datalayer OTEL example UI.
Logfire is configured with send_to_logfire=False so no cloud token is required.
def system(base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a6f63d0>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f965a6f6510>, json_output: 'bool' = <typer.models.OptionInfo object at 0x7f965a6f4dd0>) -> 'None'
Show system statistics (platform_admin only).
Displays service memory/CPU, disk space, row counts per table,
and number of distinct users. Requires a token with the
platform_admin role.