Skip to content

Commit

Permalink
Fixing the groupby field name and some UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
manojVivek committed Feb 12, 2025
1 parent 39a8752 commit 4393d9a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/query/columnquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ func (q *ColumnQueryAPI) Query(ctx context.Context, req *pb.QueryRequest) (*pb.Q
FlamegraphFieldFunctionName: {},
FlamegraphFieldLocationAddress: {},
FlamegraphFieldMappingFile: {},
FlamegraphFieldTimestamp: {},
profile.ColumnTimeNanos: {},
}

if req.GetReportType() == pb.QueryRequest_REPORT_TYPE_FLAMECHART {
groupBy = append(groupBy, FlamegraphFieldTimestamp, FlamegraphFieldDuration)
groupBy = append(groupBy, profile.ColumnTimeNanos, FlamegraphFieldDuration)
}

groupByLabels := make([]string, 0, len(groupBy))
Expand Down
19 changes: 16 additions & 3 deletions ui/packages/shared/profile/src/GraphTooltipArrow/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import React from 'react';
import {Icon} from '@iconify/react';
import {Table} from 'apache-arrow';

import {useParcaContext} from '@parca/components';
import {ProfileType} from '@parca/parser';
import {getLastItem} from '@parca/utilities';
import {formatDateTimeDownToMS, getLastItem} from '@parca/utilities';

import {hexifyAddress, truncateString, truncateStringReverse} from '../utils';
import {ExpandOnHover} from './ExpandOnHoverValue';
Expand Down Expand Up @@ -141,7 +142,9 @@ const TooltipMetaInfo = ({table, row}: {table: Table<any>; row: number}): React.
mappingFile,
mappingBuildID,
inlined,
timestamp,
} = useGraphTooltipMetaInfo({table, row});
const {timezone} = useParcaContext();

const labels = labelPairs.map(
(l): React.JSX.Element => (
Expand All @@ -159,9 +162,19 @@ const TooltipMetaInfo = ({table, row}: {table: Table<any>; row: number}): React.

return (
<>
{timestamp == null || timestamp === 0n ? (
<div className="pt-2" />
) : (
<tr>
<td className="w-1/4 pt-2">Timestamp</td>
<td className="w-3/4 pt-2 break-all">
{formatDateTimeDownToMS(new Date(Number(timestamp / 1000000n)), timezone)}
</td>{' '}
</tr>
)}
<tr>
<td className="w-1/4 pt-2">File</td>
<td className="w-3/4 pt-2 break-all">
<td className="w-1/4">File</td>
<td className="w-3/4 break-all">
{functionFilename === '' ? (
<NoData />
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
FIELD_LOCATION_LINE,
FIELD_MAPPING_BUILD_ID,
FIELD_MAPPING_FILE,
FIELD_TIMESTAMP,
} from '../../ProfileIcicleGraph/IcicleGraphArrow';
import {arrowToString} from '../../ProfileIcicleGraph/IcicleGraphArrow/utils';
import {ProfileSource} from '../../ProfileSource';
Expand All @@ -47,6 +48,7 @@ interface GraphTooltipMetaInfoData {
mappingFile: string | null;
mappingBuildID: string | null;
inlined: boolean | null;
timestamp: bigint | null;
}

export const useGraphTooltipMetaInfo = ({table, row}: Props): GraphTooltipMetaInfoData => {
Expand All @@ -66,6 +68,7 @@ export const useGraphTooltipMetaInfo = ({table, row}: Props): GraphTooltipMetaIn
locationLine !== 0n ? locationLine : functionStartLine !== 0n ? functionStartLine : undefined;
const labelPrefix = 'labels.';
const labelColumnNames = table.schema.fields.filter(field => field.name.startsWith(labelPrefix));
const timestamp = table.getChild(FIELD_TIMESTAMP)?.get(row);

const {queryServiceClient, enableSourcesView} = useParcaContext();
const {profileSource} = useProfileViewContext();
Expand Down Expand Up @@ -140,5 +143,6 @@ export const useGraphTooltipMetaInfo = ({table, row}: Props): GraphTooltipMetaIn
mappingBuildID,
mappingFile,
inlined,
timestamp,
};
};
3 changes: 2 additions & 1 deletion ui/packages/shared/profile/src/ProfileSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export interface ProfileSelection {
ProfileSource: () => ProfileSource;
Type: () => string;
}
const timeFormat = (timezone?: string): string => {

export const timeFormat = (timezone?: string): string => {
if (timezone !== undefined) {
return 'yyyy-MM-dd HH:mm:ss';
}
Expand Down
2 changes: 1 addition & 1 deletion ui/packages/shared/utilities/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,5 +382,5 @@ export const isUrlEncoded = (str: string): boolean => {
export function formatDateTimeDownToMS(timestamp: Date, timezone?: string): string {
return timezone !== undefined
? format(timestamp, "yyyy:MM:dd'T'HH:mm:ss.SSS", {timeZone: timezone})
: format(timestamp, "yyyy:MM:dd'T'HH:mm:ss.SSS", {timeZone: 'UTC'});
: `${format(timestamp, "yyyy:MM:dd'T'HH:mm:ss.SSS", {timeZone: 'UTC'})} (UTC)`;
}

0 comments on commit 4393d9a

Please sign in to comment.