Skip to content

Commit b1522ee

Browse files
fix: correct timestamp calculation in dify instrumentation
1 parent e519645 commit b1522ee

File tree

1 file changed

+2
-6
lines changed
  • instrumentation-loongsuite/loongsuite-instrumentation-dify/src/opentelemetry/instrumentation/dify

1 file changed

+2
-6
lines changed

instrumentation-loongsuite/loongsuite-instrumentation-dify/src/opentelemetry/instrumentation/dify/utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
def get_timestamp_from_datetime_attr(obj, attr_name):
66
attr_value = getattr(obj, attr_name, None)
77
if attr_value is not None and isinstance(attr_value, datetime):
8-
timestamp = (
9-
attr_value.timestamp() * 1_000_000_000
10-
+ attr_value.microsecond * 1_000
11-
)
12-
return int(timestamp)
8+
return int(attr_value.timestamp() * 1_000_000_000)
139
return time.time_ns()
1410

15-
1611
def get_llm_common_attributes() -> dict:
1712
return {"callType": "gen_ai", "callKind": "custom_entry"}
13+

0 commit comments

Comments
 (0)