Skip to main content

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') -> 'None'

OpenTelemetry observability commands – query traces, metrics, logs.

def traces(trace_id: 'Optional[str]' = <typer.models.ArgumentInfo object at 0x7f2348a82990>, service_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a83cd0>, limit: 'int' = <typer.models.OptionInfo object at 0x7f2348a81410>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a83590>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a83a50>) -> 'None'

List or get traces from the OTEL service.

def metrics(metric_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a82d10>, service_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a81910>, limit: 'int' = <typer.models.OptionInfo object at 0x7f2348a802d0>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a80990>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a80710>) -> 'None'

Query metrics from the OTEL service.

def logs(service_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a811d0>, severity: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a80650>, trace_id: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a81c90>, limit: 'int' = <typer.models.OptionInfo object at 0x7f2348a80790>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a80090>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a829d0>) -> 'None'

Query log records from the OTEL service.

def query(sql: 'str' = <typer.models.ArgumentInfo object at 0x7f2348a805d0>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a80a10>, raw: 'bool' = <typer.models.OptionInfo object at 0x7f2348a82ad0>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a814d0>) -> 'None'

Run an ad-hoc SQL query via the SQL Engine engine.

def admin_sql(sql: 'str' = <typer.models.ArgumentInfo object at 0x7f2348a83e50>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a834d0>, raw: 'bool' = <typer.models.OptionInfo object at 0x7f2348a82910>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a82610>) -> '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 0x7f2348a83150>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a80c50>) -> 'None'

Show storage statistics from the running OTEL service.

def list_services(base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a80b50>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a82f90>) -> 'None'

List all observed service names.

def flush(base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a83f90>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a80bd0>) -> 'None'

Force-flush all buffered telemetry data to Parquet storage.

def smoke_test(otlp_endpoint: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a80450>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a82f50>, service_name: 'str' = <typer.models.OptionInfo object at 0x7f2348a82490>, wait: 'int' = <typer.models.OptionInfo object at 0x7f2348a838d0>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a81690>) -> 'None'

End-to-end smoke test: send traces, metrics and logs, then query them back.

This command exercises the full OTEL pipeline:

  1. Emit test traces (spans) via the OpenTelemetry SDK
  2. Emit test metrics via the OpenTelemetry SDK
  3. Emit test logs via the OpenTelemetry SDK
  4. Wait for ingestion
  5. Flush the service buffers
  6. Query traces, metrics and logs back via REST endpoints
  7. Run ad-hoc SQL queries via SQL Engine

def load_test(otlp_endpoint: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a80ad0>, service_name: 'str' = <typer.models.OptionInfo object at 0x7f2348a839d0>, interval: 'float' = <typer.models.OptionInfo object at 0x7f2348a80750>, count: 'int' = <typer.models.OptionInfo object at 0x7f2348a81750>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a83090>) -> 'None'

Continuously send traces, metrics and logs at a configurable interval.

Exercises the full OTEL ingest pipeline in a loop:

  1. Emit test traces, metrics and logs via the OpenTelemetry SDK
  2. Wait for --interval seconds
  3. 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 0x7f2348a82cd0>, service_name: 'str' = <typer.models.OptionInfo object at 0x7f2348a82110>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a82690>, verbose: 'bool' = <typer.models.OptionInfo object at 0x7f2348a80f10>) -> '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 0x7f2348a81850>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f2348a83f10>, json_output: 'bool' = <typer.models.OptionInfo object at 0x7f2348a820d0>) -> '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.