Skip to main content

LogStream

Object-centric interface for Galileo log streams. This class provides an intuitive way to work with Galileo log streams, offering methods for managing log streams and their associated metrics. Examples

context

Get a galileo context manager for this log stream. This is a convenient method that returns a pre-configured galileo_context for this log stream, eliminating the need to specify project and log stream names. Examples

create

Persist this log stream to the API. Examples

export_records

Export records from this log stream. This method provides a convenient way to export records without needing to specify project_id or log_stream_id. Arguments
  • record_type: The type of records to export (SPAN, TRACE, or SESSION).
  • filters: A list of filters to apply to the export.
  • sort: A sort clause to order the exported records.
  • export_format: The desired format for the exported data.
  • column_ids: A list of column IDs to include in the export.
  • redact: Redact sensitive data from the response.

get

Get an existing log stream by name. Arguments
  • name (str): The log stream name.
  • project_id (Optional[str]): The project ID. If neither project_id nor project_name is provided, falls back to GALILEO_PROJECT_ID or GALILEO_PROJECT environment variables.
  • project_name (Optional[str]): The project name. If neither project_id nor project_name is provided, falls back to GALILEO_PROJECT environment variable.

get_metrics

Get the list of metrics currently enabled on this log stream. Examples

get_sessions

Query sessions in this log stream. This is a convenience method that queries for sessions specifically. Arguments
  • filters: A list of filters to apply to the query.
  • sort: A sort clause to order the query results.
  • limit: The maximum number of records to return.
  • starting_token: The token for the next page of results.

get_spans

Query spans in this log stream. This is a convenience method that queries for spans specifically. Arguments
  • filters: A list of filters to apply to the query.
  • sort: A sort clause to order the query results.
  • limit: The maximum number of records to return.
  • starting_token: The token for the next page of results.

get_traces

Query traces in this log stream. This is a convenience method that queries for traces specifically. Arguments
  • filters: A list of filters to apply to the query.
  • sort: A sort clause to order the query results.
  • limit: The maximum number of records to return.
  • starting_token: The token for the next page of results.

list

List log streams for a project. Returns a single page of results. Use starting_token (from next_starting_token on a prior response) to fetch subsequent pages. Arguments
  • project_id (Optional[str]): The project ID. If neither project_id nor project_name is provided, falls back to GALILEO_PROJECT_ID or GALILEO_PROJECT environment variables.
  • project_name (Optional[str]): The project name. If neither project_id nor project_name is provided, falls back to GALILEO_PROJECT environment variable.
  • limit (Union[Unset, int]): Maximum number of log streams to return per page. Defaults to 100.
  • starting_token (Union[Unset, int]): Pagination token to start from. Defaults to 0 (first page).

project

Get the project this log stream belongs to.

query

Query records in this log stream. This method provides a convenient way to search spans, traces, or sessions within the current log stream without needing to specify project_id or log_stream_id. Arguments
  • record_type: The type of records to query (SPAN, TRACE, or SESSION).
  • filters: A list of filters to apply to the query.
  • sort: A sort clause to order the query results.
  • limit: The maximum number of records to return.
  • starting_token: The token for the next page of results.

refresh

Refresh this log stream’s state from the API. Updates all attributes with the latest values from the remote API and sets the state to SYNCED. Examples

session_columns

Get available columns for sessions in this log stream. Examples

set_metrics

Set (replace) the metrics on this log stream. This replaces any existing metrics with the new list. Alias for enable_metrics with clearer naming intent. Arguments
  • metrics: List of metrics to set. Supports:
    • GalileoMetrics enum values (e.g., GalileoMetrics.correctness)
    • Metric objects (including from Metric.get(id=”…”))
    • LocalMetricConfig objects for custom scoring functions
    • String names of built-in metrics

span_columns

Get available columns for spans in this log stream. Examples

trace_columns

Get available columns for traces in this log stream. Examples