MM-62901: Apply constLabels on all metrics (#30125)

When the client side metrics were added constLabels
got missed out. Without this, we cannot do the high
level grouping by rings.

https://mattermost.atlassian.net/browse/MM-62901

```release-note
NONE
```
This commit is contained in:
Agniva De Sarker 2025-02-06 21:45:57 +05:30 committed by GitHub
parent 50c7f1df12
commit d34dcc2dda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1194,6 +1194,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Subsystem: MetricsSubsystemClientsWeb,
Name: "time_to_first_byte",
Help: "Duration from when a browser starts to request a page from a server until when it starts to receive data in response (seconds)",
ConstLabels: additionalLabels,
},
[]string{"platform", "agent"},
m.Platform.Log(),
@ -1206,6 +1207,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Subsystem: MetricsSubsystemClientsWeb,
Name: "time_to_last_byte",
Help: "Duration from when a browser starts to request a page from a server until when it receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. (seconds)",
ConstLabels: additionalLabels,
},
[]string{"platform", "agent"},
m.Platform.Log(),
@ -1219,6 +1221,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "dom_interactive",
Help: "Duration from when a browser starts to request a page from a server until when it sets the document's readyState to interactive. (seconds)",
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 7.5, 10, 12.5, 15},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent"},
m.Platform.Log(),
@ -1232,6 +1235,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "splash_screen",
Help: "Duration from when a browser starts to request a page from a server until when the splash screen ends. (seconds)",
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 7.5, 10, 12.5, 15},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "page_type"},
m.Platform.Log(),
@ -1247,6 +1251,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
// Extend the range of buckets for this while we get a better idea of the expected range of this metric is
Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 15, 20},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent"},
)
@ -1261,6 +1266,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
// Extend the range of buckets for this while we get a better idea of the expected range of this metric is
Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 15, 20},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "region"},
)
@ -1272,6 +1278,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Subsystem: MetricsSubsystemClientsWeb,
Name: "interaction_to_next_paint",
Help: "Measure of how long it takes for a user to see the effects of clicking with a mouse, tapping with a touchscreen, or pressing a key on the keyboard (seconds)",
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "interaction"},
)
@ -1283,6 +1290,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Subsystem: MetricsSubsystemClientsWeb,
Name: "cumulative_layout_shift",
Help: "Measure of how much a page's content shifts unexpectedly",
ConstLabels: additionalLabels,
},
[]string{"platform", "agent"},
)
@ -1294,6 +1302,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Subsystem: MetricsSubsystemClientsWeb,
Name: "long_tasks",
Help: "Counter of the number of times that the browser's main UI thread is blocked for more than 50ms by a single task",
ConstLabels: additionalLabels,
},
[]string{"platform", "agent"},
)
@ -1306,6 +1315,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "page_load",
Help: "The amount of time from when the browser starts loading the web app until when the web app's load event has finished (seconds)",
Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 20, 40},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent"},
m.Platform.Log(),
@ -1318,6 +1328,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Subsystem: MetricsSubsystemClientsWeb,
Name: "channel_switch",
Help: "Duration of the time taken from when a user clicks on a channel in the LHS to when posts in that channel become visible (seconds)",
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "fresh"},
)
@ -1329,6 +1340,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Subsystem: MetricsSubsystemClientsWeb,
Name: "team_switch",
Help: "Duration of the time taken from when a user clicks on a team in the LHS to when posts in that team become visible (seconds)",
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "fresh"},
)
@ -1340,6 +1352,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Subsystem: MetricsSubsystemClientsWeb,
Name: "rhs_load",
Help: "Duration of the time taken from when a user clicks to open a thread in the RHS until when posts in that thread become visible (seconds)",
ConstLabels: additionalLabels,
},
[]string{"platform", "agent"},
)
@ -1351,6 +1364,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Subsystem: MetricsSubsystemClientsWeb,
Name: "global_threads_load",
Help: "Duration of the time taken from when a user clicks to open Threads in the LHS until when the global threads view becomes visible (milliseconds)",
ConstLabels: additionalLabels,
},
[]string{"platform", "agent"},
)
@ -1363,6 +1377,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "mobile_load",
Help: "Duration of the time taken from when a user opens the app and the app finally loads all relevant information (seconds)",
Buckets: []float64{1, 1.5, 2, 3, 4, 4.5, 5, 5.5, 6, 7.5, 10, 20, 25, 30},
ConstLabels: additionalLabels,
},
[]string{"platform"},
)
@ -1374,6 +1389,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "mobile_network_requests_average_speed",
Help: "Average speed of network requests in megabytes per second (MBps)",
Buckets: []float64{1000, 10000, 50000, 100000, 500000, 1000000, 5000000},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "network_request_group"},
)
@ -1385,6 +1401,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "mobile_network_requests_effective_latency",
Help: "Effective latency of network requests in seconds",
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "network_request_group"},
)
@ -1396,6 +1413,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "mobile_network_requests_elapsed_time",
Help: "Total elapsed time of network requests in seconds",
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "network_request_group"},
)
@ -1407,6 +1425,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "mobile_network_requests_latency",
Help: "Latency of network requests in seconds",
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "network_request_group"},
)
@ -1418,6 +1437,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "mobile_network_requests_total_compressed_size",
Help: "Total compressed size of network requests in bytes",
Buckets: []float64{0.1, 0.5, 1, 2, 5, 10, 20, 50},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "network_request_group"},
)
@ -1429,6 +1449,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "mobile_network_requests_total_parallel_requests",
Help: "Total number of parallel network requests made",
Buckets: []float64{1, 2, 5, 10, 20, 50, 100},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "network_request_group"},
)
@ -1440,6 +1461,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "mobile_network_requests_total_requests",
Help: "Total number of network requests made",
Buckets: []float64{1, 2, 5, 10, 20, 50, 100},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "network_request_group"},
)
@ -1451,6 +1473,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "mobile_network_requests_total_sequential_requests",
Help: "Total number of sequential network requests made",
Buckets: []float64{1, 2, 5, 10, 20, 50, 100},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "network_request_group"},
)
@ -1462,6 +1485,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "mobile_network_requests_total_size",
Help: "Total uncompressed size of network requests in bytes",
Buckets: []float64{1000, 10000, 50000, 100000, 500000, 1000000, 5000000},
ConstLabels: additionalLabels,
},
[]string{"platform", "agent", "network_request_group"},
)
@ -1484,6 +1508,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "mobile_channel_switch",
Help: "Duration of the time taken from when a user clicks on a channel name, and the full channel sreen is loaded (seconds)",
Buckets: []float64{0.150, 0.200, 0.300, 0.400, 0.450, 0.500, 0.550, 0.600, 0.750, 1, 2, 3},
ConstLabels: additionalLabels,
},
[]string{"platform"},
)
@ -1496,6 +1521,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "mobile_team_switch",
Help: "Duration of the time taken from when a user clicks on a team, and the full categories screen is loaded (seconds)",
Buckets: []float64{0.150, 0.200, 0.250, 0.300, 0.350, 0.400, 0.500, 0.750, 1, 2, 3},
ConstLabels: additionalLabels,
},
[]string{"platform"},
)
@ -1507,6 +1533,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Subsystem: MetricsSubsystemClientsMobileApp,
Name: "mobile_session_metadata",
Help: "The number of mobile sessions in each version, platform and whether they have the notifications disabled",
ConstLabels: additionalLabels,
},
[]string{"version", "platform", "notifications_disabled"},
)
@ -1519,6 +1546,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "cpu_usage",
Help: "Average CPU usage of a specific process over an interval",
Buckets: []float64{0, 1, 2, 3, 5, 8, 13, 21, 34, 55, 80, 100},
ConstLabels: additionalLabels,
},
[]string{"platform", "version", "processName"},
)
@ -1531,6 +1559,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Name: "memory_usage",
Help: "Memory usage in MB of a specific process",
Buckets: []float64{0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 3000, 5000},
ConstLabels: additionalLabels,
},
[]string{"platform", "version", "processName"},
)