Move files
This commit is contained in:
parent
d2af1b8151
commit
f160b07163
159 changed files with 104 additions and 88 deletions
15
src/great_ai/parameters/log_metric.py
Normal file
15
src/great_ai/parameters/log_metric.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import inspect
|
||||
from typing import Any
|
||||
|
||||
from ..context import get_context
|
||||
from ..tracing import TracingContext
|
||||
|
||||
|
||||
def log_metric(argument_name: str, value: Any) -> None:
|
||||
tracing_context = TracingContext.get_current_tracing_context()
|
||||
caller = inspect.stack()[1].function
|
||||
actual_name = f"metric:{caller}:{argument_name}"
|
||||
if tracing_context:
|
||||
tracing_context.log_value(name=actual_name, value=value)
|
||||
|
||||
get_context().logger.info(f"{actual_name}={value}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue