WeaviateEx.Debug (WeaviateEx v0.7.4)
View SourceDebug 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 gRPC API.
Retrieve object via REST API (bypasses gRPC for comparison).
Types
@type client() :: WeaviateEx.Client.t()
@type collection() :: String.t()
@type comparison_result() :: WeaviateEx.Debug.ObjectCompare.comparison_result()
@type uuid() :: String.t()
Functions
@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 clientcollection- Collection nameuuid- Object UUIDopts- 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
@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}")
@spec get_object_grpc(client(), collection(), uuid(), keyword()) :: {:ok, map()} | {:error, WeaviateEx.Error.t()}
Retrieve object via gRPC API.
Parameters
client- WeaviateEx clientcollection- Collection nameuuid- Object UUIDopts- 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)
@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 clientcollection- Collection nameuuid- Object UUIDopts- 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")