mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
fix(llma): trace not found due to bad starting timestamp (#39283)
This commit is contained in:
@@ -56,6 +56,7 @@ import {
|
||||
formatLLMUsage,
|
||||
getEventType,
|
||||
getSessionID,
|
||||
getTraceTimestamp,
|
||||
hasSessionID,
|
||||
isLLMTraceEvent,
|
||||
normalizeMessages,
|
||||
@@ -367,7 +368,7 @@ const TreeNode = React.memo(function TraceNode({
|
||||
<Link
|
||||
to={urls.llmAnalyticsTrace(topLevelTrace.id, {
|
||||
event: item.id,
|
||||
timestamp: removeMilliseconds(topLevelTrace.createdAt),
|
||||
timestamp: getTraceTimestamp(topLevelTrace.createdAt),
|
||||
...(searchQuery?.trim() && { search: searchQuery }),
|
||||
})}
|
||||
className={classNames(
|
||||
|
||||
@@ -14,7 +14,7 @@ import { isTracesQuery } from '~/queries/utils'
|
||||
|
||||
import { LLMMessageDisplay } from './ConversationDisplay/ConversationMessagesDisplay'
|
||||
import { llmAnalyticsLogic } from './llmAnalyticsLogic'
|
||||
import { formatLLMCost, formatLLMLatency, formatLLMUsage, normalizeMessages, removeMilliseconds } from './utils'
|
||||
import { formatLLMCost, formatLLMLatency, formatLLMUsage, getTraceTimestamp, normalizeMessages } from './utils'
|
||||
|
||||
export function LLMAnalyticsTraces(): JSX.Element {
|
||||
const { setDates, setShouldFilterTestAccounts, setPropertyFilters, setTracesQuery } = useActions(llmAnalyticsLogic)
|
||||
@@ -88,7 +88,7 @@ const IDColumn: QueryContextColumnComponent = ({ record }) => {
|
||||
<Tooltip title={row.id}>
|
||||
<Link
|
||||
className="ph-no-capture"
|
||||
to={urls.llmAnalyticsTrace(row.id, { timestamp: removeMilliseconds(row.createdAt) })}
|
||||
to={urls.llmAnalyticsTrace(row.id, { timestamp: getTraceTimestamp(row.createdAt) })}
|
||||
>
|
||||
{row.id.slice(0, 4)}...{row.id.slice(-4)}
|
||||
</Link>
|
||||
@@ -103,7 +103,7 @@ const TraceNameColumn: QueryContextColumnComponent = ({ record }) => {
|
||||
<strong>
|
||||
<Link
|
||||
className="ph-no-capture"
|
||||
to={urls.llmAnalyticsTrace(row.id, { timestamp: removeMilliseconds(row.createdAt) })}
|
||||
to={urls.llmAnalyticsTrace(row.id, { timestamp: getTraceTimestamp(row.createdAt) })}
|
||||
>
|
||||
{row.traceName || '–'}
|
||||
</Link>
|
||||
|
||||
@@ -500,6 +500,10 @@ export function removeMilliseconds(timestamp: string): string {
|
||||
return dayjs(timestamp).utc().format('YYYY-MM-DDTHH:mm:ss[Z]')
|
||||
}
|
||||
|
||||
export function getTraceTimestamp(timestamp: string): string {
|
||||
return dayjs(timestamp).utc().subtract(5, 'minutes').format('YYYY-MM-DDTHH:mm:ss[Z]')
|
||||
}
|
||||
|
||||
export function formatLLMEventTitle(event: LLMTrace | LLMTraceEvent): string {
|
||||
if (isLLMTraceEvent(event)) {
|
||||
if (event.event === '$ai_generation') {
|
||||
|
||||
Reference in New Issue
Block a user