Skip to content

Commit 81d3da9

Browse files
author
fmar
committed
feat: sentry.io support test endpoint
1 parent 0865071 commit 81d3da9

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

rust/server/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ fn initialize_sentry(
203203
config.get_environment().unwrap_or_else(|| "default".to_string()),
204204
sample_rate
205205
);
206+
207+
// Send a test message to verify Sentry is configured correctly
208+
sentry::capture_message("VSS server started - Sentry integration test", sentry::Level::Info);
206209
}
207210

208211
Some(guard)

rust/server/src/vss_service.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ impl Service<Request<Incoming>> for VssService {
5858
"/listKeyVersions" => {
5959
handle_request(store, authorizer, req, handle_list_object_request).await
6060
},
61+
"/testSentry" => {
62+
// Test endpoint to verify Sentry integration
63+
handle_test_sentry_request().await
64+
},
6165
_ => {
6266
let error_msg = "Invalid request path.".as_bytes();
6367
Ok(Response::builder()
@@ -90,6 +94,30 @@ async fn handle_list_object_request(
9094
) -> Result<ListKeyVersionsResponse, VssError> {
9195
store.list_key_versions(user_token, request).await
9296
}
97+
98+
/// Test endpoint to verify Sentry integration is working.
99+
/// Sends a test error event to Sentry and returns a confirmation message.
100+
async fn handle_test_sentry_request(
101+
) -> Result<<VssService as Service<Request<Incoming>>>::Response, hyper::Error> {
102+
// Create a test error and capture it
103+
let test_error = std::io::Error::new(
104+
std::io::ErrorKind::Other,
105+
"Test error from /vss/testSentry endpoint",
106+
);
107+
sentry::capture_error(&test_error);
108+
109+
// Also send a test message
110+
sentry::capture_message(
111+
"Test message from /vss/testSentry endpoint",
112+
sentry::Level::Warning,
113+
);
114+
115+
let response_body = b"Sentry test events sent. Check your Sentry dashboard.";
116+
Ok(Response::builder()
117+
.status(StatusCode::OK)
118+
.body(Full::new(Bytes::from(response_body.to_vec())))
119+
.unwrap())
120+
}
93121
async fn handle_request<
94122
T: Message + Default,
95123
R: Message,

0 commit comments

Comments
 (0)