Welcome to pamagent’s documentation!¶
-
pamagent.transaction_cache.
current_transaction
()[source]¶ Return the transaction object if one exists for the currently executing thread.
-
pamagent.transaction_cache.
drop_transaction
(transaction)[source]¶ Drops the specified transaction, validating that it is actually saved away under the current executing thread.
-
pamagent.transaction_cache.
save_transaction
(transaction)[source]¶ Saves the specified transaction away under the thread ID of the current executing thread.
-
pamagent.transaction_cache.
set_transaction_path
(path)[source]¶ Parameters: path – path of request URI Returns: None
PamagentCore¶
This module is implemented in Rust.
This module has the ability to configure the logging level To configure the logging, it is necessary to set the variable environment PAMAGENT_LEVEL_LOG with a value from 0 to 3 before the application starts, if the environment variable is not set to the default value of 0 (see pamcore/src/logging.rs for more information)
-
pamagent.pamagent_core.
activate
()¶ Activate output transport to PAMCollector
Parameters: - token (str) – Secret token for auth on PAMCollector.
- addr (str) – Address with format host:port for connect to PAMCollector instance .
Returns: the return code.
Return type: bool
-
pamagent.pamagent_core.
drop_transaction
()¶ Drop transaction from transaction cache
Parameters: id (int) – Transaction ID. ThreadID as usual. Returns: the return code. Return type: bool
-
pamagent.pamagent_core.
dump_transaction
()¶ Dump transaction into JSON string
Parameters: id (int) – Transaction ID. ThreadID as usual. Returns: The JSON string . If Transaction not found return empty string Return type: str
-
pamagent.pamagent_core.
get_transaction
()¶ Get transaction by id
Parameters: id (int) – Transaction ID. ThreadID as usual. Returns: Return transaction_id or None if Transaction not availability. Return type: int or None
-
pamagent.pamagent_core.
get_transaction_end_time
()¶ Get transaction end time
Parameters: id (int) – Transaction ID. ThreadID as usual. Returns: Return timestamp when Transaction ended. If Transaction not found or Transaction has empty stack (transaction not activate) return 0.0 Return type: float
-
pamagent.pamagent_core.
get_transaction_start_time
()¶ Get transaction start time
Parameters: id (int) – Transaction ID. ThreadID as usual. Returns: Return timestamp when Transaction started. If Transaction not found or Transaction has empty stack (transaction not activate) return 0.0 Return type: float
-
pamagent.pamagent_core.
pop_current
()¶ Pop TraceNode from TraceStack. Call when TransactionNode is closed.
Parameters: - id (int) – Transaction ID. ThreadID as usual.
- node_id (int) – ID of TransactionNode. Object.__id__ as usual.
- end_time (float) – Timestamp when TransactionNode is closed.
Returns: Return ID of Parent TransactionNode. If current TransactionNode not found return None
Return type: int or None
-
pamagent.pamagent_core.
push_current
()¶ Push trace node to current transaction
Parameters: - id (int) – Transaction ID. ThreadID as usual.
- node_id (int) – ID of TransactionNode. Object.__id__ as usual.
- start_time (float) – Timestamp when TransactionNode is activated
- func_name (str or None) – Function name if exists
Returns: the return code.
Return type: bool
-
pamagent.pamagent_core.
push_current_cache
()¶ Push cache trace node to current transaction
Parameters: - id (int) – Transaction ID. ThreadID as usual.
- node_id (int) – ID of TransactionNode. Object.__id__ as usual.
- start_time (float) – Timestamp when TransactionNode is activated
- database_product (str) – Name of database product
- database_name (str) – Name of database name.
- host (str) – Host of cache instanse
- port (int) – Port of cache instanse
-
pamagent.pamagent_core.
push_current_database
()¶ Push database trace node to current transaction
Parameters: - id (int) – Transaction ID. ThreadID as usual.
- node_id (int) – ID of TransactionNode. Object.__id__ as usual.
- start_time (float) – Timestamp when TransactionNode is activated
- database_product (str) – Name of database product
- database_name (str) – Name of database name or database file path
- host (str) – Host of database instanse
- port (int) – Port of database instanse
- operation (str) – SQL Operation
- target (str) – Target table/view
- sql (str) – Obfuscated sql
-
pamagent.pamagent_core.
push_current_external
()¶ Push external trace node to current transaction
Parameters: - id (int) – Transaction ID. ThreadID as usual.
- node_id (int) – ID of TransactionNode. Object.__id__ as usual.
- start_time (float) – Timestamp when TransactionNode is activated
- url (str) – Full URL that was used to request an external service.
- library (str) – Name of library
- method (str) – Method that was used to request an external service
Returns: the return code.
Return type: bool
-
pamagent.pamagent_core.
set_transaction
()¶ Set transaction
Parameters: - id (int) – Transaction ID. ThreadID as usual.
- transaction (str) – Transaction name.
- path (str) – Path of transaction. URI without qs as usual.
Returns: the return code.
Return type: bool
-
pamagent.pamagent_core.
set_transaction_path
()¶ Set transaction path
Parameters: - id (int) – Transaction ID. ThreadID as usual.
- path (str) – Path for Transaction. URI or handler name as usual.
Returns: the return code.
Return type: bool