Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/forge/observability/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
import json
import logging
import os
import time
from abc import ABC, abstractmethod
from dataclasses import dataclass
from datetime import datetime
from enum import Enum
from typing import Any, Dict, List

import pytz

from forge.observability.utils import get_proc_name_with_rank

from forge.util.logging import get_logger, log_once
Expand Down Expand Up @@ -91,7 +89,7 @@ def accumulator_class(self):
class Metric:
"""Container for metric data including key, value, reduction type, and timestamp.

Timestamp is automatically set to current UTC time if not provided.
Timestamp is automatically set to current time if not provided.
"""

key: str
Expand All @@ -101,8 +99,7 @@ class Metric:

def __post_init__(self):
if self.timestamp is None:
# Always record in UTC timezone
self.timestamp = datetime.now(pytz.UTC).timestamp()
self.timestamp = time.time()


def record_metric(key: str, value: Any, reduction: Reduce = Reduce.MEAN) -> None:
Expand Down
Loading