Skip to content

Conversation

halcyonCorsair
Copy link
Contributor

This addresses #1553.

TBD: Queue not converted yet

Signed-off-by: Elliot Pahl elliot.pahl@gmail.com

@halcyonCorsair halcyonCorsair force-pushed the halcyonCorsair/use-go-events-1 branch from d74d90b to 8cd82db Compare March 14, 2018 00:31
@codecov
Copy link

codecov bot commented Mar 14, 2018

Codecov Report

Merging #2550 into master will decrease coverage by 0.41%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2550      +/-   ##
==========================================
- Coverage   58.67%   58.26%   -0.42%     
==========================================
  Files         104      104              
  Lines        8434     8341      -93     
==========================================
- Hits         4949     4860      -89     
+ Misses       2823     2822       -1     
+ Partials      662      659       -3     
Flag Coverage Δ
#linux 58.26% <92.85%> (-0.42%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b972e5...08e265b. Read the comment docs.

@halcyonCorsair
Copy link
Contributor Author

See also #2551 and docker/go-events#24.

@@ -51,7 +52,7 @@ func TestHTTPSink(t *testing.T) {
}

// Let caller choose the status
status, err := strconv.Atoi(r.FormValue("status"))
status, err := strconv.Atoi(r.URL.Query().Get("status"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this change made? r.FormValue is equivalent, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was failing, looks like due to a mistake I had made during the conversion, so I've set it back now.

@@ -61,7 +63,7 @@ func NewEndpoint(name, url string, config EndpointConfig) *Endpoint {
endpoint.Sink = newHTTPSink(
endpoint.url, endpoint.Timeout, endpoint.Headers,
endpoint.Transport, endpoint.metrics.httpStatusListener())
endpoint.Sink = newRetryingSink(endpoint.Sink, endpoint.Threshold, endpoint.Backoff)
endpoint.Sink = events.NewRetryingSink(endpoint.Sink, events.NewBreaker(endpoint.Threshold, endpoint.Backoff))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looking good here.

@stevvooe
Copy link
Collaborator

cc @dmcgowan

@halcyonCorsair halcyonCorsair force-pushed the halcyonCorsair/use-go-events-1 branch from 8cd82db to ec7781d Compare March 15, 2018 04:18
@halcyonCorsair
Copy link
Contributor Author

Updated to resolve merge conflicts.

emsl.Statuses[fmt.Sprintf("%d %s", status, http.StatusText(status))] += len(events)
emsl.Successes += len(events)
evt, ok := event.(Event)
if !ok || (ok && evt.ID == "") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this happen? If we are seeing this, there might be a bug.

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 believe this shouldn't happen. From memory I think I added this after I accidentally sent the wrong thing through here partway through converting things. I'll remove it.

@halcyonCorsair halcyonCorsair force-pushed the halcyonCorsair/use-go-events-1 branch 3 times, most recently from 2c50c1d to bbb1e75 Compare March 23, 2018 01:05
@stevvooe
Copy link
Collaborator

stevvooe commented Mar 26, 2018

LGTM

I think the tests are failing with a concurrency issue when setting the url on the sink for each test case: https://github.com/docker/distribution/pull/2550/files#diff-e8f917a7e7a5472ef1ca0e58b0f7775aL162.

@dmcgowan dmcgowan force-pushed the halcyonCorsair/use-go-events-1 branch 3 times, most recently from 14e3fd8 to 08e265b Compare March 3, 2020 23:41
Copy link
Collaborator

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

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

LGTM

@dmcgowan dmcgowan requested a review from manishtomar March 3, 2020 23:56
Copy link
Contributor

@manishtomar manishtomar left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for this.

@@ -64,7 +65,7 @@ func NewEndpoint(name, url string, config EndpointConfig) *Endpoint {
endpoint.Sink = newHTTPSink(
endpoint.url, endpoint.Timeout, endpoint.Headers,
endpoint.Transport, endpoint.metrics.httpStatusListener())
endpoint.Sink = newRetryingSink(endpoint.Sink, endpoint.Threshold, endpoint.Backoff)
endpoint.Sink = events.NewRetryingSink(endpoint.Sink, events.NewBreaker(endpoint.Threshold, endpoint.Backoff))
endpoint.Sink = newEventQueue(endpoint.Sink, endpoint.metrics.eventQueueListener())
Copy link
Contributor

Choose a reason for hiding this comment

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

Will be nice to have this also in go-events but can be done later.


statusCounter.WithValues(fmt.Sprintf("%d %s", status, http.StatusText(status)), emsl.EndpointName).Inc(1)
eventsCounter.WithValues("Successes", emsl.EndpointName).Inc(float64(len(events)))
eventsCounter.WithValues("Successes", emsl.EndpointName).Inc(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. Had fixed this bug earlier but didn't upstream it.

}
if len(kept) == 0 {
func (imts *ignoredSink) Write(event events.Event) error {
if imts.ignoreMediaTypes[event.(Event).Target.MediaType] || imts.ignoreActions[event.(Event).Action] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Yay! Another bugfix.

TBD: Queue not converted yet

Signed-off-by: Elliot Pahl <elliot.pahl@gmail.com>
@dmcgowan dmcgowan force-pushed the halcyonCorsair/use-go-events-1 branch from 08e265b to 800cb95 Compare March 4, 2020 20:49
@dmcgowan dmcgowan merged commit c79aa81 into distribution:master Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants