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

Docs: Lifecycle Management of Counters and Lists in REST #3560

Merged
merged 14 commits into from
Jan 18, 2024

Conversation

Kalaiselvi84
Copy link
Contributor

What type of PR is this?

Uncomment only one /kind <> line, press enter to put that in a new line, and remove leading whitespace from that line:

/kind breaking
/kind bug
/kind cleanup

/kind documentation

/kind feature
/kind hotfix
/kind release

What this PR does / Why we need it:

Which issue(s) this PR fixes:

Closes #

Special notes for your reviewer:

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 7fbcf4ed-b79d-410d-9dd3-ce2fb9273b5d

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/googleforgames/agones.git pull/3560/head:pr_3560 && git checkout pr_3560
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.38.0-dev-ba37f1c-amd64

Copy link
Collaborator

@igooch igooch left a comment

Choose a reason for hiding this comment

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

Looks good!

##### Example

```bash
curl -H "Content-Type: application/json" -X GET http://localhost:${AGONES_SDK_HTTP_PORT}/v1alpha1/counters/conformanceTestCounter
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should probably mention in the example that conformanceTestCounter is predefined in the local SDK Server, or go with the more generic example of {name} or {counterName}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have included the Local Development Setup section for Counters and Lists in this document. Could you please review it and share your thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

I would add an explainer under each example that uses a key, something like:

In this example, we retrieve the counter under the key "conformanceTestCounter" to make it extra clear.

Since people don't always read the top level docs 😃

As an improvement to the docs and likely the local sdk experience, @igooch I didn't catch this earlier, but any objection to changing:

if runtime.FeatureEnabled(runtime.FeatureCountsAndLists) {
// Adding test Counter and List for the conformance tests (not nil for LocalSDKServer tests)
if l.gs.Status.Counters == nil {
l.gs.Status.Counters = map[string]*sdk.GameServer_Status_CounterStatus{
"conformanceTestCounter": {Count: 1, Capacity: 10}}
}
if l.gs.Status.Lists == nil {
l.gs.Status.Lists = map[string]*sdk.GameServer_Status_ListStatus{
"conformanceTestList": {Values: []string{"test0", "test1", "test2"}, Capacity: 100}}
}
}

To using some more generic keys? Maybe players for the list and rooms for the count?

We don't actually use these values for conformance tests anyway, so this might be a bit confusing, and I think would make examples easier to understand. WDYT? If so, we can do this in a separate PR (and will need to feature shortcode the new docs) - if you like we can file a new issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would add an explainer under each example that uses a key, something like:
In this example, we retrieve the counter under the key "conformanceTestCounter" to make it extra clear.

I have included this information in a Note section located under both the Counters and Lists titles, following the Warning section. This will avoid the repetition right? WDYT?

To using some more generic keys? Maybe players for the list and rooms for the count?

Do you want to replace "conformanceTestCounter": {Count: 1, Capacity: 10}} with "rooms": {Count: 1, Capacity: 10}} and "conformanceTestList": {Values: []string{"test0", "test1", "test2"}, Capacity: 100}} with "players": {Values: []string{"player1", "player2", "player3"}, Capacity: 100}}?

Copy link
Member

Choose a reason for hiding this comment

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

We don't actually use these values for conformance tests anyway

I'm silly - of course we use this for conformance tests 🤦🏻 . Ignore that comment. But I am wondering if we change the key anyway, to make it easier for end users, and make our conformance testing match. WDYT?

For these docs, we don't have to conform to the local SDK for the example, so I think we can change the key to something more generic like I suggest above. I'd like to get agreement on the code changes from @igooch before we make the code changes though to the local sdk server (and either way, we should handle that in a separate PR).

Sound good?

Copy link
Collaborator

@igooch igooch Jan 8, 2024

Choose a reason for hiding this comment

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

My personal preference is to have the example match what we have in the localSDKServer for a better user experience. That way the user can run the example code and it works without them needing to make changes. My general gripe with generic examples is that they implicitly assume the user knows what and where to make changes without any accompanying instructions. That being said the key "conformanceTestCounter" probably doesn't mean anything to the user either, so I'd rename the keys along the lines of "TestCounterKey", "TestPlayerCounter", etc.

I'm also fine leaving the examples more generic here, as long as we have a step by step guide elsewhere that is more accessible to the user that needs more context on how and where to make changes.

Copy link
Member

Choose a reason for hiding this comment

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

My personal preference is to have the example match what we have in the localSDKServer for a better user experience.

100% agreed - no disagreement there - sounds like we're just talking about what names to give keys. This change I've suggested above I would like to see as an interim step until we can align it again next release with a future PR to update the local sdk server and conformance tests.

That being said the key "conformanceTestCounter" probably doesn't mean anything to the user either, so I'd rename the keys along the lines of "TestCounterKey", "TestPlayerCounter", etc.

So i would argue that both "test", "key", and "counter" are redundant in the name, and just confuse things a bit more, and it's easier to give a real world use case for the local SDK user that is easy to understand (and will align with the eventual integration pattern docs I'll write - primarily one for "rooms" and one for "player tracking" - as well as the examples we have in the yaml files etc.).

That being said, I would be super happy if as part of the description for each method, there is a reminder for what the key is that is being used, since reminders are great and redundancy in docs is definitely not a bad thing, I'll write up a small suggestion, lemme know what you think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are we sticking with rooms and players for now and considering changes later if needed?

site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 575f1965-3219-4c6c-ba1a-bcb7e010db0b

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/googleforgames/agones.git pull/3560/head:pr_3560 && git checkout pr_3560
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.38.0-dev-8875016-amd64

site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
##### Example

```bash
curl -H "Content-Type: application/json" -X GET http://localhost:${AGONES_SDK_HTTP_PORT}/v1alpha1/counters/conformanceTestCounter
Copy link
Member

