getPythonWarnings grabs the last warnings from the python check
(gstate *stickyLock)
| 189 | |
| 190 | // getPythonWarnings grabs the last warnings from the python check |
| 191 | func (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 |
| 221 | func (c *PythonCheck) Configure(senderManager sender.SenderManager, integrationConfigDigest uint64, data integration.Data, initConfig integration.Data, source string) error { |
no test coverage detected