AppFlowy-IO / AppFlowy-Cloud

AppFlowy is an open-source alternative to Notion. You are in charge of your data and customizations. Built with Flutter and Rust.
GNU Affero General Public License v3.0
528 stars 145 forks source link

let prometheus track open ai tokens used on search #608

Closed Horusiath closed 3 weeks ago

Horusiath commented 4 weeks ago

This PR registers a new search_tokens_used counter in prometheus so that we can track how many OpenAI API tokens are used over time.

speed2exe commented 4 weeks ago

@Horusiath are the AI token usage tied to workspace or user?

Horusiath commented 3 weeks ago

Right now they are not grouped by anything. After talking with @appflowy we haven't decided yet on what attribute group them by.

speed2exe commented 3 weeks ago

@Horusiath No problems, we can add them later if needed.

Horusiath commented 3 weeks ago

I've added workspace id as a label to token metrics (as we discussed it with @appflowy ). With that state of the PR, we are ready to merge it.