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 0x7f849e5b18d0>, service_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b2b10>, limit: 'int' = <typer.models.OptionInfo object at 0x7f849e5b2ed0>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b3590>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b1490>) -> 'None'

List or get traces from the OTEL service.

def metrics(metric_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b1650>, service_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b2850>, limit: 'int' = <typer.models.OptionInfo object at 0x7f849e5b36d0>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b3090>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b3210>) -> 'None'

Query metrics from the OTEL service.

def logs(service_name: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b2290>, severity: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b1710>, trace_id: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b2510>, limit: 'int' = <typer.models.OptionInfo object at 0x7f849e5b0810>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b0b50>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b1ad0>) -> 'None'

Query log records from the OTEL service.

def query(sql: 'str' = <typer.models.ArgumentInfo object at 0x7f849e5b2210>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b2310>, raw: 'bool' = <typer.models.OptionInfo object at 0x7f849e5b0c50>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b0b90>) -> 'None'

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

def admin_sql(sql: 'str' = <typer.models.ArgumentInfo object at 0x7f849e5b0c10>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b3ad0>, raw: 'bool' = <typer.models.OptionInfo object at 0x7f849e5b2a90>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b0d90>) -> '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 0x7f849e5b1110>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b1990>) -> 'None'

Show storage statistics from the running OTEL service.

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

List all observed service names.

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

Force-flush all buffered telemetry data to Parquet storage.

def smoke_test(otlp_endpoint: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b03d0>, base_url: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b1410>, service_name: 'str' = <typer.models.OptionInfo object at 0x7f849e5b3e10>, wait: 'int' = <typer.models.OptionInfo object at 0x7f849e5b0150>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b0050>) -> '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 0x7f849e5b34d0>, service_name: 'str' = <typer.models.OptionInfo object at 0x7f849e5b0f50>, interval: 'float' = <typer.models.OptionInfo object at 0x7f849e5b0290>, count: 'int' = <typer.models.OptionInfo object at 0x7f849e5b3750>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b1a10>) -> '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 0x7f849e5b20d0>, service_name: 'str' = <typer.models.OptionInfo object at 0x7f849e5b00d0>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b2f50>, verbose: 'bool' = <typer.models.OptionInfo object at 0x7f849e5b11d0>) -> '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 0x7f849e5b1c90>, token: 'Optional[str]' = <typer.models.OptionInfo object at 0x7f849e5b2a10>, json_output: 'bool' = <typer.models.OptionInfo object at 0x7f849e5b1750>) -> '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.