chore(telemetry): drop module scanning from telemetry.TelemetryScreen
import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@@ -137,7 +138,7 @@ private void addEnablingAllTelemetryListener() {
entry.setValue(telemetryEnabled);
}
- fetchTelemetryCategoriesFromEnvironment();
+ fetchTelemetryCategoriesFromEngineOnlyEnvironment();
for (Map.Entry<TelemetryCategory, Class> telemetryCategory : telemetryCategories.entrySet()) {
UICheckbox categoryBox = this.find(telemetryCategory.getKey().id(), UICheckbox.class);
if (categoryBox != null) {
@@ -161,7 +162,7 @@ private void addEnablingAllTelemetryListener() {
* If this checkbox is checked, all the sub telemetry fields will be enabled/disabled.
*/
private void addGroupEnablingListener() {
- fetchTelemetryCategoriesFromEnvironment();
+ fetchTelemetryCategoriesFromEngineOnlyEnvironment();
for (Map.Entry<TelemetryCategory, Class> telemetryCategory: telemetryCategories.entrySet()) {
if (!telemetryCategory.getKey().isOneMapMetric()) {
UICheckbox uiCheckbox = this.find(telemetryCategory.getKey().id(), UICheckbox.class);
@@ -187,7 +188,7 @@ private void refreshContent() {
ColumnLayout mainLayout = new ColumnLayout();
mainLayout.setHorizontalSpacing(8);
mainLayout.setVerticalSpacing(8);
- fetchTelemetryCategoriesFromEnvironment();
+ fetchTelemetryCategoriesFromEngineOnlyEnvironment();
for (Map.Entry<TelemetryCategory, Class> telemetryCategory: telemetryCategories.entrySet()) {
Class metricClass = telemetryCategory.getValue();
@@ -287,25 +288,15 @@ private void pushAddServerPopupAndStartLogBackAppender() {
/**
* refresh the telemetryCategories map.
*/
- private void fetchTelemetryCategoriesFromEnvironment() {
+ private void fetchTelemetryCategoriesFromEngineOnlyEnvironment() {
telemetryCategories = Maps.newHashMap();
-
- DependencyResolver resolver = new DependencyResolver(moduleManager.getRegistry());
- for (Name moduleId : moduleManager.getRegistry().getModuleIds()) {
- Module module = moduleManager.getRegistry().getLatestModuleVersion(moduleId);
- if (module.getResources() instanceof DirectoryFileSource) {
- ResolutionResult result = resolver.resolve(moduleId);
- if (result.isSuccess()) {
- try (ModuleEnvironment environment = moduleManager.loadEnvironment(result.getModules(), false)) {
- for (Class<?> holdingType : environment.getTypesAnnotatedWith(TelemetryCategory.class, new FromModule(environment, moduleId))) {
+ try (ModuleEnvironment environment = moduleManager.loadEnvironment(Collections.emptySet(), false)) {
+ for (Class<?> holdingType : environment.getTypesAnnotatedWith(TelemetryCategory.class)) {
TelemetryCategory telemetryCategory = holdingType.getAnnotation(TelemetryCategory.class);
telemetryCategories.put(telemetryCategory, holdingType);
}
}
}
- }
- }
- }
/**
* Add a new section with represents a new metrics type.
