Queue
CustomMetricServerRecord
¶
Source code in python/scouter/queue/_queue.pyi
created_at
property
¶
Return the created at timestamp.
metric
property
¶
Return the metric name.
name
property
¶
Return the name.
space
property
¶
Return the space.
value
property
¶
Return the metric value.
version
property
¶
Return the version.
__init__(space, name, version, metric, value)
¶
Initialize spc drift server record
Parameters:
Name | Type | Description | Default |
---|---|---|---|
space
|
str
|
Model space |
required |
name
|
str
|
Model name |
required |
version
|
str
|
Model version |
required |
metric
|
str
|
Metric name |
required |
value
|
float
|
Metric value |
required |
Source code in python/scouter/queue/_queue.pyi
__str__()
¶
model_dump_json()
¶
Feature
¶
Source code in python/scouter/queue/_queue.pyi
categorical(name, value)
staticmethod
¶
Create a categorical feature
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the feature |
required |
value
|
str
|
Value of the feature |
required |
float(name, value)
staticmethod
¶
Create a float feature
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the feature |
required |
value
|
float
|
Value of the feature |
required |
int(name, value)
staticmethod
¶
Create an integer feature
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the feature |
required |
value
|
int
|
Value of the feature |
required |
string(name, value)
staticmethod
¶
Create a string feature
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the feature |
required |
value
|
str
|
Value of the feature |
required |
Features
¶
Source code in python/scouter/queue/_queue.pyi
KafkaConfig
¶
Source code in python/scouter/queue/_queue.pyi
__init__(brokers=None, topic=None, compression_type=None, message_timeout_ms=600000, message_max_bytes=2097164, log_level=LogLevel.Info, config={}, max_retries=3)
¶
Kafka configuration to use with the KafkaProducer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
brokers
|
Optional[str]
|
Comma-separated list of Kafka brokers. If not provided, the value of the KAFKA_BROKERS environment variable is used. |
None
|
topic
|
Optional[str]
|
Kafka topic to publish messages to. If not provided, the value of the KAFKA_TOPIC environment variable is used. |
None
|
compression_type
|
Optional[str]
|
Compression type to use for messages. Default is "gzip". |
None
|
message_timeout_ms
|
int
|
Message timeout in milliseconds. Default is 600_000. |
600000
|
message_max_bytes
|
int
|
Maximum message size in bytes. Default is 2097164. |
2097164
|
log_level
|
LogLevel
|
Log level for the Kafka producer. Default is LogLevel.Info. |
Info
|
config
|
Dict[str, str]
|
Additional Kafka configuration options. These will be passed to the Kafka producer. See https://kafka.apache.org/documentation/#configuration. |
{}
|
max_retries
|
int
|
Maximum number of retries to attempt when publishing messages. Default is 3. |
3
|
Source code in python/scouter/queue/_queue.pyi
Metric
¶
Source code in python/scouter/queue/_queue.pyi
PsiServerRecord
¶
Source code in python/scouter/queue/_queue.pyi
bin_count
property
¶
Return the sample value.
bin_id
property
¶
Return the bin id.
created_at
property
¶
Return the created at timestamp.
feature
property
¶
Return the feature.
name
property
¶
Return the name.
space
property
¶
Return the space.
version
property
¶
Return the version.
__init__(space, name, version, feature, bin_id, bin_count)
¶
Initialize spc drift server record
Parameters:
Name | Type | Description | Default |
---|---|---|---|
space
|
str
|
Model space |
required |
name
|
str
|
Model name |
required |
version
|
str
|
Model version |
required |
feature
|
str
|
Feature name |
required |
bin_id
|
int
|
Bundle ID |
required |
bin_count
|
int
|
Bundle ID |
required |
Source code in python/scouter/queue/_queue.pyi
__str__()
¶
model_dump_json()
¶
Queue
¶
Individual queue associated with a drift profile
Source code in python/scouter/queue/_queue.pyi
insert(entity)
¶
Insert a record into the queue
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity
|
Union[Features, Metrics]
|
Entity to insert into the queue. Can be an instance for Features or Metrics |
required |
Example
Source code in python/scouter/queue/_queue.pyi
RabbitMQConfig
¶
Source code in python/scouter/queue/_queue.pyi
__init__(host=None, port=None, username=None, password=None, queue=None, max_retries=3)
¶
RabbitMQ configuration to use with the RabbitMQProducer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host
|
Optional[str]
|
RabbitMQ host. If not provided, the value of the RABBITMQ_HOST environment variable is used. |
None
|
port
|
Optional[int]
|
RabbitMQ port. If not provided, the value of the RABBITMQ_PORT environment variable is used. |
None
|
username
|
Optional[str]
|
RabbitMQ username. If not provided, the value of the RABBITMQ_USERNAME environment variable is used. |
None
|
password
|
Optional[str]
|
RabbitMQ password. If not provided, the value of the RABBITMQ_PASSWORD environment variable is used. |
None
|
queue
|
Optional[str]
|
RabbitMQ queue to publish messages to. If not provided, the value of the RABBITMQ_QUEUE environment variable is used. |
None
|
max_retries
|
int
|
Maximum number of retries to attempt when publishing messages. Default is 3. |
3
|
Source code in python/scouter/queue/_queue.pyi
RedisConfig
¶
Source code in python/scouter/queue/_queue.pyi
__init__(address=None, chanel=None)
¶
Redis configuration to use with a Redis producer
Parameters:
Name | Type | Description | Default |
---|---|---|---|
address
|
str
|
Redis address. If not provided, the value of the REDIS_ADDR environment variable is used and defaults to "redis://localhost:6379". |
None
|
channel
|
str
|
Redis channel to publish messages to. If not provided, the value of the REDIS_CHANNEL environment variable is used and defaults to "scouter_monitoring". |
required |
Source code in python/scouter/queue/_queue.pyi
ScouterQueue
¶
Main queue class for Scouter. Publishes drift records to the configured transport
Source code in python/scouter/queue/_queue.pyi
__getitem__(key)
¶
Get the queue for the specified key
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
Key to get the queue for |
required |
from_path(path, transport_config)
staticmethod
¶
Initializes Scouter queue from one or more drift profile paths
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
Dict[str, Path]
|
Dictionary of drift profile paths. Each key is a user-defined alias for accessing a queue |
required |
transport_config
|
Union[KafkaConfig, RabbitMQConfig, RedisConfig, HTTPConfig]
|
Transport configuration for the queue publisher Can be KafkaConfig, RabbitMQConfig RedisConfig, or HTTPConfig |
required |
Example
queue = ScouterQueue(
path={
"spc": Path("spc_profile.json"),
"psi": Path("psi_profile.json"),
},
transport_config=KafkaConfig(
brokers="localhost:9092",
topic="scouter_topic",
),
)
queue["psi"].insert(
Features(
features=[
Feature.int("feature_1", 1),
Feature.float("feature_2", 2.0),
Feature.string("feature_3", "value"),
]
)
)
Source code in python/scouter/queue/_queue.pyi
ServerRecord
¶
Source code in python/scouter/queue/_queue.pyi
ServerRecords
¶
Source code in python/scouter/queue/_queue.pyi
records
property
¶
Return the drift server records.
__init__(records)
¶
Initialize server records
Parameters:
Name | Type | Description | Default |
---|---|---|---|
records
|
List[ServerRecord]
|
List of server records |
required |
__str__()
¶
SpcServerRecord
¶
Source code in python/scouter/queue/_queue.pyi
created_at
property
¶
Return the created at timestamp.
feature
property
¶
Return the feature.
name
property
¶
Return the name.
space
property
¶
Return the space.
value
property
¶
Return the sample value.
version
property
¶
Return the version.
__init__(space, name, version, feature, value)
¶
Initialize spc drift server record
Parameters:
Name | Type | Description | Default |
---|---|---|---|
space
|
str
|
Model space |
required |
name
|
str
|
Model name |
required |
version
|
str
|
Model version |
required |
feature
|
str
|
Feature name |
required |
value
|
float
|
Feature value |
required |