Unverified Commit 8fd7d2d3 authored by meskio's avatar meskio 🏔️
Browse files

internal: log the distributor requesting resource streams

parent 90ac2354
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -250,21 +250,21 @@ func (b *BackendContext) getResourceStreamHandler(w http.ResponseWriter, r *http
	}

	resourceMap := b.processResourceRequest(req)
	log.Printf("Sending distributor initial batch: %s", resourceMap)
	log.Printf("Sending %s distributor initial batch: %s", req.RequestOrigin, resourceMap)
	if err := sendDiff(&core.ResourceDiff{New: resourceMap, FullUpdate: true}); err != nil {
		log.Printf("Error sending initial diff to distributor: %s.", err)
		log.Printf("Error sending initial diff to %s distributor: %s.", req.RequestOrigin, err)
	}

	log.Printf("Entering streaming loop for %s.", r.RemoteAddr)
	log.Printf("Entering streaming loop for %s %s.", req.RequestOrigin, r.RemoteAddr)
	for {
		select {
		// Is our HTTP connection done?
		case <-r.Context().Done():
			log.Printf("Exiting streaming loop for %s.", r.RemoteAddr)
			log.Printf("Exiting streaming loop for %s %s.", req.RequestOrigin, r.RemoteAddr)
			return
		case diff := <-diffs:
			if err := sendDiff(diff); err != nil {
				log.Printf("Error sending diff to distributor: %s.", err)
				log.Printf("Error sending diff to %s distributor: %s.", req.RequestOrigin, err)
				return
			}
		}