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 0x7f0f78b7b5d0>, service_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7a890>, limit: 'int' = <typer.models.OptionInfo object at 0x7f0f78b7b8d0>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b79210>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7bcd0>) -> 'None'

List or get traces from the OTEL service.

def metrics(metric_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b79590>, service_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7aa10>, limit: 'int' = <typer.models.OptionInfo object at 0x7f0f78b7a910>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b78e90>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7b890>) -> 'None'

Query metrics from the OTEL service.

def logs(service_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7bc50>, severity: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7b9d0>, trace_id: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b78090>, limit: 'int' = <typer.models.OptionInfo object at 0x7f0f78b7a850>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7a810>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7bc10>) -> 'None'

Query log records from the OTEL service.

def query(sql: 'str' = <typer.models.ArgumentInfo object at 0x7f0f78b78ed0>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7a8d0>, raw: 'bool' = <typer.models.OptionInfo object at 0x7f0f78b79e50>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7a7d0>) -> 'None'

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

def admin_sql(sql: 'str' = <typer.models.ArgumentInfo object at 0x7f0f78b79d50>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b78290>, raw: 'bool' = <typer.models.OptionInfo object at 0x7f0f78b7b490>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b79550>) -> '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 0x7f0f78b78cd0>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7a650>) -> 'None'

Show storage statistics from the running OTEL service.

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

List all observed service names.

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

Force-flush all buffered telemetry data to Parquet storage.

def smoke_test(otlp_endpoint: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7abd0>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b780d0>, service_name: 'str' = <typer.models.OptionInfo object at 0x7f0f78b7a9d0>, wait: 'int' = <typer.models.OptionInfo object at 0x7f0f78b7a790>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7b650>) -> '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 0x7f0f78b79190>, service_name: 'str' = <typer.models.OptionInfo object at 0x7f0f78b7b190>, interval: 'float' = <typer.models.OptionInfo object at 0x7f0f78b79f10>, count: 'int' = <typer.models.OptionInfo object at 0x7f0f78b79150>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7a550>) -> '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 0x7f0f78b79c10>, service_name: 'str' = <typer.models.OptionInfo object at 0x7f0f78b7ab10>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b7be50>, verbose: 'bool' = <typer.models.OptionInfo object at 0x7f0f78b79f50>) -> '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 0x7f0f78b79a10>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f0f78b79610>, json_output: 'bool' = <typer.models.OptionInfo object at 0x7f0f78b784d0>) -> '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.