MCPcopy Create free account
hub / github.com/facebook/time / FetchChannelTarget

Method FetchChannelTarget

calnex/api/api.go:662–684  ·  view source on GitHub ↗

FetchChannelTarget returns the measure target of the server monitored on the channel

(channel Channel, probe Probe)

Source from the content-addressed store, hash-verified

660}
661
662// FetchChannelTarget returns the measure target of the server monitored on the channel
663func (a *API) FetchChannelTarget(channel Channel, probe Probe) (string, error) {
664 pth := path.Join(channel.CalnexAPI(), "ptp_synce", probe.CalnexAPI(), probe.ServerType())
665 if MeasureChannelDatatypeMap[channel] == TE {
666 pth = path.Join(channel.CalnexAPI(), probe.ServerType())
667 }
668 url := fmt.Sprintf(measureURL, a.source, pth)
669 resp, err := a.Client.Get(url)
670 if err != nil {
671 return "", err
672 }
673 defer resp.Body.Close()
674
675 if resp.StatusCode != http.StatusOK {
676 return "", errors.New(http.StatusText(resp.StatusCode))
677 }
678
679 b, err := io.ReadAll(resp.Body)
680 if err != nil {
681 return "", err
682 }
683
684 return parseResponse(string(b))
685}
686
687// FetchUsedChannels returns list of channels in use

Callers 4

ExportFunction · 0.95

Calls 5

parseResponseFunction · 0.85
ServerTypeMethod · 0.80
CloseMethod · 0.65
CalnexAPIMethod · 0.45
GetMethod · 0.45

Tested by 3