Choose a reason for hiding this comment

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

I would add an explainer under each example that uses a key, something like:

In this example, we retrieve the counter under the key "conformanceTestCounter" to make it extra clear.

Since people don't always read the top level docs 😃

As an improvement to the docs and likely the local sdk experience, @igooch I didn't catch this earlier, but any objection to changing:

if runtime.FeatureEnabled(runtime.FeatureCountsAndLists) {
// Adding test Counter and List for the conformance tests (not nil for LocalSDKServer tests)
if l.gs.Status.Counters == nil {
l.gs.Status.Counters = map[string]*sdk.GameServer_Status_CounterStatus{
"conformanceTestCounter": {Count: 1, Capacity: 10}}
}
if l.gs.Status.Lists == nil {
l.gs.Status.Lists = map[string]*sdk.GameServer_Status_ListStatus{
"conformanceTestList": {Values: []string{"test0", "test1", "test2"}, Capacity: 100}}
}
}

To using some more generic keys? Maybe players for the list and rooms for the count?

We don't actually use these values for conformance tests anyway, so this might be a bit confusing, and I think would make examples easier to understand. WDYT? If so, we can do this in a separate PR (and will need to feature shortcode the new docs) - if you like we can file a new issue.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: a55590d0-3c86-4ead-8013-5f06f62d5e5a

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/googleforgames/agones.git pull/3560/head:pr_3560 && git checkout pr_3560
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.38.0-dev-f51a108-amd64

site/content/en/docs/Guides/Client SDKs/local.md Outdated Show resolved Hide resolved
site/content/en/docs/Guides/Client SDKs/local.md Outdated Show resolved Hide resolved
site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
##### Example

