Class: Hatchet::Features::Logs

Inherits:
Object
  • Object
show all
Defined in:
lib/hatchet/features/logs.rb

Overview

Logs client for interacting with Hatchet’s logs API

This class provides a high-level interface for listing log lines associated with task runs in the Hatchet system.

Examples:

Listing logs for a task run

logs = logs_client.list("task-run-id", limit: 100)

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initialize(rest_client, config) ⇒ void

Initializes a new Logs client instance

Parameters:

  • rest_client (Object)

    The configured REST client for API communication

  • config (Hatchet::Config)

    The Hatchet configuration containing tenant_id and other settings

Since:

  • 0.1.0



23
24
25
26
27
# File 'lib/hatchet/features/logs.rb', line 23

def initialize(rest_client, config)
  @rest_client = rest_client
  @config = config
  @log_api = HatchetSdkRest::LogApi.new(rest_client)
end

Instance Method Details

#list(task_run_id, limit: 1000, since: nil, until_time: nil) ⇒ Object

List log lines for a given task run

Examples:

logs = logs_client.list("task-run-123", limit: 500, since: Time.now - 3600)

Parameters:

  • task_run_id (String)

    The ID of the task run to list logs for

  • limit (Integer) (defaults to: 1000)

    Maximum number of log lines to return (default: 1000)

  • since (Time, nil) (defaults to: nil)

    The start time to get logs for

  • until_time (Time, nil) (defaults to: nil)

    The end time to get logs for

Returns:

  • (Object)

    A list of log lines for the specified task run

Raises:

Since:

  • 0.1.0



39
40
41
42
43
44
45
46
47
48
# File 'lib/hatchet/features/logs.rb', line 39

def list(task_run_id, limit: 1000, since: nil, until_time: nil)
  @log_api.v1_log_line_list(
    task_run_id,
    {
      limit: limit,
      since: since&.utc&.iso8601,
      _until: until_time&.utc&.iso8601,
    },
  )
end