2024-05-07 11:33:12 +00:00
|
|
|
from terminal.utils.loki_client import get_loki_client
|
|
|
|
|
|
|
|
__all__ = ['LokiMixin', ]
|
|
|
|
|
2024-07-31 02:55:00 +00:00
|
|
|
|
2024-05-07 11:33:12 +00:00
|
|
|
class LokiMixin:
|
|
|
|
|
2024-07-31 02:55:00 +00:00
|
|
|
@staticmethod
|
|
|
|
def get_loki_client():
|
2024-05-07 11:33:12 +00:00
|
|
|
return get_loki_client()
|
|
|
|
|
2024-07-31 02:55:00 +00:00
|
|
|
@staticmethod
|
|
|
|
def create_loki_query(components, search):
|
2024-05-07 11:33:12 +00:00
|
|
|
stream_selector = '{component!=""}'
|
|
|
|
if components:
|
|
|
|
stream_selector = '{component=~"%s"}' % components
|
|
|
|
query = f'{stream_selector} |="{search}"'
|
|
|
|
return query
|