Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(new-trace): Making trace project slugs unique #81435

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ export function TraceMetaDataHeader(props: TraceMetadataHeaderProps) {
);

const projectSlugs = useMemo(() => {
return Array.from(props.tree.projects).map(p => p.slug);
}, [props.tree]);
return Array.from(props.tree.projects.values()).map(project => project.slug);
}, [props.tree.projects]);

if (!hasNewTraceViewUi) {
return <LegacyTraceMetadataHeader {...props} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ export declare namespace TraceTree {
type TracePerformanceIssue = TracePerformanceIssueType;
type Profile = {profile_id: string} | {profiler_id: string};
type Project = {
id: number;
slug: string;
};
type Root = null;
Expand Down Expand Up @@ -237,7 +236,7 @@ function fetchTrace(

export class TraceTree extends TraceTreeEventDispatcher {
eventsCount = 0;
projects = new Set<TraceTree.Project>();
projects = new Map<number, TraceTree.Project>();

type: 'loading' | 'empty' | 'error' | 'trace' = 'trace';
root: TraceTreeNode<null> = TraceTreeNode.Root();
Expand Down Expand Up @@ -295,8 +294,7 @@ export class TraceTree extends TraceTreeEventDispatcher {
value: TraceTree.Transaction | TraceTree.TraceError
) {
tree.eventsCount++;
tree.projects.add({
id: value.project_id,
tree.projects.set(value.project_id, {
slug: value.project_slug,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ function filterProjects(projects: Project[], tree: TraceTree) {
const projectsWithOnboardingChecklist: Project[] = [];

for (const project of projects) {
if (Array.from(tree.projects).some(p => Number(project.id) === p.id)) {
const hasProject = tree.projects.has(Number(project.id));
if (hasProject) {
if (!project.firstTransactionEvent) {
projectsWithNoPerformance.push(project);
if (project.platform && withPerformanceOnboarding.has(project.platform)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function usePerformanceUsageStats({
field: 'sum(quantity)',
utc: true,
category: 'transaction_indexed',
project: Array.from(tree.projects).map(project => project.id),
project: Array.from(tree.projects.keys()),
referrer: 'trace-view-warnings',
},
};
Expand Down
Loading