```bash
curl -H "Content-Type: application/json" -X GET http://localhost:${AGONES_SDK_HTTP_PORT}/v1alpha1/counters/conformanceTestCounter
Copy link
Member

Choose a reason for hiding this comment

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

We don't actually use these values for conformance tests anyway

I'm silly - of course we use this for conformance tests 🤦🏻 . Ignore that comment. But I am wondering if we change the key anyway, to make it easier for end users, and make our conformance testing match. WDYT?

For these docs, we don't have to conform to the local SDK for the example, so I think we can change the key to something more generic like I suggest above. I'd like to get agreement on the code changes from @igooch before we make the code changes though to the local sdk server (and either way, we should handle that in a separate PR).

Sound good?

site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
@Kalaiselvi84
Copy link
Contributor Author

I think I've made all the changes you suggested.👍🏻

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: a9152c79-5494-471f-ad46-1dadd9412128

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/googleforgames/agones.git pull/3560/head:pr_3560 && git checkout pr_3560
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.38.0-dev-aee6dc3-amd64

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.

Some minor pieces, but otherwise, LGTM! Also waiting on approval from @igooch as well 👍🏻

site/content/en/docs/Guides/Client SDKs/local.md Outdated Show resolved Hide resolved
site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
@Kalaiselvi84
Copy link
Contributor Author

All the changes are in place.👍🏻

Copy link
Collaborator

@igooch igooch left a comment

Choose a reason for hiding this comment

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

Looks good, just a +1 to Mark's comments on not needing to wait until the next release.

site/content/en/docs/Guides/Client SDKs/local.md Outdated Show resolved Hide resolved
site/content/en/docs/Guides/Client SDKs/rest.md Outdated Show resolved Hide resolved
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 93f7cf90-31b8-4d82-a9cd-7ac9c1f0c7cc

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/googleforgames/agones.git pull/3560/head:pr_3560 && git checkout pr_3560
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.38.0-dev-561f1e4-amd64

For your own Counter REST requests, replace the value `rooms` with your own key in the path.

##### Alpha: GetCounter
This function retrieves a specified counter by its name and returns its information.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This function retrieves a specified counter by its name and returns its information.
This function retrieves a specified counter by its key, `rooms`, and returns its information.

@igooch @Kalaiselvi84 how do you feel about this suggestion? (and then repeating it through all the below REST calls as well) -- then it's doubly reinforced what the key is, both above and inline in the description?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've made the suggested changes. Ivy, wdyt?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good!

```

##### Alpha: UpdateCounter
This function updates the specified counter's properties, such as its count and capacity, and returns the updated counter details.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This function updates the specified counter's properties, such as its count and capacity, and returns the updated counter details.
This function updates the counter with the key `rooms`'s properties, such as its count and capacity, and returns the updated counter details.

Just another example of the change style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it be a good idea if we rephrase like this?
This function updates the properties of the counter with the key rooms, such as its count and capacity, and returns the updated counter details.

Copy link
Member

Choose a reason for hiding this comment

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

That reads better! Nice.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 2845ea46-9e71-4c9e-a043-15cd0ff6a729

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 9924baa4-352d-43e0-8b02-543feb1785a9

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/googleforgames/agones.git pull/3560/head:pr_3560 && git checkout pr_3560
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.38.0-dev-8bdb9d9-amd64

Copy link
Collaborator

@igooch igooch left a comment

Choose a reason for hiding this comment

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

LGTM

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: d41667c5-8e7d-4173-bbfe-79d2e98242db

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/googleforgames/agones.git pull/3560/head:pr_3560 && git checkout pr_3560
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.38.0-dev-f164d4f-amd64

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.

Almost there!

```

##### Alpha: UpdateList
This function updates the specified list's properties, such as its capacity and values, returns the updated list details. This will overwrite all existing List.Values with the update list request values. Use addValue or removeValue for modifying the List.Values field.
Copy link
Member

Choose a reason for hiding this comment

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

Can we please do players in this List section like we did for rooms above, and then I think this PR is good to go.

Suggested change
This function updates the specified list's properties, such as its capacity and values, returns the updated list details. This will overwrite all existing List.Values with the update list request values. Use addValue or removeValue for modifying the List.Values field.
This function updates the list's properties with the key `players`, such as its capacity and values, returns the updated list details. This will overwrite all existing List.Values with the update list request values. Use addValue or removeValue for modifying the List.Values field.

```

##### Alpha: AddListValue
This function adds a new value to a specified list and returns the list with this addition.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This function adds a new value to a specified list and returns the list with this addition.
This function adds a new value to a list with the key `players` and returns the list with this addition.

```

##### Alpha: RemoveListValue
This function removes a value from a given list and returns updated list.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This function removes a value from a given list and returns updated list.
This function removes a value from the list with the key `players` and returns updated list.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: be91ee68-94b5-4238-8f54-b400e50ec67d

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/googleforgames/agones.git pull/3560/head:pr_3560 && git checkout pr_3560
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.38.0-dev-f7c29a3-amd64

@markmandel markmandel enabled auto-merge (squash) January 17, 2024 22:52
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: c6df7750-16e1-4ef1-8401-ef2918bc4fa7

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/googleforgames/agones.git pull/3560/head:pr_3560 && git checkout pr_3560
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.38.0-dev-75e5569-amd64

@markmandel markmandel merged commit e52f20a into googleforgames:main Jan 18, 2024
4 checks passed
@Kalaiselvi84 Kalaiselvi84 deleted the rest-cl branch March 15, 2024 01:06
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.

4 participants