MCPcopy Create free account
hub / github.com/cortexlabs/cortex / ProbesFromFile

Function ProbesFromFile

pkg/dequeuer/probes.go:27–46  ·  view source on GitHub ↗
(probesPath string, logger *zap.SugaredLogger)

Source from the content-addressed store, hash-verified

25)
26
27func ProbesFromFile(probesPath string, logger *zap.SugaredLogger) ([]*probe.Probe, error) {
28 fileBytes, err := files.ReadFileBytes(probesPath)
29 if err != nil {
30 return nil, err
31 }
32
33 probesMap := map[string]kcore.Probe{}
34 if err := libjson.Unmarshal(fileBytes, &probesMap); err != nil {
35 return nil, err
36 }
37
38 probesSlice := make([]*probe.Probe, len(probesMap))
39 var i int
40 for _, p := range probesMap {
41 auxProbe := p
42 probesSlice[i] = probe.NewProbe(&auxProbe, logger)
43 i++
44 }
45 return probesSlice, nil
46}
47
48func HasTCPProbeTargetingUserPod(probes []*probe.Probe, userPort int) bool {
49 for _, pb := range probes {

Callers 1

mainFunction · 0.92

Calls 2

ReadFileBytesFunction · 0.92
NewProbeFunction · 0.92

Tested by

no test coverage detected