|
1 | 1 | import { BACKEND_TO_PANEL_MESSAGES } from '../lib/constants'; |
2 | | -import { metric, runWithMeasure } from './metrics'; |
| 2 | +import { metric, toolDetector } from './metrics'; |
3 | 3 | import { |
4 | 4 | setAlpineVersionFromBackend, |
5 | 5 | setComponentsList, |
@@ -37,40 +37,24 @@ export function handleBackendToPanelMessage( |
37 | 37 | switch (message.type) { |
38 | 38 | case BACKEND_TO_PANEL_MESSAGES.SET_VERSION: { |
39 | 39 | setAlpineVersionFromBackend(message.version); |
40 | | - if (message.hasHtmxTarget || message.hasAlpineAjaxTarget) { |
41 | | - let tools = []; |
42 | | - if (message.hasHtmxTarget) { |
43 | | - tools.push('htmx'); |
44 | | - } |
45 | | - if (message.hasAlpineAjaxTarget) { |
46 | | - tools.push('alpine-ajax'); |
47 | | - } |
48 | | - metric('detected_tools', { |
49 | | - tools: tools.join(','), |
50 | | - }); |
51 | | - } |
| 40 | + metric('detected_tools', { |
| 41 | + tools: toolDetector(message), |
| 42 | + version: message.version, |
| 43 | + }); |
52 | 44 | setPort(port); |
53 | 45 | break; |
54 | 46 | } |
55 | 47 | case BACKEND_TO_PANEL_MESSAGES.SET_COMPONENTS_AND_STORES: { |
56 | | - runWithMeasure('panel_set_components_and_stores', () => { |
57 | | - setComponentsList(message.components, message.url); |
58 | | - setStoresFromList(message.stores); |
59 | | - setPageLoaded(); |
60 | | - setPort(port); |
61 | | - }); |
| 48 | + setComponentsList(message.components, message.url); |
| 49 | + setStoresFromList(message.stores); |
| 50 | + setPageLoaded(); |
| 51 | + setPort(port); |
62 | 52 | break; |
63 | 53 | } |
64 | 54 | case BACKEND_TO_PANEL_MESSAGES.SET_DATA: { |
65 | | - runWithMeasure( |
66 | | - 'panel_set_data', |
67 | | - () => { |
68 | | - const comps = JSON.parse(message.data); |
69 | | - setComponentData(message.componentId, comps); |
70 | | - setPort(port); |
71 | | - }, |
72 | | - { sampled: true, minValueMs: 5 }, |
73 | | - ); |
| 55 | + const comps = JSON.parse(message.data); |
| 56 | + setComponentData(message.componentId, comps); |
| 57 | + setPort(port); |
74 | 58 | break; |
75 | 59 | } |
76 | 60 | case BACKEND_TO_PANEL_MESSAGES.SET_STORE_DATA: { |
|
0 commit comments