Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrage GraalVM #2510

Merged
merged 3 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<version.lib.failsafe>2.3.1</version.lib.failsafe>
<version.lib.google-api-client>1.30.11</version.lib.google-api-client>
<version.lib.google-error-prone>2.3.3</version.lib.google-error-prone>
<version.lib.graalvm>20.1.0</version.lib.graalvm>
<version.lib.graalvm>20.2.0</version.lib.graalvm>
<version.lib.grpc>1.32.1</version.lib.grpc>
<version.lib.guava>28.1-jre</version.lib.guava>
<version.lib.h2>1.4.199</version.lib.h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import io.helidon.config.Config;
import io.helidon.config.ConfigValue;
import io.helidon.metrics.MetricsSupport;
import io.helidon.microprofile.cdi.RuntimeStart;
import io.helidon.microprofile.server.ServerCdiExtension;
import io.helidon.webserver.Routing;

Expand Down Expand Up @@ -136,7 +137,8 @@ public class MetricsCdiExtension implements Extension {

private final Set<Class<?>> metricsAnnotatedClasses = new HashSet<>();
private final Set<Class<?>> metricsAnnotatedClassesProcessed = new HashSet<>();
private final Map<Class<?>, Set<Method>> methodsWithSyntheticSimplyTimer = new HashMap<>();
private final Map<Class<?>, Set<Method>> methodsWithSyntheticSimpleTimer = new HashMap<>();
private final Set<Method> syntheticSimpleTimersToRegister = new HashSet<>();

@SuppressWarnings("unchecked")
private static <T> T getReference(BeanManager bm, Type type, Bean<?> bean) {
Expand Down Expand Up @@ -321,7 +323,7 @@ private void clearAnnotationInfo(@Observes AfterDeploymentValidation adv) {
}
metricsAnnotatedClasses.clear();
metricsAnnotatedClassesProcessed.clear();
methodsWithSyntheticSimplyTimer.clear();
methodsWithSyntheticSimpleTimer.clear();
}

/**
Expand Down Expand Up @@ -493,7 +495,7 @@ private void recordSimplyTimedForRestResources(@Observes
}
}));
if (!methodsToRecord.isEmpty()) {
methodsWithSyntheticSimplyTimer.put(clazz, methodsToRecord);
methodsWithSyntheticSimpleTimer.put(clazz, methodsToRecord);
}
}

Expand Down Expand Up @@ -634,16 +636,21 @@ private <T extends org.eclipse.microprofile.metrics.Metric> void registerProduce
producers.clear();
}

private void registerSyntheticSimpleTimerMetric(@Observes ProcessManagedBean<?> pmb) {
private void collectSyntheticSimpleTimerMetric(@Observes ProcessManagedBean<?> pmb) {
AnnotatedType<?> type = pmb.getAnnotatedBeanClass();
Class<?> clazz = type.getJavaClass();
if (!methodsWithSyntheticSimplyTimer.containsKey(clazz)) {
if (!methodsWithSyntheticSimpleTimer.containsKey(clazz)) {
return;
}

LOGGER.log(Level.FINE, () -> "Processing synthetic SimplyTimed annotations for " + clazz.getName());

methodsWithSyntheticSimplyTimer.get(clazz).forEach(MetricsCdiExtension::syntheticSimpleTimer);
syntheticSimpleTimersToRegister.addAll(methodsWithSyntheticSimpleTimer.get(clazz));
}

private void registerSyntheticSimpleTimerMetrics(@Observes @RuntimeStart Object event) {
syntheticSimpleTimersToRegister.forEach(MetricsCdiExtension::syntheticSimpleTimer);
syntheticSimpleTimersToRegister.clear();
}

static boolean restEndpointsMetricEnabledFromConfig() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;

import io.helidon.common.LazyValue;
import io.helidon.metrics.RegistryFactory;

import org.eclipse.microprofile.metrics.MetricRegistry;
import org.eclipse.microprofile.metrics.MetricRegistry.Type;
import org.eclipse.microprofile.metrics.annotation.RegistryType;
Expand All @@ -29,8 +32,7 @@
@ApplicationScoped
final class RegistryProducer {

private static final io.helidon.metrics.RegistryFactory REGISTRY_FACTORY =
io.helidon.metrics.RegistryFactory.getInstance();
private static final LazyValue<RegistryFactory> REGISTRY_FACTORY = LazyValue.create(RegistryFactory::getInstance);

private RegistryProducer() {
}
Expand All @@ -43,19 +45,19 @@ public static org.eclipse.microprofile.metrics.MetricRegistry getDefaultRegistry
@Produces
@RegistryType(type = Type.APPLICATION)
public static org.eclipse.microprofile.metrics.MetricRegistry getApplicationRegistry() {
return REGISTRY_FACTORY.getRegistry(Type.APPLICATION);
return REGISTRY_FACTORY.get().getRegistry(Type.APPLICATION);
}

@Produces
@RegistryType(type = Type.BASE)
public static org.eclipse.microprofile.metrics.MetricRegistry getBaseRegistry() {
return REGISTRY_FACTORY.getRegistry(Type.BASE);
return REGISTRY_FACTORY.get().getRegistry(Type.BASE);
}

@Produces
@RegistryType(type = Type.VENDOR)
public static org.eclipse.microprofile.metrics.MetricRegistry getVendorRegistry() {
return REGISTRY_FACTORY.getRegistry(Type.VENDOR);
return REGISTRY_FACTORY.get().getRegistry(Type.VENDOR);
}

/**
Expand Down