firebird.lib.monitor

Enums

class firebird.lib.monitor.ShutdownMode(value)[source]

Bases: IntEnum

Shutdown mode.

FULL = 3
MULTI = 1
ONLINE = 0
SINGLE = 2
class firebird.lib.monitor.BackupState(value)[source]

Bases: IntEnum

Physical backup state.

MERGE = 2
NORMAL = 0
STALLED = 1
class firebird.lib.monitor.State(value)[source]

Bases: IntEnum

Object state.

ACTIVE = 1
IDLE = 0
class firebird.lib.monitor.IsolationMode(value)[source]

Bases: IntEnum

Transaction solation mode.

CONCURRENCY = 1
CONSISTENCY = 0
READ_COMMITTED_NO_RV = 3
READ_COMMITTED_RV = 2
class firebird.lib.monitor.Group(value)[source]

Bases: IntEnum

Statistics group.

ATTACHMENT = 1
CALL = 4
DATABASE = 0
STATEMENT = 3
TRANSACTION = 2
class firebird.lib.monitor.Security(value)[source]

Bases: Enum

Security database.

DEFAULT = 'Default'
OTHER = 'Other'
SELF = 'Self'

Classes

class firebird.lib.monitor.Monitor(connection: Connection)[source]

Bases: object

Class for access to Firebird monitoring tables.

Parameters

connection (Connection) –

__init__(connection: Connection)[source]
Parameters

connection (Connection) – Connection that should be used to access monitoring tables.

clear()[source]

Clear all data fetched from monitoring tables.

Note

A snapshot is created the first time any of the monitoring information is being accessed.

close() None[source]

Sever link to Connection.

Return type

None

take_snapshot() None[source]

Takes fresh snapshot of the monitoring information.

Return type

None

property attachments: DataList[AttachmentInfo]

List of all attachments.

property callstack: DataList[CallStackInfo]

List with complete call stack.

property closed: bool

True if link to Connection is closed.

property db: DatabaseInfo

DatabaseInfo object for attached database.

property iostats: DataList[IOStatsInfo]

List of all I/O statistics.

property statements: DataList[StatementInfo]

List of all statements.

property tablestats: DataList[TableStatsInfo]

List of all table record I/O statistics.

property this_attachment: AttachmentInfo

AttachmentInfo object for current connection.

property transactions: DataList[TransactionInfo]

List of all transactions.

property variables: DataList[ContextVariableInfo]

List of all context variables.

class firebird.lib.monitor.InfoItem(monitor: Monitor, attributes: Dict[str, Any])[source]

Bases: object

Base class for all database monitoring objects.

Parameters
  • monitor (Monitor) –

  • attributes (Dict[str, Any]) –

monitor: Monitor

Weak reference to parent Monitor instance.

property stat_id: Group

Internal ID.

class firebird.lib.monitor.DatabaseInfo(monitor: Monitor, attributes: Dict[str, Any])[source]

Bases: InfoItem

Information about attached database.

Parameters
  • monitor (Monitor) –

  • attributes (Dict[str, Any]) –

property backup_state: BackupState

Current state of database with respect to nbackup physical backup.

property cache_size: int

Number of pages allocated in the page cache.

property created: datetime

Creation date and time, i.e., when the database was created or last restored.

property crypt_page: int

Number of page being encrypted.

property forced_writes: bool

True if database uses synchronous writes.

property iostats: IOStatsInfo

IOStatsInfo for this object.

monitor: Monitor

Weak reference to parent Monitor instance.

property name: str

Database filename or alias.

property next_transaction: int

Transaction ID of the next transaction that will be started.

property oat: int

Transaction ID of the oldest active transaction.

property ods: float

On-Disk Structure (ODS) version number.

property oit: int

Transaction ID of the oldest [interesting] transaction.

property ost: int

Transaction ID of the Oldest Snapshot, i.e., the number of the OAT when the last garbage collection was done.

property owner: str

User name of database owner.

property page_size: int

Size of database page in bytes.

property pages: int

Number of pages allocated on disk.

property read_only: bool

True if database is Read Only.

property reserve_space: bool

True if database reserves space on data pages.

property security: Security

Type of security database (Default, Self or Other).

property shutdown_mode: ShutdownMode

Current shutdown mode.

property sql_dialect: int

SQL dialect of the database.

property sweep_interval: int

The sweep interval configured in the database header. Value 0 indicates that sweeping is disabled.

property tablestats: Dict[str, TableStatsInfo]

Dictionary of TableStatsInfo instances for this object.

class firebird.lib.monitor.AttachmentInfo(monitor: Monitor, attributes: Dict[str, Any])[source]

Bases: InfoItem

