Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #3428

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

test #3428

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 25 additions & 19 deletions weave/trace_server/clickhouse_trace_server_batched.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@
ENTITY_TOO_LARGE_PAYLOAD = '{"_weave": {"error":"<EXCEEDS_LIMITS>"}}'

CLICKHOUSE_DEFAULT_QUERY_SETTINGS = {
"max_memory_usage": 16 * 1024 * 1024 * 1024, # 16 GiB
# "max_memory_usage": 16 * 1024 * 1024 * 1024, # 16 GiB
"max_memory_usage": 1 * 1024 * 1024, # 1 MiB
}


Expand Down Expand Up @@ -1695,24 +1696,29 @@ def _query_stream(

summary = None
parameters = _process_parameters(parameters)
with self.ch_client.query_rows_stream(
query,
parameters=parameters,
column_formats=column_formats,
use_none=True,
settings=settings,
) as stream:
if isinstance(stream.source, QueryResult):
summary = stream.source.summary
logger.info(
"clickhouse_stream_query",
extra={
"query": query,
"parameters": parameters,
"summary": summary,
},
)
yield from stream
try:
with self.ch_client.query_rows_stream(
query,
parameters=parameters,
column_formats=column_formats,
use_none=True,
settings=settings,
) as stream:
if isinstance(stream.source, QueryResult):
summary = stream.source.summary
logger.info(
"clickhouse_stream_query",
extra={
"query": query,
"parameters": parameters,
"summary": summary,
},
)
yield from stream
except Exception as e:
# wrap exception with query and parameters
extra = {"query": query, "parameters": parameters}
raise type(e)(f"{str(e)} - Query: {query}, Parameters: {parameters}") from None

def _query(
self,
Expand Down
Loading