func init()

in pkg/analyzer/metrics.go [31:154]


func init() {
	index := 0
	createMetric := func(name string) *Metric {
		result := &Metric{
			Name:     name,
			index:    index,
			maxValue: 65535,
		}
		index++

		IjMetricDescriptors = append(IjMetricDescriptors, result)
		return result
	}

	createVersionedUint16Metric := func(name string, sinceVersion string) *Metric {
		result := createMetric(name)
		result.sinceVersion = sinceVersion
		result.maxValue = 65535
		return result
	}

	createRequiredMetric := func(name string) *Metric {
		result := createMetric(name)
		result.maxValue = 2147483647
		result.isRequired = true
		return result
	}

	createUint32Metric := func(name string) *Metric {
		result := createMetric(name)
		result.maxValue = 4294967295
		return result
	}

	createInt32Metric := func(name string) *Metric {
		result := createMetric(name)
		result.maxValue = 2147483647
		return result
	}

	createUint16Metric := func(name string) *Metric {
		result := createMetric(name)
		result.maxValue = 65535
		return result
	}

	createUint32RequiredMetric := func(name string) *Metric {
		result := createMetric(name)
		result.maxValue = 4294967295
		result.isRequired = true
		return result
	}

	createUint16MetricWithCategory := func(name string, category int) *Metric {
		result := createMetric(name)
		result.category = category
		result.maxValue = 65535
		return result
	}

	createInt32MetricWithCategory := func(name string, category int) *Metric {
		result := createMetric(name)
		result.maxValue = 2147483647
		result.category = category
		return result
	}

	createInstantMetric := func(name string) *Metric {
		result := createMetric(name)
		result.IsInstant = true
		result.maxValue = 2147483647
		return result
	}

	pluginDescriptorLoading := createUint16Metric("pluginDescriptorLoading_d")
	projectProfileLoading := createUint16MetricWithCategory("projectProfileLoading_d", appInitCategory)
	editorRestoring := createInt32Metric("editorRestoring")

	appComponentCreation := createUint16Metric("appComponentCreation_d")
	projectComponentCreation := createUint16Metric("projectComponentCreation_d")

	metricNameToDescriptor = map[string]*Metric{
		"bootstrap":                      createUint32RequiredMetric("bootstrap_d"),
		"app initialization preparation": createRequiredMetric("appInitPreparation_d"),
		"app initialization":             createRequiredMetric("appInit_d"),

		"plugin descriptor loading": pluginDescriptorLoading,
		// old name
		"plugin descriptors loading": pluginDescriptorLoading,
		"plugin initialization":      createVersionedUint16Metric("pluginDescriptorInitV18_d", "18"),

		"app component creation":  appComponentCreation,
		"app components creation": appComponentCreation,

		"project component creation":  projectComponentCreation,
		"project components creation": projectComponentCreation,

		"project frame initialization": createUint16MetricWithCategory("projectFrameInit_d", appInitCategory),

		"project inspection profile loading": projectProfileLoading,
		// old name
		"project inspection profiles loading": projectProfileLoading,

		"project post-startup dumb-aware activities": createInt32Metric("projectDumbAware"),

		"editor restoring":            editorRestoring,
		"editor restoring till paint": createInt32MetricWithCategory("editorRestoringTillPaint", appInitCategory),
		// old name
		"restoring editors": editorRestoring,

		// instant
		"splash initialization": createInstantMetric("splash_i"),
		"startUpCompleted":      createInstantMetric("startUpCompleted"),

		"appStarter": createUint16Metric("appStarter_d"),
		// v19+
		"eua showing": createVersionedUint16Metric("euaShowing_d", "19"),

		"service sync preloading":          createUint32Metric("serviceSyncPreloading_d"),
		"service async preloading":         createUint32Metric("serviceAsyncPreloading_d"),
		"project service sync preloading":  createUint32Metric("projectServiceSyncPreloading_d"),
		"project service async preloading": createUint32Metric("projectServiceAsyncPreloading_d"),
	}
}