Documentation ¶
Index ¶
- Variables
- func GetConfig(key *C.char) *C.PyObject
- func GetHostname(self *C.PyObject, args *C.PyObject) *C.PyObject
- func GetVersion(self *C.PyObject, args *C.PyObject) *C.PyObject
- func Headers(self *C.PyObject, args *C.PyObject) *C.PyObject
- func Initialize(paths ...string) *python.PyThreadState
- func LogMessage(message *C.char, logLevel C.int) *C.PyObject
- func SubmitEvent(check *C.PyObject, checkID *C.char, event *C.PyObject) *C.PyObject
- func SubmitMetric(check *C.PyObject, checkID *C.char, mt C.MetricType, name *C.char, ...) *C.PyObject
- func SubmitServiceCheck(check *C.PyObject, checkID *C.char, name *C.char, status C.int, ...) *C.PyObject
- func ToPython(obj interface{}) (*python.PyObject, error)
- type PythonCheck
- func (c *PythonCheck) Configure(data check.ConfigData, initConfig check.ConfigData) error
- func (c *PythonCheck) GetMetricStats() (map[string]int64, error)
- func (c *PythonCheck) GetWarnings() []error
- func (c *PythonCheck) ID() check.ID
- func (c *PythonCheck) Interval() time.Duration
- func (c *PythonCheck) Run() error
- func (c *PythonCheck) Stop()
- func (c *PythonCheck) String() string
- type PythonCheckLoader
Constants ¶
This section is empty.
Variables ¶
var ( // PythonVersion contains the interpreter version string provided by // `sys.version`. It's empty if the interpreter was not initialized. PythonVersion = "" // PythonHome contains the computed value of the Python Home path once the // intepreter is created. It might be empty in case the interpreter wasn't // initialized, or the Agent was built using system libs and the env var // PYTHONHOME is empty. It's expected to always contain a value when the // Agent is built using embedded libs. PythonHome = "" // PythonPath contains the string representation of the Python list returned // by `sys.path`. It's empty if the interpreter was not initialized. PythonPath = "" )
Functions ¶
func GetHostname ¶
GetHostname expose the current hostname of the agent to python check (used as a PyCFunction in the datadog_agent python module)
func GetVersion ¶
GetVersion expose the version of the agent to python check (used as a PyCFunction in the datadog_agent python module)
func Headers ¶
Headers return HTTP headers with basic information like UserAgent already set (used as a PyCFunction in the datadog_agent python module)
func Initialize ¶
func Initialize(paths ...string) *python.PyThreadState
Initialize wraps all the operations needed to start the Python interpreter and configure the environment. This function should be called at most once in the Agent lifetime.
func LogMessage ¶
LogMessage logs a message from python through the agent logger (see https://docs.python.org/2.7/library/logging.html#logging-levels)
func SubmitEvent ¶
SubmitEvent is the method exposed to Python scripts to submit events
func SubmitMetric ¶
func SubmitMetric(check *C.PyObject, checkID *C.char, mt C.MetricType, name *C.char, value C.float, tags *C.PyObject, hostname *C.char) *C.PyObject
SubmitMetric is the method exposed to Python scripts to submit metrics
Types ¶
type PythonCheck ¶
type PythonCheck struct { ModuleName string // contains filtered or unexported fields }
PythonCheck represents a Python check, implements `Check` interface
func NewPythonCheck ¶
func NewPythonCheck(name string, class *python.PyObject) *PythonCheck
NewPythonCheck conveniently creates a PythonCheck instance
func (*PythonCheck) Configure ¶
func (c *PythonCheck) Configure(data check.ConfigData, initConfig check.ConfigData) error
Configure the Python check from YAML data
func (*PythonCheck) GetMetricStats ¶
func (c *PythonCheck) GetMetricStats() (map[string]int64, error)
GetMetricStats returns the stats from the last run of the check
func (*PythonCheck) GetWarnings ¶
func (c *PythonCheck) GetWarnings() []error
GetWarnings grabs the last warnings from the struct
func (*PythonCheck) Interval ¶
func (c *PythonCheck) Interval() time.Duration
Interval returns the scheduling time for the check
func (*PythonCheck) String ¶
func (c *PythonCheck) String() string
String representation (for debug and logging)
type PythonCheckLoader ¶
type PythonCheckLoader struct {
// contains filtered or unexported fields
}
PythonCheckLoader is a specific loader for checks living in Python modules
func NewPythonCheckLoader ¶
func NewPythonCheckLoader() (*PythonCheckLoader, error)
NewPythonCheckLoader creates an instance of the Python checks loader
func (*PythonCheckLoader) Load ¶
Load tries to import a Python module with the same name found in config.Name, searches for subclasses of the AgentCheck class and returns the corresponding Check
func (*PythonCheckLoader) String ¶
func (cl *PythonCheckLoader) String() string