Skip to content
This repository was archived by the owner on Feb 11, 2025. It is now read-only.

Comments

feat(healthz): add version#353

Merged
thomastaylor312 merged 1 commit intodeislabs:mainfrom
FrankYang0529:add-version-to-healthz
Nov 8, 2022
Merged

feat(healthz): add version#353
thomastaylor312 merged 1 commit intodeislabs:mainfrom
FrankYang0529:add-version-to-healthz

Conversation

@FrankYang0529
Copy link
Contributor

@FrankYang0529 FrankYang0529 commented Oct 27, 2022

resolve #350
ref spinframework/spin#786 (comment)

Test step

  1. Build.
> make build
  1. Run the server.
> ./target/debug/bindle-server --unauthenticated
  1. Test /healthz.
> curl -i http://localhost:8080/healthz
HTTP/1.1 200 OK
content-type: application/json
content-length: 38
date: Thu, 27 Oct 2022 11:37:31 GMT

{"status":"OK","version":"0.9.0-rc.1"}

Copy link
Member

@vdice vdice left a comment

Choose a reason for hiding this comment

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

Nice, this looks good to me. Ping @thomastaylor312 for a second review.

@FrankYang0529
Copy link
Contributor Author

Hi @thomastaylor312, could you help me review this PR? I need it to add some warning messages of inconsistent versions in spin#786. Thank you.

Cargo.toml Outdated
[features]
default = ["server", "client", "caching", "test-tools", "native-tls"]
server = ["warp", "openid", "hyper", "mime", "either", "_common"]
server = ["clap", "warp", "openid", "hyper", "mime", "either", "_common"]
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not be bringing in clap for a server dependency. It is fairly big and we don't want people to import it unless they are actually building the CLI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it. Thanks!

let health = warp::path("healthz").map(|| {
warp::reply::json(&HealthStatus {
status: "OK".to_string(),
version: clap::crate_version!().to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be swapped out to a non-clap thing by doing env!("CARGO_PKG_VERSION")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated it. Thank you.

use crate::{server::filters, signature::KeyRing};

#[derive(Deserialize, Serialize)]
pub struct HealthStatus {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a type that we expect people to read back from the server using a client? If so, would it be better to put into invoice/api.rs or another location?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved it to invoice/api.rs and also changed the name to HealthResponse.

Signed-off-by: Frank Yang <yangpoan@gmail.com>
@thomastaylor312 thomastaylor312 merged commit 6a4775b into deislabs:main Nov 8, 2022
@FrankYang0529 FrankYang0529 deleted the add-version-to-healthz branch November 8, 2022 03:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bindle server version endpoint

3 participants