Skip to content
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

feat: add opentelemetry tracing support #39

Merged
merged 2 commits into from
Sep 30, 2024
Merged

feat: add opentelemetry tracing support #39

merged 2 commits into from
Sep 30, 2024

Conversation

david-zk
Copy link
Contributor

Adds opentelemetry tracing for fhe backend worker, we can see every work item processed with operation, input types, output type and output handle

image

@dartdart26 @antoniupop

@antoniupop
Copy link
Contributor

Any idea on the overhead this introduces? It doesn't look like it would be a lot, but we may want to have this set up so it can be enabled when needed and disabled in general.

@david-zk
Copy link
Contributor Author

david-zk commented Sep 30, 2024

Any idea on the overhead this introduces? It doesn't look like it would be a lot, but we may want to have this set up so it can be enabled when needed and disabled in general.

I think it is minimal, any tfhe or network operation will be much slower than tracing. At least in the beginning of the project I believe it is critical we have a good tracing of which ciphertexts are slowly executed so it would be easier to troubleshoot issues.

As for the implementation, all traces are tracked in memory and flushed in the background by batches, it shouldn't be noticeable or disruptive to our application in any way.

In production enabling traces post factum when something happened is already too late, it is standard practice to have that information beforehand.

Copy link
Collaborator

@dartdart26 dartdart26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Added some minor comments that can be handled separately.

Comment on lines +68 to +70
if let Err(err) = tracing::setup_tracing() {
panic!("Error while initializing tracing: {:?}", err);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: to avoid if statements, we could make main() return a Result and use ?.

@@ -390,7 +390,8 @@ impl SupportedFheCiphertexts {
SupportedFheCiphertexts::FheBytes128(_) => 10,
SupportedFheCiphertexts::FheBytes256(_) => 11,
SupportedFheCiphertexts::Scalar(_) => {
panic!("we should never need to serialize scalar")
// need this for tracing as we join types of computation for a trace
200
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can define a constant somewhere to say that 200 or some bigger number is "invalid"?

@david-zk david-zk merged commit 2a695ec into main Sep 30, 2024
2 checks passed
@david-zk david-zk deleted the davidk/tracing branch September 30, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants