-
Notifications
You must be signed in to change notification settings - Fork 593
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
Minor refactor for broker ingress, adding unittests. #2270
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: n3wscott 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 |
96aa0c9
to
c146ebb
Compare
pkg/broker/filter/stats_reporter.go
Outdated
@@ -38,23 +38,23 @@ var ( | |||
// eventCountM is a counter which records the number of events received | |||
// by a Trigger. | |||
eventCountM = stats.Int64( | |||
"event_count", | |||
"broker_filter_event_count", |
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.
this will break stackdriver integration... these metrics names are whitelisted in SD so that nobody is charged
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.
/hold
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.
It is wrong as is as they conflict. Knative does not have knowledge of stack driver whitelists.
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.
I guess now it has :)
Metrics are API surface. We cannot just change them because code coverage cannot run...
pkg/broker/ingress/stats_reporter.go
Outdated
@@ -33,15 +33,15 @@ var ( | |||
// eventCountM is a counter which records the number of events received | |||
// by the Broker. | |||
eventCountM = stats.Int64( | |||
"event_count", | |||
"broker_ingress_event_count", |
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.
same thing here... why do we need this change? is for a UT coverage thing?
we are matching the naming convention of metrics in serving..
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.
Code coverage can not run with the two init methods registering the two matching names. Plus this prevents us from running in the same container...
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.
code coverage is not a blocker for merging things. If there is a workaround without changing the names, then go for it... Otherwise we should not change the names.
When the time comes to run in the same container, then I think we can revisit.
@nachocano I think it is not valid to hold a PR because it would break private integration that is not part of Knative. |
@n3wscott it's not private integration, everyone can use SD. See pkg, serving has all the metrics there, and we too (although it should be refactored). |
Then we should use the registration that serving uses to prevent errors from the the |
OK, that makes sense. Can you take care of that change in this PR? |
Let me take a crack. I don't want this merged before 0.11 is cut regardless. |
Thanks!
Yes, makes sense! |
There is way more work that I want to start for refactoring the measurements code. I am removing the panic and moving on. |
Cool! Yeah, I created some issues in pkg sometime back. That needs a
refactor as well
…On Fri, Dec 6, 2019 at 9:04 AM Scott Nichols ***@***.***> wrote:
There is way more work that I want to start for refactoring the
measurements code.
I am removing the panic and moving on.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2270?email_source=notifications&email_token=ABD65DBHJR4P6Y3PIRVGX6TQXKA2DA5CNFSM4JV7STFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGEXFJQ#issuecomment-562655910>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABD65DCUL4WUIRQZQASQXTDQXKA2DANCNFSM4JV7STFA>
.
|
/retest |
package ingress | ||
|
||
import ( | ||
"context" | ||
"knative.dev/eventing/pkg/broker" |
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.
formatter?
// If TTL is not found, it will set it to the default passed in. | ||
// If TTL is <= 0, it will remain 0. | ||
// If TTL is > 1, it will be reduced by one. | ||
func TTLDefaulter(logger *zap.Logger, defaultTTL int32) client.EventDefaulter { |
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 we check defaultTTL is > 0?
package broker | ||
|
||
import ( | ||
"context" |
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.
format imports?
// Setting the extension as a string as the CloudEvents sdk does not support non-string extensions. | ||
event.SetExtension(broker.EventArrivalTime, time.Now().Format(time.RFC3339)) | ||
event.SetExtension(broker.EventArrivalTime, cloudevents.Timestamp{Time: time.Now()}) |
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.
can you make sure we are not breaking the way we are reading the extension on the filter pod?
eventing/pkg/broker/filter/filter_handler.go
Line 248 in b53d3fd
var arrivalTimeStr string |
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.
yeah it works.
Very cosmetic comments, and one that I think is important, the arrival time extension. |
} else if ttl, err = cetypes.ToInteger(ttlraw); err != nil { | ||
logger.Warn("Failed to convert existing TTL into integer, defaulting.", | ||
zap.String("event.id", event.ID()), | ||
zap.Any(TTLAttribute, ttlraw), | ||
zap.Error(err), | ||
) | ||
ttl = defaultTTL + 1 | ||
ttl = defaultTTL | ||
} else { |
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.
thanks!
/lgtm |
The following is the coverage report on the affected files.
|
Release Note