WeaviateEx.Debug (WeaviateEx v0.7.4)

View Source

Debug utilities for troubleshooting Weaviate operations.

Provides REST-based object retrieval for comparison with gRPC results, request/response logging, and diagnostic helpers.

Features

  • Protocol Comparison: Compare objects retrieved via REST vs gRPC
  • Request Logging: Track all requests for debugging
  • Connection Info: Inspect current connection state

Example

# Compare REST and gRPC responses
{:ok, result} = Debug.compare_protocols(client, "Article", uuid)
if result.match do
  IO.puts("Responses match!")
else
  IO.puts(Debug.ObjectCompare.format_diff(result.differences))
end

# Get connection details
{:ok, info} = Debug.connection_info(client)
IO.puts("Connected to: #{info.base_url}")

Summary

Functions

Fetch object via both protocols and compare results.

Get current connection state and configuration.

Retrieve object via REST API (bypasses gRPC for comparison).

Types

client()

@type client() :: WeaviateEx.Client.t()

collection()

@type collection() :: String.t()

comparison_result()

@type comparison_result() :: WeaviateEx.Debug.ObjectCompare.comparison_result()

connection_info()

@type connection_info() :: %{
  base_url: String.t(),
  grpc_host: String.t(),
  grpc_port: non_neg_integer(),
  grpc_connected: boolean(),
  tls_enabled: boolean(),
  api_key_configured: boolean()
}

uuid()

@type uuid() :: String.t()

Functions

compare_protocols(client, collection, uuid, opts \\ [])

@spec compare_protocols(client(), collection(), uuid(), keyword()) ::
  {:ok, comparison_result()} | {:error, WeaviateEx.Error.t()}

Fetch object via both protocols and compare results.

Returns a comparison result showing whether the objects match and detailing any differences found.

Parameters

  • client - WeaviateEx client
  • collection - Collection name
  • uuid - Object UUID
  • opts - Options passed to both REST and gRPC calls

Example

{:ok, result} = Debug.compare_protocols(client, "Article", uuid)
if result.match do
  IO.puts("Objects are identical")
else
  IO.puts(ObjectCompare.format_diff(result.differences))
end

connection_info(client)

@spec connection_info(client()) ::
  {:ok, connection_info()} | {:error, WeaviateEx.Error.t()}

Get current connection state and configuration.

Returns information about the client's connection including:

  • HTTP base URL
  • gRPC host and port
  • Whether gRPC is connected
  • TLS status
  • API key configuration status

Example

{:ok, info} = Debug.connection_info(client)
IO.puts("Base URL: #{info.base_url}")
IO.puts("gRPC connected: #{info.grpc_connected}")

get_object_grpc(client, collection, uuid, opts \\ [])

@spec get_object_grpc(client(), collection(), uuid(), keyword()) ::
  {:ok, map()} | {:error, WeaviateEx.Error.t()}

Retrieve object via gRPC API.

Parameters

  • client - WeaviateEx client
  • collection - Collection name
  • uuid - Object UUID
  • opts - Options:
    • :tenant - Tenant name for multi-tenant collections
    • :include - List of additional fields to include

Example

{:ok, object} = Debug.get_object_grpc(client, "Article", uuid)

get_object_rest(client, collection, uuid, opts \\ [])

@spec get_object_rest(client(), collection(), uuid(), keyword()) ::
  {:ok, map()} | {:error, WeaviateEx.Error.t()}

Retrieve object via REST API (bypasses gRPC for comparison).

Parameters

  • client - WeaviateEx client
  • collection - Collection name
  • uuid - Object UUID
  • opts - Options:
    • :tenant - Tenant name for multi-tenant collections
    • :include - List of additional fields to include (e.g., ["vector"])
    • :node_name - Target node for debug reads in clustered setups
    • :consistency_level - Read consistency level (e.g., "ONE", "QUORUM", "ALL")

Example

{:ok, object} = Debug.get_object_rest(client, "Article", uuid)
{:ok, object} = Debug.get_object_rest(client, "Article", uuid, tenant: "tenant-a")