forked from lightningdevkit/vss-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from getAlby/feat/sentry
Feat: add sentry
- Loading branch information
Showing
10 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.vss.api; | ||
|
||
import jakarta.inject.Inject; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.Context; | ||
import jakarta.ws.rs.core.HttpHeaders; | ||
import jakarta.ws.rs.core.MediaType; | ||
import jakarta.ws.rs.core.Response; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.vss.GetObjectRequest; | ||
import org.vss.GetObjectResponse; | ||
import org.vss.KVStore; | ||
import org.vss.auth.AuthResponse; | ||
import org.vss.auth.Authorizer; | ||
import io.sentry.Sentry; | ||
|
||
@Path(VssApiEndpoint.HEALTHCHECK) | ||
@Slf4j | ||
public class HealthCheckApi { | ||
KVStore kvStore; | ||
|
||
@Inject | ||
public HealthCheckApi(KVStore kvstore) { | ||
this.kvStore = kvstore; | ||
} | ||
|
||
@GET | ||
public Response execute(@Context HttpHeaders headers) { | ||
try { | ||
log.info("Healthcheck requested"); | ||
kvStore.checkHealth(); | ||
log.info("Healthcheck passed"); | ||
|
||
return Response | ||
.status(Response.Status.OK) | ||
.build(); | ||
} catch (Exception e) { | ||
log.error("Exception in HealthCheckApi: ", e); | ||
Sentry.captureException(e); | ||
return Response.status(500) | ||
.entity("an unexpected error occurred: " + e.getMessage()) | ||
.build(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters