MCPcopy Create free account
hub / github.com/DataDog/datadog-agent / getPythonWarnings

Method getPythonWarnings

pkg/collector/python/check.go:191–218  ·  view source on GitHub ↗

getPythonWarnings grabs the last warnings from the python check

(gstate *stickyLock)

Source from the content-addressed store, hash-verified

189
190// getPythonWarnings grabs the last warnings from the python check
191func (c *PythonCheck) getPythonWarnings(gstate *stickyLock) []error {
192 /**
193 This function is run with the GIL locked by runCheck
194 **/
195
196 pyWarnings := C.get_checks_warnings(rtloader, c.instance)
197 if pyWarnings == nil {
198 if err := getRtLoaderError(); err != nil {
199 log.Errorf("error while collecting python check's warnings: %s", err)
200 }
201 return nil
202 }
203
204 warnings := []error{}
205 for i := 0; ; i++ {
206 // Work around go vet raising issue about unsafe pointer
207 warnPtr := C.getStringAddr(pyWarnings, C.uint(i))
208 if warnPtr == nil {
209 break
210 }
211 warn := C.GoString(warnPtr)
212 warnings = append(warnings, errors.New(warn))
213 C.rtloader_free(rtloader, unsafe.Pointer(warnPtr))
214 }
215 C.rtloader_free(rtloader, unsafe.Pointer(pyWarnings))
216
217 return warnings
218}
219
220// Configure the Python check from YAML data
221func (c *PythonCheck) Configure(senderManager sender.SenderManager, integrationConfigDigest uint64, data integration.Data, initConfig integration.Data, source string) error {

Callers 1

runCheckMethod · 0.95

Calls 2

ErrorfFunction · 0.92
getRtLoaderErrorFunction · 0.85

Tested by

no test coverage detected