Untitled

mail@pastecode.io avatar
unknown
python
a year ago
756 B
2
Indexable
Never
    def save_data(self, route_table_statuses):
        try:
            [self.connection.write_points(
                StatusRepositoryPoint(
                    status.environment(),
                    status.state().value
                )
            ) for status in route_table_statuses]


class StatusRepositoryPoint:
    def __init__(self, environment, state):
        self.__environment = environment
        self.__state = state

    def __repr__(self):
        return self.__str__()

    def __str__(self):
        return {
            "measurement": "master-route-table",
            "tags": {
                "environment": self.__environment
            },
            "fields": {
                "status": self.__state
            }
        }