-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add support for backend telemetry (tracing & metrics) #1013
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,19 @@ | |||
import { defineConfig } from "vite"; | |||
|
|||
export default defineConfig({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We unfortunately need a second build step because sveltekit overrides vite's rollupOptions
which we need to specify a second entrypoint
This uses the opentelemetry SDK to provide support for traces and two simple metrics (a conversations count and a messages count). The telemetry entrypoint is built separately (unfortunately it does not seem like there is a method for doing this in one build as sveltekit overrides rollupOptions). As written the metrics may be too high cardinality for some use cases (as they are keyed per user), but these attributes can always be dropped in a collector.
@@ -0,0 +1,7 @@ | |||
#!/bin/bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workaround for open-telemetry/opentelemetry-js#3989
Very happy to see this contribution! I was also missing having better observability since we currently have little visibility on how many users we have and how they are using chat-ui |
Hi @nsarrazin if you dont mind me asking, are we looking to merge this PR or to support observability in a different way? |
Hey so I was working on adding support for prometheus metrics because we need them for HuggingChat but I think we can probably do it with this PR! Thanks for the contribution. 🚀 I'd like to have a |
The type checking error seems to be reported here open-telemetry/opentelemetry-js#3944 |
It looks like this is possible via the prometheus exporter. If we add this I would like to keep the opentelemetry exporter as an option. flowchart LR
c["chat-ui"]-->|Prometheus|m["/metrics"]
Alternatively we could only support otlp exports and anyone who wanted a prometheus endpoint could get it through the opentelemetry-collector: flowchart LR
chat-ui --> |OTLP|opentelemetry-collector-->|Prometheus|/metrics
opentelemetry-collector-->|prometheus-remote-write|endpoint
In my experience with opentelemetry so far using a collector has been pretty useful to add/transform labels, drop healthcheck data, etc |
Resolves the issue described in open-telemetry/opentelemetry-js#3944
As written these were always undefined, can re-add them later if desired.
This uses the opentelemetry SDK to provide support for traces and two simple metrics (a conversations count and a messages count).
The telemetry entrypoint is built separately (unfortunately it does not seem like there is a method for doing this in one build as sveltekit overrides rollupOptions).
As written the metrics may be too high cardinality for some use cases (as they are keyed per user), but these attributes can always be dropped in a collector.
Fixes #692, #633