MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / SystemHandler

Method SystemHandler

diagnostic/handlers.go:67–90  ·  view source on GitHub ↗
(writer http.ResponseWriter, request *http.Request)

Source from the content-addressed store, hash-verified

65}
66
67func (handler *Handler) SystemHandler(writer http.ResponseWriter, request *http.Request) {
68 logger := handler.log.With().Str(collectorField, systemCollectorName).Logger()
69 logger.Info().Msg("Collection started")
70
71 defer logger.Info().Msg("Collection finished")
72
73 ctx, cancel := context.WithTimeout(request.Context(), handler.timeout)
74
75 defer cancel()
76
77 info, err := handler.systemCollector.Collect(ctx)
78
79 response := SystemInformationResponse{
80 Info: info,
81 Err: err,
82 }
83
84 encoder := json.NewEncoder(writer)
85 err = encoder.Encode(response)
86 if err != nil {
87 logger.Error().Err(err).Msgf("error occurred whilst serializing information")
88 writer.WriteHeader(http.StatusInternalServerError)
89 }
90}
91
92type TunnelState struct {
93 TunnelID uuid.UUID `json:"tunnelID,omitempty"`

Callers 1

TestSystemHandlerFunction · 0.80

Implementers 1

JWTValidatoringress/middleware/jwtvalidator.go

Calls 7

EncodeMethod · 0.95
LoggerMethod · 0.80
ContextMethod · 0.65
CollectMethod · 0.65
ErrMethod · 0.45
ErrorMethod · 0.45
WriteHeaderMethod · 0.45

Tested by 1

TestSystemHandlerFunction · 0.64