- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.4k
 
feat(kms-connector): shared otlp context #1031
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
Conversation
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.
Pull Request Overview
This PR implements shared OTLP (OpenTelemetry) context propagation across the KMS connector services to enable distributed tracing. The changes add tracing context to database models and propagate it through the event processing pipeline from gateway events to KMS responses.
- Refactored 
GatewayEventandKmsResponsefrom enums to structs containingkindandotlp_contextfields - Added 
PropagationContexttype for serializing/deserializing OpenTelemetry trace context - Updated database schema to store OTLP context in all event and response tables
 
Reviewed Changes
Copilot reviewed 22 out of 38 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description | 
|---|---|
| kms-connector/crates/utils/src/types/mod.rs | Made gw_event and kms_response modules public and exported new types | 
| kms-connector/crates/utils/src/types/kms_response.rs | Refactored KmsResponse to struct with kind and otlp_context fields | 
| kms-connector/crates/utils/src/types/gw_event.rs | Refactored GatewayEvent to struct with kind and otlp_context fields | 
| kms-connector/crates/utils/src/monitoring/otlp.rs | Added PropagationContext type for OTLP context serialization | 
| Multiple test files | Updated tests to work with new struct-based event/response types | 
| Database migration | Added otlp_context columns to all event and response tables | 
Files not reviewed (15)
- kms-connector/.sqlx/query-1a43a1973631354ba7c92764223b8acaaba30982fbf37619f9982ee5adac8b04.json: Language not supported
 - kms-connector/.sqlx/query-2006d0c6aa7ad4945af0ae9d6fa99d64f62543158c13f34b0096e56357539ba1.json: Language not supported
 - kms-connector/.sqlx/query-3632e17b59f53983cc2f385caf05b37d8f730eef72776bee1de3356a605b0714.json: Language not supported
 - kms-connector/.sqlx/query-39c059ee786b91cdda4288eecc1af69b8166dc79e4754ca74ee373c1cfaa5066.json: Language not supported
 - kms-connector/.sqlx/query-3c1d97d4cb3eb8a3c1c3f5dccc6beca0425152e8b77ec40041502f0b8e57c058.json: Language not supported
 - kms-connector/.sqlx/query-870dd150166705cc721622e07679ab492649be1199934f92708fece4df95b8ff.json: Language not supported
 - kms-connector/.sqlx/query-8999cf2e601ad18a848f118ca5131dc3e9a5d4176f5f92bbceec770043c36baf.json: Language not supported
 - kms-connector/.sqlx/query-b349bf7c7e98d7cb858654f939fe6733b7fb1774e80cdc0b1a48cfa5cde4c521.json: Language not supported
 - kms-connector/.sqlx/query-cfa5dec1bb7a0a586b6822fd222bb518762f67fd7484c4efd1fb5320268f4341.json: Language not supported
 - kms-connector/.sqlx/query-d2b33c24cd185f97f5810a4b3da91565c87fed9d1697d651f5e51ffbba756bd6.json: Language not supported
 - kms-connector/.sqlx/query-d3238c10e01dbc5d2c06e409a9af2018b4770de5ee42126407a8276c7f54145f.json: Language not supported
 - kms-connector/.sqlx/query-d6df03a7c7617fb4ac99be6a98fd7fa4368b8b78709f3b07fba773d49ae219fe.json: Language not supported
 - kms-connector/.sqlx/query-daa213ba26085a6b864c60726c3e8a4d548bfd09d0791505fc3db89a6ee7f343.json: Language not supported
 - kms-connector/.sqlx/query-f63cbf98d0c26a3ffbd4c9080549ac15911c81f352d86f33ee79c0b244765ac7.json: Language not supported
 - kms-connector/.sqlx/query-fb044e1f8fc652401b00b59ef041debded52e491cf85e3c23e660dd2af5380aa.json: Language not supported
 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
99d4656    to
    da2b46d      
    Compare
  
    da2b46d    to
    3c663a9      
    Compare
  
    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.
Looks good!
Closes https://github.com/zama-ai/fhevm-internal/issues/475
Here's what it looks like:

Only issue is that the parent span's duration is not shown as the sum of the 3 child spans. This is because the
handle_gateway_eventspan is automatically closed when the function exit (implementation of thetracingcrate).I spent some time digging this, and the only way I see to resolve this would be to implement a way for
tx-senderto warngw-listenerthat he finished its job (grpc call for instance), and to only exit thehandle_gateway_eventwhen thegw-listenerreceive the ping from thetx-sender. It might be a bit overkill for now, I asked @leventdem about this and we decided to postpone this for now, and merge this as it is.