Skip to content

Instantly share code, notes, and snippets.

@kinano
Created July 17, 2025 21:00
Show Gist options
  • Select an option

  • Save kinano/4969b9d9128d24a3d73eb5b7f0746dbb to your computer and use it in GitHub Desktop.

Select an option

Save kinano/4969b9d9128d24a3d73eb5b7f0746dbb to your computer and use it in GitHub Desktop.
Arize log_evaluations_sync rate limits
import pandas as pd
from src.care_plan_generator.helpers.arize_instrumentation import (
ARIZE_API_KEY,
ARIZE_SPACE_ID,
ARIZE_PROJECT_NAME,
)
from arize.pandas.logger import Client
from pydantic import BaseModel
from time import sleep
class Eval(BaseModel):
label: str
name: str
explanation: str
def log_eval(span_id: str, eval: Eval):
arize_client = Client(space_id=ARIZE_SPACE_ID, api_key=ARIZE_API_KEY)
label_key = f"eval.{eval.name}.label"
label_value = eval.label
explanation_key = f"eval.{eval.name}.explanation"
explanation_value = eval.explanation
eval_data = {
"context.span_id": [span_id],
label_key: [label_value],
explanation_key: [explanation_value],
}
eval_df = pd.DataFrame(eval_data)
eval_df.head()
arize_client.log_evaluations_sync(
dataframe=eval_df, project_name=ARIZE_PROJECT_NAME
)
def log_evals(span_id: str, evals: list[Eval]):
for eval in evals:
log_eval(span_id, eval)
sleep(1)
if __name__ == "__main__":
# component
log_evals(
span_id="obfuscated",
evals=[
Eval(
label="pass",
name="obfuscated",
explanation="obfuscated",
),
Eval(
label="pass",
name="obfuscated",
explanation="obfuscated",
),
Eval(
label="pass",
name="obfuscated",
explanation="obfuscated",
),
Eval(
label="pass",
name="obfuscated",
explanation="obfuscated",
),
Eval(
label="pass",
name="obfuscated",
explanation="obfuscated",
),
Eval(
label="pass",
name="obfuscated",
explanation="obfuscated",
),
],
)
Error logging evaluation data to Arize
Traceback (most recent call last):
File "/Users/kinan/dev/care-plan-generator/.venv/lib/python3.12/site-packages/arize/pandas/logger.py", line 1777, in _log_arrow_flight
with flight_writer:
^^^^^^^^^^^^^
File "pyarrow/ipc.pxi", line 543, in pyarrow.lib._CRecordBatchWriter.__exit__
File "pyarrow/_flight.pyx", line 1238, in pyarrow._flight.MetadataRecordBatchWriter.close
File "pyarrow/_flight.pyx", line 64, in pyarrow._flight.check_flight_status
pyarrow._flight.FlightUnauthenticatedError: Flight returned unauthenticated error, with message: auth-error: rpc error: code = ResourceExhausted desc = Exceeds requests rate limit. gRPC client debug context: UNKNOWN:Error received from peer ipv4:xxx {grpc_message:"auth-error: rpc error: code = ResourceExhausted desc = Exceeds requests rate limit", grpc_status:16, created_time:"2025-07-17T16:55:59.364211-04:00"}. Client context: OK
Error logging evaluation data to Arize
Traceback (most recent call last):
File "/Users/kinan/dev/care-plan-generator/.venv/lib/python3.12/site-packages/arize/pandas/logger.py", line 1777, in _log_arrow_flight
with flight_writer:
^^^^^^^^^^^^^
File "pyarrow/ipc.pxi", line 543, in pyarrow.lib._CRecordBatchWriter.__exit__
File "pyarrow/_flight.pyx", line 1238, in pyarrow._flight.MetadataRecordBatchWriter.close
File "pyarrow/_flight.pyx", line 64, in pyarrow._flight.check_flight_status
pyarrow._flight.FlightUnauthenticatedError: Flight returned unauthenticated error, with message: auth-error: rpc error: code = ResourceExhausted desc = Exceeds requests rate limit. gRPC client debug context: UNKNOWN:Error received from peer ipv4:xxx {created_time:"2025-07-17T16:56:01.942378-04:00", grpc_status:16, grpc_message:"auth-error: rpc error: code = ResourceExhausted desc = Exceeds requests rate limit"}. Client context: OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment