Skip to content
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
2 changes: 2 additions & 0 deletions src/profile-logic/process-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,7 @@ function _convertGeckoMarkerSchema(
display,
data,
graphs,
colorField,
isStackBased,
} = markerSchema;

Expand Down Expand Up @@ -1494,6 +1495,7 @@ function _convertGeckoMarkerSchema(
fields,
description,
graphs,
colorField,
isStackBased,
};
}
Expand Down
36 changes: 36 additions & 0 deletions src/test/unit/__snapshots__/profile-conversion.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Object {
"markerSchema": Array [
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -137,6 +138,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -152,6 +154,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -167,6 +170,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -182,6 +186,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand Down Expand Up @@ -221,6 +226,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand Down Expand Up @@ -248,6 +254,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand Down Expand Up @@ -294,6 +301,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand Down Expand Up @@ -333,6 +341,7 @@ Object {
},
Object {
"chartLabel": "{marker.data.name}",
"colorField": undefined,
"description": "UserTiming is created using the DOM APIs performance.mark() and performance.measure().",
"display": Array [
"marker-chart",
Expand All @@ -354,6 +363,7 @@ Object {
},
Object {
"chartLabel": "{marker.name} — {marker.data.name}",
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -375,6 +385,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-table",
Expand All @@ -401,6 +412,7 @@ Object {
},
Object {
"chartLabel": "{marker.data.eventType}",
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand Down Expand Up @@ -429,6 +441,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -451,6 +464,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -473,6 +487,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -495,6 +510,7 @@ Object {
},
Object {
"chartLabel": "{marker.data.messageType}",
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand Down Expand Up @@ -535,6 +551,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -557,6 +574,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-table",
Expand Down Expand Up @@ -85077,6 +85095,7 @@ Object {
"markerSchema": Array [
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -85092,6 +85111,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -85107,6 +85127,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -85122,6 +85143,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -85137,6 +85159,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand Down Expand Up @@ -85176,6 +85199,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand Down Expand Up @@ -85203,6 +85227,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand Down Expand Up @@ -85249,6 +85274,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand Down Expand Up @@ -85288,6 +85314,7 @@ Object {
},
Object {
"chartLabel": "{marker.data.name}",
"colorField": undefined,
"description": "UserTiming is created using the DOM APIs performance.mark() and performance.measure().",
"display": Array [
"marker-chart",
Expand All @@ -85309,6 +85336,7 @@ Object {
},
Object {
"chartLabel": "{marker.name} — {marker.data.name}",
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -85330,6 +85358,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-table",
Expand All @@ -85356,6 +85385,7 @@ Object {
},
Object {
"chartLabel": "{marker.data.eventType}",
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand Down Expand Up @@ -85384,6 +85414,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -85406,6 +85437,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -85428,6 +85460,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -85450,6 +85483,7 @@ Object {
},
Object {
"chartLabel": "{marker.data.messageType}",
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand Down Expand Up @@ -85490,6 +85524,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-chart",
Expand All @@ -85512,6 +85547,7 @@ Object {
},
Object {
"chartLabel": undefined,
"colorField": undefined,
"description": undefined,
"display": Array [
"marker-table",
Expand Down
82 changes: 82 additions & 0 deletions src/test/unit/process-profile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1006,3 +1006,85 @@ describe('source table processing', function () {
expect(sources.length).toBeGreaterThan(0);
});
});

describe('Marker schema conversion', function () {
it('should preserve optional marker schema properties', function () {
const geckoProfile = createGeckoProfile();

// Add marker schemas with various optional properties
geckoProfile.meta.markerSchema.push(
{
name: 'TestMarkerMinimal',
display: ['marker-chart'],
data: [{ key: 'name', label: 'Name', format: 'string' }],
},
{
name: 'TestMarkerWithLabels',
tooltipLabel: 'Custom Tooltip',
tableLabel: '{marker.data.status}',
chartLabel: 'Chart: {marker.data.name}',
display: ['marker-chart', 'marker-table'],
data: [
{ key: 'name', label: 'Name', format: 'string' },
{ key: 'status', label: 'Status', format: 'string' },
],
},
{
name: 'TestMarkerWithGraphs',
display: ['marker-chart'],
data: [{ key: 'value', label: 'Value', format: 'integer' }],
graphs: [{ key: 'value', type: 'line', color: 'blue' }],
isStackBased: false,
},
{
name: 'TestMarkerWithColor',
display: ['marker-chart', 'marker-table'],
data: [
{ key: 'status', label: 'Status', format: 'string' },
{ key: 'color', label: 'Color', format: 'string' },
],
colorField: 'color',
}
);

// Process the profile
const processedProfile = processGeckoProfile(geckoProfile);

// Test minimal schema works
const schemaMinimal = processedProfile.meta.markerSchema.find(
(s) => s.name === 'TestMarkerMinimal'
);
expect(schemaMinimal).toBeDefined();
expect(schemaMinimal?.tooltipLabel).toBeUndefined();
expect(schemaMinimal?.tableLabel).toBeUndefined();
expect(schemaMinimal?.chartLabel).toBeUndefined();
expect(schemaMinimal?.colorField).toBeUndefined();
expect(schemaMinimal?.graphs).toBeUndefined();
expect(schemaMinimal?.isStackBased).toBeUndefined();

// Test labels are preserved
const schemaWithLabels = processedProfile.meta.markerSchema.find(
(s) => s.name === 'TestMarkerWithLabels'
);
expect(schemaWithLabels).toBeDefined();
expect(schemaWithLabels?.tooltipLabel).toBe('Custom Tooltip');
expect(schemaWithLabels?.tableLabel).toBe('{marker.data.status}');
expect(schemaWithLabels?.chartLabel).toBe('Chart: {marker.data.name}');

// Test graphs and isStackBased are preserved
const schemaWithGraphs = processedProfile.meta.markerSchema.find(
(s) => s.name === 'TestMarkerWithGraphs'
);
expect(schemaWithGraphs).toBeDefined();
expect(schemaWithGraphs?.graphs).toHaveLength(1);
expect(schemaWithGraphs?.isStackBased).toBe(false);
expect(schemaWithGraphs?.colorField).toBeUndefined();

// Test colorField is preserved
const schemaWithColor = processedProfile.meta.markerSchema.find(
(s) => s.name === 'TestMarkerWithColor'
);
expect(schemaWithColor).toBeDefined();
expect(schemaWithColor?.colorField).toBe('color');
});
});
Loading