Use Longtext rather than varchar - #591
Open
bmschwa wants to merge 1 commit into
Open
Conversation
Queries get really big
Owner
|
nice suggestion. thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Queries get really big... was trying to get some data from langfuse & their api describes modifying the query parameters depending on what you want. So in curl, I ended up with something like this to get an overview of AI usage:
curl -vv -s -G "https://us.cloud.langfuse.com/api/public/v2/metrics" -u "xxx:yyy" --data-urlencode 'query={"view":"observations","dimensions":[{"field":"providedModelName"}],"metrics":[{"measure":"count","aggregation":"sum"},{"measure":"totalCost","aggregation":"sum"},{"measure":"totalTokens","aggregation":"sum"},{"measure":"inputTokens","aggregation":"sum"},{"measure":"outputTokens","aggregation":"sum"},{"aggregation":"avg", "measure":"latency"},{"aggregation":"p50", "measure":"latency"}],"fromTimestamp":"2026-08-04T00:00:00Z","toTimestamp":"2026-09-03T23:59:59Z","orderBy":[{"field":"sum_totalCost","direction":"desc"}],"config":{"row_limit":50}}'which works in curl but this monstrosity that needs to be kept in the database is:
https://us.cloud.langfuse.com/api/public/v2/metrics?query=%7b%22view%22%3a%22observations%22%2c%22dimensions%22%3a%5b%7b%22field%22%3a%22providedModelName%22%7d%5d%2c%22metrics%22%3a%5b%7b%22measure%22%3a%22count%22%2c%22aggregation%22%3a%22sum%22%7d%2c%7b%22measure%22%3a%22totalCost%22%2c%22aggregation%22%3a%22sum%22%7d%2c%7b%22measure%22%3a%22totalTokens%22%2c%22aggregation%22%3a%22sum%22%7d%2c%7b%22measure%22%3a%22inputTokens%22%2c%22aggregation%22%3a%22sum%22%7d%2c%7b%22measure%22%3a%22outputTokens%22%2c%22aggregation%22%3a%22sum%22%7d%2c%7b%22aggregation%22%3a%22avg%22%2c+%22measure%22%3a%22latency%22%7d%2c%7b%22aggregation%22%3a%22p50%22%2c+%22measure%22%3a%22latency%22%7d%5d%2c%22fromTimestamp%22%3a%222026-08-04T00%3a00%3a00Z%22%2c%22toTimestamp%22%3a%222026-09-03T23%3a59%3a59Z%22%2c%22orderBy%22%3a%5b%7b%22field%22%3a%22sum_totalCost%22%2c%22direction%22%3a%22desc%22%7d%5d%2c%22config%22%3a%7b%22row_limit%22%3a50%7d%7d