endstone.metrics.base

Classes

NameDescription
MetricsBase

The MetricsBase class to handle sending metrics to bStats.

classMetricsBase

Bases: ABC

MetricsBase(platform: str, server_uuid: UUID, service_id: int, log_errors: bool, log_sent_data: bool, log_response_status_text: bool)

The MetricsBase class to handle sending metrics to bStats.

Attributes

NameTypeDescription
METRICS_VERSIONstr

The version of the Metrics class.

REPORT_URLstr

The URL to which data is reported.

Parameters

NameTypeDescriptionDefault
platformstr

The platform of the service.

required
server_uuidUUID

The server UUID.

required
service_idint

The service ID.

required
log_errorsbool

Whether errors should be logged.

required
log_sent_databool

Whether the data sent should be logged.

required
log_response_status_textbool

Whether the response status text should be logged.

required

Methods

NameDescription
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: bool

Whether data sending is enabled.

attrservice_enabledabstractmethodproperty

service_enabled: bool

Whether the service is enabled.

methadd_custom_chart

add_custom_chart(chart: Any)

Adds a custom chart.

Parameters

NameTypeDescriptionDefault
chartAny

The custom chart to add.

required

methappend_platform_data

append_platform_data(data: Dict[str, Any]) -> None

Append platform-specific data.

Parameters

NameTypeDescriptionDefault
dataDict[str, Any]

The data to append platform-specific values to.

required

methappend_service_data

append_service_data(data: Dict[str, Any]) -> None

Append service-specific data.

Parameters

NameTypeDescriptionDefault
dataDict[str, Any]

The data to append service-specific values to.

required

methlog_error

log_error(message: str, exception: Exception) -> None

Logs error message.

Parameters

NameTypeDescriptionDefault
messagestr

The error message.

required
exceptionException

The exception that occurred.

required

methlog_info

log_info(message: str) -> None

Logs info message.

Parameters

NameTypeDescriptionDefault
messagestr

The info message.

required

methshutdown

shutdown()

methsubmit_task

submit_task(task: Callable[[], None]) -> None

Submit the given task

Parameters

NameTypeDescriptionDefault
taskCallable[[], None]

The task to be submitted.

required

On this page