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

Unity SDK: Added ability to Start / Stop healthchecks. #1598

Closed
wants to merge 2 commits into from
Closed

Unity SDK: Added ability to Start / Stop healthchecks. #1598

wants to merge 2 commits into from

Conversation

Davidnovarro
Copy link

@Davidnovarro Davidnovarro commented May 30, 2020

There was no public method to start/stop health checks manually.

Now we have both options to start/stop health checks manually or automatically.

/kind hotfix

There was no option to start / stop healthchecks manually.

Now we have both options to start / stop healthchecs manually or automaticaly.
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Davidnovarro
To complete the pull request process, please assign pooneh-m
You can assign the PR to them by writing /assign @pooneh-m in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: af8c1e63-2c16-4255-89af-f7eb7511d214

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1598/head:pr_1598 && git checkout pr_1598
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.7.0-cce7719

@markmandel markmandel changed the title Added ability to Start / Stop healthchecks. UnitySDK: Added ability to Start / Stop healthchecks. Jun 1, 2020
Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

Thanks for sending this through 👍 I had some follow up questions attached in my review.

This PR closes the issue #1583

Also, as a note, this doesn't close that issue, that issue is regarding the C# SDK.

I hope you don't mind, I added "Unity SDK" to the ticket title to give it some more context.

Thanks!

/// </summary>
public bool healthEnabled = true;
[SerializeField] private bool startHealthChecks = true;
Copy link
Member

Choose a reason for hiding this comment

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

Is there a good reason to change this name?

This would be a breaking change for the SDK, so we would like to avoid that where possible.

Copy link
Member

Choose a reason for hiding this comment

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

Also, changing the encapsulation would also be a breaking change. Is there a good reason to do that as well?

Copy link
Author

@Davidnovarro Davidnovarro Jun 2, 2020

Choose a reason for hiding this comment

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

Is there a good reason to change this name?

The name itself is misleading, for example, the user may set it to true externally and expect health checks to start, which won't work because the variable is only checked in the Start method, in case if it was set to true then health checks start.

Also, changing the encapsulation would also be a breaking change. Is there a good reason to do that as well?

I think this variable previously was made public so unity will be able to serialize and show it in the Inspector it basically has no external use case, see code examples below.

void Start()
{
    sdk.healthEnabled = true; //There is a 50 % chance that the health checks will start due to Unity random scheduling. 
}

void Update()
{
    if(someCondition)
        sdk.healthEnabled = true; //This won't work. 

    if(someOtherCondition)
        sdk.healthEnabled = false; //This doesn't make sense because we can't renew the health checks, instead we can use sdk.Shutdown() 
}

Copy link
Member

@markmandel markmandel Jun 2, 2020

Choose a reason for hiding this comment

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

To be honest, I'm not sure why you would be trying to dynamically decide if health checking is enable or not - you would enable health checking if you have it turned on on Agones. That's really it.

Health checking is not a tool for managing game server lifecycles.

This doesn't sound like a good reason to introduce a breaking change on both naming and encapsulation.

/// <summary>
/// Start sending health ping to the Agones sidecar.
/// </summary>
public void StartHealthChecks()
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for sending this through. I'm curious though - what's the use case for these functions?

Was there a particular scenario in which you would want to manually start the health check process, rather than have it be part of the component?

Also, when would you want to stop a health check?

Copy link
Author

Choose a reason for hiding this comment

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

when would you want to stop a health check?

In my particular case, I do resue my game servers for a long period of time and they all have two external connections with Backend Servers (economy, rewards, etc..) and Party Servers (matchmaking, tickets, backfill).
In case if the GS loses the connection I mark it as non-healthy until the connection is restored.

There may be other use cases like the first match is complete but GS can't load the resources to continue.

Was there a particular scenario in which you would want to manually start the health check process, rather than have it be part of the component?

Yes, like GS was able to restore the connection or load the resources or some background process was revived.

Copy link
Member

Choose a reason for hiding this comment

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

In case if the GS loses the connection I mark it as non-healthy until the connection is restored.

This sounds like a very dangerous approach -- I wouldn't advise it. Unhealthy game servers have failed a health check and are deemed to not be alive. If this GameServer was part of a Fleet, it would immediately be shut down and recreated.

Yes, like GS was able to restore the connection or load the resources or some background process was revived.

I can't advocate for any of these scenarios.

This could be solved using custom labels for example, without abusing health checking abilities.

Copy link
Author

Choose a reason for hiding this comment

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

Hmm, you are right, this PR can be removed.

@markmandel markmandel changed the title UnitySDK: Added ability to Start / Stop healthchecks. Unity SDK: Added ability to Start / Stop healthchecks. Jun 1, 2020
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 3837d59c-6090-4071-ab66-e3d92c694669

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1598/head:pr_1598 && git checkout pr_1598
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.7.0-7d60d4a

@markmandel
Copy link
Member

Thanks for working through this with me though! Appreciate you taking the time 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants