endstone.metrics.base
Classes
| Name | Description |
|---|---|
MetricsBase | The MetricsBase class to handle sending metrics to bStats. |
classMetricsBase
Bases: ABC
The MetricsBase class to handle sending metrics to bStats.
Attributes
| Name | Type | Description |
|---|---|---|
METRICS_VERSION | str | The version of the Metrics class. |
REPORT_URL | str | The URL to which data is reported. |
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
platform | str | The platform of the service. | required |
server_uuid | UUID | The server UUID. | required |
service_id | int | The service ID. | required |
log_errors | bool | Whether errors should be logged. | required |
log_sent_data | bool | Whether the data sent should be logged. | required |
log_response_status_text | bool | Whether the response status text should be logged. | required |
Methods
| Name | Description |
|---|---|
add_custom_chart | Adds a custom chart. |
append_platform_data | Append platform-specific data. |
append_service_data | Append service-specific data. |
log_error | Logs error message. |
log_info | Logs info message. |
shutdown | |
submit_task | Submit the given task |
attrMETRICS_VERSION
METRICS_VERSION = '3.0.3'attrREPORT_URL
REPORT_URL = 'https://bStats.org/api/v2/data/{platform}'attrenabledabstractmethodproperty
enabled: boolWhether data sending is enabled.
attrservice_enabledabstractmethodproperty
service_enabled: boolWhether the service is enabled.
methadd_custom_chart
add_custom_chart(chart: Any)Adds a custom chart.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
chart | Any | The custom chart to add. | required |
methappend_platform_data
Append platform-specific data.
methappend_service_data
Append service-specific data.
methlog_error
Logs error message.
methlog_info
log_info(message: str) -> NoneLogs info message.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
message | str | The info message. | required |
methshutdown
shutdown()methsubmit_task
submit_task(task: Callable[[], None]) -> NoneSubmit the given task
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
task | Callable[[], None] | The task to be submitted. | required |