Re. Agent Observability: Using Langchain and OpenI...
# openobserve
p
Re. Agent Observability: Using Langchain and OpenInference for collecting traces. Seeing following error while quering traces after upgrading to v0.91.0
Copy code
Error during planning: Internal error: Function 'sum' failed to match any signature, errors: Error during planning: Function 'sum' requires TypeSignatureClass::Decimal, but received String (DataType: Utf8View).,Error during planning: Function 'sum' requires TypeSignatureClass::Native(LogicalType(Native(UInt64), UInt64)), but received String (DataType: Utf8View).,Error during planning: Function 'sum' requires TypeSignatureClass::Native(LogicalType(Native(Int64), Int64)), but received String (DataType: Utf8View).,Error during planning: Function 'sum' requires TypeSignatureClass::Native(LogicalType(Native(Float64), Float64)), but received String (DataType: Utf8View).,Error during planning: Function 'sum' requires TypeSignatureClass::Duration, but received String (DataType: Utf8View).. This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: <https://github.com/apache/datafusion/issues> No function matches the given name and argument types 'sum(Utf8View)'. You might need to add explicit type casts. Candidate functions: sum(Coercion(TypeSignatureClass::Decimal)) sum(Coercion(TypeSignatureClass::Native(LogicalType(Native(UInt64), UInt64)), implicit_coercion=ImplicitCoercion([Native(LogicalType(Native(UInt8), UInt8)), Native(LogicalType(Native(UInt16), UInt16)), Native(LogicalType(Native(UInt32), UInt32))], default_type=UInt64)) sum(Coercion(TypeSignatureClass::Native(LogicalType(Native(Int64), Int64)), implicit_coercion=ImplicitCoercion([Native(LogicalType(Native(Int8), Int8)), Native(LogicalType(Native(Int16), Int16)), Native(LogicalType(Native(Int32), Int32))], default_type=Int64)) sum(Coercion(TypeSignatureClass::Native(LogicalType(Native(Float64), Float64)), implicit_coercion=ImplicitCoercion([Float], default_type=Float64)) sum(Coercion(TypeSignatureClass::Duration))
I have not seen this error in past versions.
u
yes, for the gen ai traces stream we compute calculate some additional metadata like total tokens and cost. can you help with the following? • do you have UDS enabled? • can you share the data type for these fields in your stream schema:
Copy code
gen_ai_usage_input_tokens
gen_ai_usage_output_tokens
gen_ai_usage_total_tokens
gen_ai_usage_cost
also which version were you using before upgrading to 0.91.0?
p
We were on v0.50.3
UDS is not enabled. I see following properties in one of the span:
Copy code
usage_metadata\": {\"input_tokens\": 11397, \"output_tokens\": 689, \"total_tokens\": 12086, \"input_token_details\": {\"audio\": 0, \"cache_read\": 0}, \"output_token_details\": {\"audio\": 0, \"reasoning\": 104}}}
BTW, we using openrouter for llm access
👍 1
u
can you check this page ? openobserve.ai/docs/…/schema-settings if you search for gen_ai_usage and you dont see these attributes, it is a migration issue where the schema did not get updated. If so, we can manually add these fields with float data type. then the traces page for that stream will work fine.
p
I see them are utf8. How to update?
u
since utf8 is the last state of schema evolution we cannot go from utf8 to float. please delete these fields and create new with data type float
p
Seems to be resolved now. I can see traces. Thanks
👍 1
Is there plan to add openrouter trace support to extract input/output metadata? Right now, I dont see token usage in the traces attributes.
u
no plans as of now. we primarily support gen ai and custom attributes of other common frameworks. let me check the docs and see if we can support it.
p
No. Agent is instrumented to send traces to OTel collector
u
ok, token usage should be mapped to gen_ai_usage_(input/output)_tokens so it should work ideally. can you share the attributes of a span which has operation name chat or generation?
p
I switched from openinference to otel native library. That resolved.
👍 1