-
Notifications
You must be signed in to change notification settings - Fork 813
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
improve stackdriver metric type #1132
Conversation
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:
|
Why the tag approved? |
I think prow approves since you are an approver? @roberthbailey ? |
Yes, that is from prow. If you weren't an approver, the tag could be added by an approver typing 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. |
/assign |
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:
|
Build Failed 😱 Build Id: e2651f72-6826-403a-9a57-e2b2544af104 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: bffee03d-008e-4d6f-a4b9-9db3aca058ad To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
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:
|
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:
|
@cyriltovena - is this ready for another review pass? |
Yes ! |
pkg/metrics/util.go
Outdated
if len(keyValue) != 2 { | ||
return nil, fmt.Errorf("invalid labels format: %s, expect key=value,key2=value2", s) | ||
} | ||
res.Set(keyValue[0], keyValue[1], "") |
There was a problem hiding this comment.
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)?
pkg/metrics/util.go
Outdated
return res, nil | ||
} | ||
pairs := strings.Split(s, ",") | ||
if len(pairs) == 0 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
pkg/metrics/exporter.go
Outdated
Type: "k8s_container", | ||
Labels: map[string]string{ | ||
"project_id": projectID, | ||
"instance_id": instanceID, |
There was a problem hiding this comment.
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?
ae192b3
to
d26abb2
Compare
Build Failed 😱 Build Id: ef193702-513e-4c35-81c2-beec9c5c23a5 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Rebase / Upgrade to master - should solve that problem. |
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:
|
@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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be resolved.
There was a problem hiding this comment.
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 😃)
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:
|
func RegisterStackdriverExporter(projectID string, defaultLabels string) (*stackdriver.Exporter, error) { | ||
monitoredRes, err := getMonitoredResource(projectID) | ||
if err != nil { | ||
logger.WithError(err).Warn("error discovering monitored resource") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
[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:
Approvers can indicate their approval by writing |
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.
3d31a4a
to
af1da11
Compare
New changes are detected. LGTM label has been removed. |
just rebased buddy ! :) |
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:
|
* improve stackdriver metric type Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
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.