Information about attachment (connection) to database.

Parameters
  • monitor (Monitor) –

  • attributes (Dict[str, Any]) –

is_active() bool[source]

Returns True if attachment is active.

Return type

bool

is_gc_allowed() bool[source]

Returns True if Garbage Collection is enabled for this attachment.

Return type

bool

is_idle() bool[source]

Returns True if attachment is idle.

Return type

bool

is_internal() bool[source]

Returns True if attachment is internal system attachment.

Return type

bool

terminate() None[source]

Terminates client session associated with this attachment.

Raises

firebird.base.types.Error – If attachement is current session.

Return type

None

property auth_method: str

Authentication method.

property character_set: CharacterSet

Character set name for this attachment.

property client_version: str

Client library version.

property id: int

Attachment ID.

property iostats: IOStatsInfo

IOStatsInfo for this object.

monitor: Monitor

Weak reference to parent Monitor instance.

property name: str

Database filename or alias.

property remote_address: str

Remote address.

property remote_host: str

Name of remote host.

property remote_os_user: str

OS user name of client process.

property remote_pid: int

Remote client process ID.

property remote_process: str

Remote client process pathname.

property remote_protocol: str

Remote protocol name.

property remote_version: str

Remote protocol version.

property role: str

Role name.

property server_pid: int

Server process ID.

property state: State

Attachment state (idle/active).

property statements: DataList[StatementInfo]

List of statements associated with attachment.

property system: bool

True for system attachments.

property tablestats: Dict[str, TableStatsInfo]

Dictionary of TableStatsInfo instances for this object.

property timestamp: datetime

Attachment date/time.

property transactions: DataList[TransactionInfo]

List of transactions associated with attachment.

property user: str

User name.

property variables: DataList[ContextVariableInfo]

List of variables associated with attachment.

class firebird.lib.monitor.TransactionInfo(monitor: Monitor, attributes: Dict[str, Any])[source]

Bases: InfoItem

Information about transaction.

Parameters
  • monitor (Monitor) –

  • attributes (Dict[str, Any]) –

is_active() bool[source]

Returns True if transaction is active.

Return type

bool

is_autocommit() bool[source]

Returns True for autocommited transaction.

Return type

bool

is_autoundo() bool[source]

Returns True for transaction with automatic undo.

Return type

bool

is_idle() bool[source]

Returns True if transaction is idle.

Return type

bool

is_readonly() bool[source]

Returns True if transaction is Read Only.

Return type

bool

property attachment: AttachmentInfo

AttachmentInfo instance to which this transaction belongs.

property id: int

Transaction ID.

property iostats: IOStatsInfo

IOStatsInfo for this object.

property isolation_mode: IsolationMode

Transaction isolation mode code.

property lock_timeout: int

Lock timeout.

monitor: Monitor

Weak reference to parent Monitor instance.

property oldest: int

Oldest transaction (local OIT).

property oldest_active: int

Oldest active transaction (local OAT).

property state: State

Transaction state (idle/active).

property statements: DataList[StatementInfo]

List of statements associated with transaction.

property tablestats: Dict[str, TableStatsInfo]

Dictionary of TableStatsInfo instances for this object.

property timestamp: datetime

Transaction start datetime.

property top: int

Top transaction.

property variables: DataList[ContextVariableInfo]

List of variables associated with transaction.

class firebird.lib.monitor.StatementInfo(monitor: Monitor, attributes: Dict[str, Any])[source]

Bases: InfoItem

Information about executed SQL statement.

Parameters
  • monitor (Monitor) –

  • attributes (Dict[str, Any]) –

is_active() bool[source]

Returns True if statement is active.

Return type

bool

is_idle() bool[source]

Returns True if statement is idle.

Return type

bool

terminate() None[source]

Terminates execution of statement.

Raises

Error – If this attachement is current session.

Return type

None

property attachment: AttachmentInfo

AttachmentInfo instance to which this statement belongs.

property callstack: DataList[CallStackInfo]

List with call stack for statement.

property id: int

Statement ID.

property iostats: IOStatsInfo

IOStatsInfo for this object.

monitor: Monitor

Weak reference to parent Monitor instance.

property plan: str

Explained execution plan.

property sql: str

Statement SQL text, if appropriate.

property state: State

Statement state (idle/active).

property tablestats: Dict[str, TableStatsInfo]

Dictionary of TableStatsInfo instances for this object.

property timestamp: datetime

Statement start datetime.

property transaction: TransactionInfo

TransactionInfo instance to which this statement belongs or None.

class firebird.lib.monitor.CallStackInfo(monitor: Monitor, attributes: Dict[str, Any])[source]

Bases: InfoItem

