You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: registry_notifications.go
    path of file: ./repos/keel/pkg/http
    
    the code of the file until where you have to start completion: package http

import (
	"encoding/json"
	"net/http"
	"time"

	"github.com/keel-hq/keel/types"

	"github.com/prometheus/client_golang/prometheus"

	log "github.com/sirupsen/logrus"
)

var newRegistryNotificationWebhooksCounter = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: "registry_notification_requests_total",
		Help: "How many /v1/webhooks/registry requests processed, partitioned by image.",
	},
	[]string{"image"},
)

func init() {
	prometheus.MustRegister(newRegistryNotificationWebhooksCounter)
}

// {
// 	"events": [
// 	   {
// 		  "id": "d83e8796-7ba5-46ad-b239-d88473e21b2b",
// 		  "timestamp": "2018-10-11T13:53:21.859222576Z",
// 		  "action": "push",
// 		  "target": {
// 			 "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
// 			 "size": 2206,
// 			 "digest": "sha256:4afff550708506c5b8b7384ad10d401a02b29ed587cb2730cb02753095b5178d",
// 			 "length": 2206,
// 			 "repository": "shinebayar-g/a",
// 			 "url": "https://registry.git.erxes.io
    
func (s *TriggerServer) registryNotificationHandler(resp http.ResponseWriter, req *http.Request) {
	rn := registryNotification{}
	if err := json.NewDecoder(req.Body).Decode(&rn); err != nil {
		log.WithFields(log.Fields{
			"error": err,
		}).Error("trigger.dockerHubHandler: failed to decode request")
		resp.WriteHeader(http.StatusBadRequest)
		return
	}

	log.WithFields(log.Fields{
		"event": rn,
	}).Debug("registryNotificationHandler: received event, looking for a push tag")

	for _, e := range rn.Events {

		if e.Action != "push" {
			continue
		}

		if e.Target.Tag == "" {
			continue
		}

		dockerURL := e.Request.Host + "/" + e.Target.Repository

		event := types.Event{}
		event.Repository.Name = dockerURL
		event.CreatedAt = time.Now()
		event.TriggerName = "registry-notification"
		event.Repository.Tag = e.Target.Tag
		event.Repository.Digest = e.Target.Digest

		log.WithFields(log.Fields{
			"action":     e.Action,
			"tag":        e.Target.Tag,
			"repository": dockerURL,
			"digest":     e.Target.Digest,
		}).Debug("registryNotificationHandler: got registry notification, processing")

		s.trigger(event)

		newRegistryNotificationWebhooksCounter.With(prometheus.Labels{"image": event.Repository.Name}).Inc()
	}

}