Пример #1
0
def make_stream_logger(request) -> (StringIO, Logger):
    stream = StringIO()
    logger = create_logger("debug", request.param, "test-logger", stream)
    yield stream, logger
Пример #2
0
from fastapi import APIRouter, Response, Request

from mlrun.api.crud.model_endpoints import ModelEndpoints, get_access_key
from mlrun.api.schemas import (
    GrafanaTable,
    GrafanaColumn,
    ModelEndpointState,
)
from mlrun.config import config
from mlrun.errors import MLRunBadRequestError
from mlrun.utils.logger import create_logger
from mlrun.utils.v3io_clients import get_frames_client

router = APIRouter()

logger = create_logger(level="debug", name="grafana_proxy")


@router.get("/grafana-proxy/model-endpoints", status_code=HTTPStatus.OK.value)
def grafana_proxy_model_endpoints_check_connection(request: Request):
    """
    Root of grafana proxy for the model-endpoints API, used for validating the model-endpoints data source
    connectivity.
    """
    get_access_key(request)
    return Response(status_code=HTTPStatus.OK.value)


@router.post("/grafana-proxy/model-endpoints/query",
             response_model=List[GrafanaTable])
async def grafana_proxy_model_endpoints_query(