Information about PSQL call (stack frame).

Parameters
  • monitor (Monitor) –

  • attributes (Dict[str, Any]) –

property caller: CallStackInfo

Call stack entry (CallStackInfo) of the caller.

property column: int

SQL source column number.

property dbobject: Union[Procedure, Trigger, Function]

Database object.

property id: int

Call ID.

property iostats: IOStatsInfo

IOStatsInfo for this object.

property line: int

SQL source line number.

monitor: Monitor

Weak reference to parent Monitor instance.

property object_name: str

PSQL object name.

property object_type: ObjectType

PSQL object type.

property package_name: str

Package name.

property statement: StatementInfo

Top-level StatementInfo instance to which this call stack entry belongs.

property timestamp: datetime

Request start datetime.

class firebird.lib.monitor.IOStatsInfo(monitor: Monitor, attributes: Dict[str, Any])[source]

Bases: InfoItem

Information about page and row level I/O operations, and about memory consumption.

Parameters
  • monitor (Monitor) –

  • attributes (Dict[str, Any]) –

property backouts: int

Number of records where a new primary record version or a change to an existing primary record version is backed out due to rollback or savepoint undo.

property backversion_reads: int

Number of record backversion reads.

property conflits: int

Number of record conflits.

property deletes: int

Number of deleted records.

property expunges: int

Number of records where record version chain is being deleted due to deletions by transactions older than OAT.

property fetches: int

Number of page fetches.

property fragment_reads: int

Number of record fragment reads.

property group: Group

Object group code.

property idx_reads: int

Number of records read via an index.

property inserts: int

Number of inserted records.

property locks: int

Number of record locks.

property marks: int

Number of pages with changes pending.

property max_memory_allocated: int

Maximum number of bytes allocated from the operating system by this object.

property max_memory_used: int

Maximum number of bytes used by this object.

property memory_allocated: int

Number of bytes currently allocated at the OS level.

property memory_used: int

Number of bytes currently in use.

monitor: Monitor

Weak reference to parent Monitor instance.

property owner: Union[DatabaseInfo, AttachmentInfo, TransactionInfo, StatementInfo, CallStackInfo]

Object that owns this IOStats instance.

property purges: int

Number of records where record version chain is being purged of versions no longer needed by OAT or younger transactions.

property reads: int

Number of page reads.

property repeated_reads: int

Number of repeated record reads.

property seq_reads: int

Number of records read sequentially.

property updates: int

Number of updated records.

property waits: int

Number of record waits.

property writes: int

Number of page writes.

class firebird.lib.monitor.TableStatsInfo(monitor: Monitor, attributes: Dict[str, Any])[source]

Bases: InfoItem

Information about row level I/O operations on single table.

Parameters
  • monitor (Monitor) –

  • attributes (Dict[str, Any]) –

property backouts: int

Number of records where a new primary record version or a change to an existing primary record version is backed out due to rollback or savepoint undo.

property backversion_reads: int

Number of record backversion reads.

property conflits: int

Number of record conflits.

property deletes: int

Number of deleted records.

property expunges: int

Number of records where record version chain is being deleted due to deletions by transactions older than OAT.

property fragment_reads: int

Number of record fragment reads.

property group: Group

Object group code.

property idx_reads: int

Number of records read via an index.

property inserts: int

Number of inserted records.

property locks: int

Number of record locks.

monitor: Monitor

Weak reference to parent Monitor instance.

property owner: Union[DatabaseInfo, AttachmentInfo, TransactionInfo, StatementInfo, CallStackInfo]

Object that owns this TableStatsInfo instance.

property purges: int

Number of records where record version chain is being purged of versions no longer needed by OAT or younger transactions.

property repeated_reads: int

Number of repeated record reads.

property row_stat_id: int

Internal ID.

property seq_reads: int

Number of records read sequentially.

property table_name: str

Table name.

property updates: int

Number of updated records.

property waits: int

Number of record waits.

class firebird.lib.monitor.ContextVariableInfo(monitor: Monitor, attributes: Dict[str, Any])[source]

Bases: InfoItem

Information about context variable.

Parameters
  • monitor (Monitor) –

  • attributes (Dict[str, Any]) –

is_attachment_var() bool[source]

Returns True if variable is associated to attachment context.

Return type

bool

is_transaction_var() bool[source]

Returns True if variable is associated to transaction context.

Return type

bool

property attachment: AttachmentInfo

AttachmentInfo instance to which this context variable belongs or None.

monitor: Monitor

Weak reference to parent Monitor instance.

property name: str

Context variable name.

property transaction: TransactionInfo

TransactionInfo instance to which this context variable belongs or None.

property value: str

Value of context variable.