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

Method FetchChannelProbe

calnex/api/api.go:631–659  ·  view source on GitHub ↗

FetchChannelProbe returns monitored protocol of the channel

(channel Channel)

Source from the content-addressed store, hash-verified

629}
630
631// FetchChannelProbe returns monitored protocol of the channel
632func (a *API) FetchChannelProbe(channel Channel) (*Probe, error) {
633 pth := path.Join(channel.CalnexAPI(), "ptp_synce", "mode", "probe_type")
634 if MeasureChannelDatatypeMap[channel] == TE {
635 pth = path.Join(channel.CalnexAPI(), "signal_type")
636 }
637 url := fmt.Sprintf(measureURL, a.source, pth)
638
639 resp, err := a.Client.Get(url)
640 if err != nil {
641 return nil, err
642 }
643 defer resp.Body.Close()
644
645 if resp.StatusCode != http.StatusOK {
646 return nil, errors.New(http.StatusText(resp.StatusCode))
647 }
648
649 b, err := io.ReadAll(resp.Body)
650 if err != nil {
651 return nil, err
652 }
653
654 probe, err := parseResponse(string(b))
655 if err != nil {
656 return nil, err
657 }
658 p, err := ProbeFromCalnex(probe)
659 return p, err //nolint:nilnil
660}
661
662// FetchChannelTarget returns the measure target of the server monitored on the channel

Callers 4

ExportFunction · 0.95

Calls 5

parseResponseFunction · 0.85
ProbeFromCalnexFunction · 0.85
CloseMethod · 0.65
CalnexAPIMethod · 0.45
GetMethod · 0.45

Tested by 3