mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:10:43 +07:00
FUS: deprecate methods in state collectors in favour of new event log API
GitOrigin-RevId: d14438b2de1f4465bb7ebc6934396811a80e90f2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
234bc028b5
commit
5ee5c13915
@@ -7,6 +7,7 @@ import com.intellij.openapi.util.Comparing
|
||||
/**
|
||||
* Reports numerical or string value of the setting if it's not default.
|
||||
*/
|
||||
@Deprecated("Use EventLogGroup#registerEvent and EventId#metric instead")
|
||||
fun <T> addIfDiffers(set: MutableSet<in MetricEvent>, settingsBean: T, defaultSettingsBean: T,
|
||||
valueFunction: Function1<T, Any>, eventId: String) {
|
||||
addIfDiffers(set, settingsBean, defaultSettingsBean, valueFunction, eventId, null)
|
||||
@@ -15,6 +16,7 @@ fun <T> addIfDiffers(set: MutableSet<in MetricEvent>, settingsBean: T, defaultSe
|
||||
/**
|
||||
* Reports numerical or string value of the setting if it's not default.
|
||||
*/
|
||||
@Deprecated("Use EventLogGroup#registerEvent and EventId#metric instead")
|
||||
fun <T> addIfDiffers(set: MutableSet<in MetricEvent>, settingsBean: T, defaultSettingsBean: T,
|
||||
valueFunction: Function1<T, Any>, eventId: String, data: FeatureUsageData?) {
|
||||
addMetricIfDiffers(set, settingsBean, defaultSettingsBean, valueFunction) {
|
||||
@@ -29,6 +31,7 @@ fun <T> addIfDiffers(set: MutableSet<in MetricEvent>, settingsBean: T, defaultSe
|
||||
/**
|
||||
* Reports the value of boolean setting (i.e. enabled or disabled) if it's not default.
|
||||
*/
|
||||
@Deprecated("Use EventLogGroup#registerEvent and EventId#metric instead")
|
||||
fun <T> addBoolIfDiffers(set: MutableSet<in MetricEvent>, settingsBean: T, defaultSettingsBean: T,
|
||||
valueFunction: Function1<T, Boolean>, eventId: String) {
|
||||
addBoolIfDiffers(set, settingsBean, defaultSettingsBean, valueFunction, eventId, null)
|
||||
@@ -37,6 +40,7 @@ fun <T> addBoolIfDiffers(set: MutableSet<in MetricEvent>, settingsBean: T, defau
|
||||
/**
|
||||
* Reports the value of boolean setting (i.e. enabled or disabled) if it's not default.
|
||||
*/
|
||||
@Deprecated("Use EventLogGroup#registerEvent and EventId#metric instead")
|
||||
fun <T> addBoolIfDiffers(set: MutableSet<in MetricEvent>, settingsBean: T, defaultSettingsBean: T,
|
||||
valueFunction: Function1<T, Boolean>, eventId: String, data: FeatureUsageData?) {
|
||||
addMetricIfDiffers(set, settingsBean, defaultSettingsBean, valueFunction) { newBooleanMetric(eventId, it, data) }
|
||||
@@ -45,6 +49,7 @@ fun <T> addBoolIfDiffers(set: MutableSet<in MetricEvent>, settingsBean: T, defau
|
||||
/**
|
||||
* Adds counter value if count is greater than 0
|
||||
*/
|
||||
@Deprecated("Use EventLogGroup#registerEvent and EventId#metric instead")
|
||||
fun <T> addCounterIfNotZero(set: MutableSet<in MetricEvent>, eventId: String, count: Int) {
|
||||
if (count > 0) {
|
||||
set.add(newCounterMetric(eventId, count))
|
||||
@@ -54,27 +59,32 @@ fun <T> addCounterIfNotZero(set: MutableSet<in MetricEvent>, eventId: String, co
|
||||
/**
|
||||
* Adds counter value if count is greater than 0
|
||||
*/
|
||||
@Deprecated("Use EventLogGroup#registerEvent and EventId#metric instead")
|
||||
fun <T> addCounterIfNotZero(set: MutableSet<in MetricEvent>, eventId: String, count: Int, data: FeatureUsageData?) {
|
||||
if (count > 0) {
|
||||
set.add(newCounterMetric(eventId, count, data))
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Use EventLogGroup#registerEvent and EventId#metric instead")
|
||||
fun <T> addCounterIfDiffers(set: MutableSet<in MetricEvent>, settingsBean: T, defaultSettingsBean: T,
|
||||
valueFunction: Function1<T, Int>, eventId: String) {
|
||||
addMetricIfDiffers(set, settingsBean, defaultSettingsBean, valueFunction) { newCounterMetric(eventId, it) }
|
||||
}
|
||||
|
||||
@Deprecated("Use EventLogGroup#registerEvent and EventId#metric instead")
|
||||
fun <T> addCounterIfDiffers(set: MutableSet<in MetricEvent>, settingsBean: T, defaultSettingsBean: T,
|
||||
valueFunction: Function1<T, Int>, eventId: String, data: FeatureUsageData?) {
|
||||
addMetricIfDiffers(set, settingsBean, defaultSettingsBean, valueFunction) { newCounterMetric(eventId, it, data) }
|
||||
}
|
||||
|
||||
@Deprecated("Use EventLogGroup#registerEvent and EventId#metric instead")
|
||||
fun <T, V : Enum<*>> addEnumIfDiffers(set: MutableSet<in MetricEvent>, settingsBean: T, defaultSettingsBean: T,
|
||||
valueFunction: Function1<T, V>, eventId: String) {
|
||||
addMetricIfDiffers(set, settingsBean, defaultSettingsBean, valueFunction) { newMetric(eventId, it, null) }
|
||||
}
|
||||
|
||||
@Deprecated("Use EventLogGroup#registerEvent and EventId#metric instead")
|
||||
fun <T, V> addMetricIfDiffers(set: MutableSet<in MetricEvent>, settingsBean: T, defaultSettingsBean: T,
|
||||
valueFunction: (T) -> V, eventIdFunc: (V) -> MetricEvent) {
|
||||
val value = valueFunction(settingsBean)
|
||||
@@ -89,6 +99,7 @@ interface MetricDifferenceBuilder<T> {
|
||||
fun addBool(eventId: String, valueFunction: (T) -> Boolean)
|
||||
}
|
||||
|
||||
@Deprecated("Use EventLogGroup#registerEvent and EventId#metric instead")
|
||||
fun <T> addMetricsIfDiffers(set: MutableSet<in MetricEvent>,
|
||||
settingsBean: T,
|
||||
defaultSettingsBean: T,
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.intellij.internal.statistic.service.fus.collectors;
|
||||
|
||||
import com.intellij.ide.plugins.cl.PluginAwareClassLoader;
|
||||
import com.intellij.internal.statistic.eventLog.EventLogGroup;
|
||||
import com.intellij.internal.statistic.eventLog.events.EventId;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -34,8 +35,12 @@ public abstract class FeatureUsagesCollector {
|
||||
return ep.extensions().filter(u -> u.isValid()).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Please use {@link FeatureUsagesCollector#getGroup()} instead.
|
||||
*/
|
||||
@NonNls
|
||||
@NotNull
|
||||
@Deprecated
|
||||
public String getGroupId() {
|
||||
EventLogGroup group = getGroup();
|
||||
if (group == null) {
|
||||
@@ -46,7 +51,9 @@ public abstract class FeatureUsagesCollector {
|
||||
|
||||
/**
|
||||
* Increment collector version if any changes in collector logic were implemented.
|
||||
* @deprecated Please use {@link FeatureUsagesCollector#getGroup()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getVersion() {
|
||||
EventLogGroup group = getGroup();
|
||||
if (group != null) {
|
||||
@@ -55,6 +62,11 @@ public abstract class FeatureUsagesCollector {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return EventLogGroup with all registered event IDs and fields in the group
|
||||
* @see EventLogGroup#registerEvent
|
||||
* @see EventId#metric
|
||||
*/
|
||||
public EventLogGroup getGroup() {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user