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

improve stackdriver metric type #1132

Merged
merged 9 commits into from Dec 19, 2019

Conversation

cyriltovena
Copy link
Collaborator

As per the documentation https://godoc.org/contrib.go.opencensus.io/exporter/stackdriver

This will improve the metric typing and should now appears as a gke container in stackdriver interface.

If someone has time to test it and let me know if everything is correct, that would be awesome.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 22468608-4412-4e90-b581-e2ce5ea32126

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/1132/head:pr_1132 && git checkout pr_1132
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.1.0-662ea70

@markmandel markmandel added feature-freeze-do-not-merge Only eligible to be merged once we are out of feature freeze (next full release) kind/feature New features for Agones area/operations Installation, updating, metrics etc labels Oct 22, 2019
@cyriltovena
Copy link
Collaborator Author

Why the tag approved?

@markmandel
Copy link
Member

I think prow approves since you are an approver? @roberthbailey ?

@roberthbailey
Copy link
Member

Why the tag approved?

Yes, that is from prow. If you weren't an approver, the tag could be added by an approver typing /approve in a PR comment or by approving via the github code review flow.

Right now it doesn't mean anything, but if we decide to switch to tide for automatic merges then it'll be required for a PR to be merged.

pkg/metrics/exporter.go Outdated Show resolved Hide resolved
pkg/metrics/exporter.go Show resolved Hide resolved
@roberthbailey
Copy link
Member

/assign

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 7915ed5c-f278-466a-adaa-3e4763d20f9d

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/1132/head:pr_1132 && git checkout pr_1132
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.1.0-d1528f0

@markmandel markmandel removed the feature-freeze-do-not-merge Only eligible to be merged once we are out of feature freeze (next full release) label Oct 29, 2019
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: e2651f72-6826-403a-9a57-e2b2544af104

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: bffee03d-008e-4d6f-a4b9-9db3aca058ad

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

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: aaa27268-7850-4af2-aed4-baec00cd1b74

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/1132/head:pr_1132 && git checkout pr_1132
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.1.0-30b4daf

pkg/metrics/exporter.go Outdated Show resolved Hide resolved
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 077c203c-270f-4761-841a-9477cc298375

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/1132/head:pr_1132 && git checkout pr_1132
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.1.0-85873c1

@roberthbailey
Copy link
Member

@cyriltovena - is this ready for another review pass?

@cyriltovena
Copy link
Collaborator Author

Yes !

site/content/en/docs/Installation/helm.md Show resolved Hide resolved
if len(keyValue) != 2 {
return nil, fmt.Errorf("invalid labels format: %s, expect key=value,key2=value2", s)
}
res.Set(keyValue[0], keyValue[1], "")
Copy link
Member

Choose a reason for hiding this comment

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

should this trim whitespace around the labels so that something like key=value, key2=value2 doesn't produce a label named key2 (with a space at the beginning)?

return res, nil
}
pairs := strings.Split(s, ",")
if len(pairs) == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

There isn't a test case for this branch.

@@ -291,3 +293,57 @@ agones_gameservers_node_count_count 3
agones_nodes_count{empty="false"} 2
agones_nodes_count{empty="true"} 1
`

func Test_parseLabels(t *testing.T) {
tests := []struct {
Copy link
Member

Choose a reason for hiding this comment

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

Another way you could write this (to more easily explore edge cases that should create errors) is to have two sets of tests, one that should produce errors and another that should work. I think the set of tests that should work is relatively small (you have 3 right now, which mostly covers it). But the set of inputs that should cause an error should be made much longer. This is easier if it's more compact, e.g.

errorInputs = []string{
  "a=b,",
  "a=b,c",
  ...
}

since the want is always nil and the wantErr is always true for these you can collapse them into a shorter list form, and then expand the list.

What about testing inputs with spaces added in various places? Or extra equals signs? Should non-ascii characters be accepted? Does stack driver impose any constraints on what characters can be in a key? And so on.

Type: "k8s_container",
Labels: map[string]string{
"project_id": projectID,
"instance_id": instanceID,
Copy link
Member

Choose a reason for hiding this comment

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

Do these have to be set? Or can they be left blank if we can't read from the metadata server?

@markmandel markmandel added the feature-freeze-do-not-merge Only eligible to be merged once we are out of feature freeze (next full release) label Dec 4, 2019
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: ef193702-513e-4c35-81c2-beec9c5c23a5

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

@markmandel
Copy link
Member

========================================================================
site/docs/installation/upgrading/index.html
  Non-OK status: 404 --- site/docs/installation/upgrading/index.html --> https://helm.sh/docs/helm/#helm-upgrade
========================================================================

Rebase / Upgrade to master - should solve that problem.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 54295db5-d68a-45f9-b5a7-88351902455f

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/1132/head:pr_1132 && git checkout pr_1132
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.2.0-d26abb2

@markmandel markmandel removed the feature-freeze-do-not-merge Only eligible to be merged once we are out of feature freeze (next full release) label Dec 12, 2019
@markmandel
Copy link
Member

@roberthbailey anything left on this before we can merge?

@@ -36,8 +36,12 @@ _We recommend to install Agones in its own namespaces (like `agones-system` as s
you can use the helm `--namespace` parameter to specify a different namespace._

When running in production, Agones should be scheduled on a dedicated pool of nodes, distinct from where Game Servers are scheduled for better isolation and resiliency. By default Agones prefers to be scheduled on nodes labeled with `agones.dev/agones-system=true` and tolerates node taint `agones.dev/agones-system=true:NoExecute`. If no dedicated nodes are available, Agones will
<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

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

Need to resolve this merge conflict.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should be resolved.

Copy link
Member

Choose a reason for hiding this comment

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

@roberthbailey is this good to go now?

(I'm on a push to close out PRs before EOY 😃)

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 60d0cac5-3a5c-4a1d-bc09-5129a6b6aace

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/1132/head:pr_1132 && git checkout pr_1132
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.2.0-3d31a4a

func RegisterStackdriverExporter(projectID string, defaultLabels string) (*stackdriver.Exporter, error) {
monitoredRes, err := getMonitoredResource(projectID)
if err != nil {
logger.WithError(err).Warn("error discovering monitored resource")
Copy link
Member

Choose a reason for hiding this comment

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

Is it ok if monitoredRes is nil later on or does this need to be followed by a return nil, err line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no it's ok this is a best effort.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

by default it is nil.

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cyriltovena, roberthbailey

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [cyriltovena,roberthbailey]

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

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Adds more tests for parsing labels.
Skip monitored resource if discovery fails.
@google-oss-robot
Copy link

New changes are detected. LGTM label has been removed.

@cyriltovena
Copy link
Collaborator Author

New changes are detected. LGTM label has been removed.

just rebased buddy ! :)

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: da6ee4b3-f53c-4c8f-90df-ee5417cfc9f9

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/1132/head:pr_1132 && git checkout pr_1132
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.3.0-af1da11

@roberthbailey roberthbailey merged commit 64ceb4d into googleforgames:master Dec 19, 2019
@markmandel markmandel added this to the 1.3.0 milestone Jan 10, 2020
ilkercelikyilmaz pushed a commit to ilkercelikyilmaz/agones that referenced this pull request Oct 23, 2020
* improve stackdriver metric type

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/operations Installation, updating, metrics etc kind/feature New features for Agones size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants