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

4.x Metrics followup #7547

Merged
merged 44 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
1a8a915
Enable MpFeatureTest
tjquinno Sep 6, 2023
cbb0855
Suppress scope tag from JSON output so JSON-based searches for meter …
tjquinno Sep 7, 2023
5de5b5f
Remove (not just comment) the disabled annotation from the test
tjquinno Sep 7, 2023
138ade8
Addressing some follow-up items
tjquinno Sep 7, 2023
3b78a1c
Add back pattern support for enabled/disabled meters by name in config
tjquinno Sep 8, 2023
1bf313b
Reenable temp'ly disabled webclient test
tjquinno Sep 8, 2023
85d6139
Fix KPI metrics registration to include proper scope; fix bug in Json…
tjquinno Sep 8, 2023
6d736db
Format functional counters as counters, not as structured. Add dep t…
tjquinno Sep 8, 2023
6831183
Re-enable TestMetricsOnOwnSocket; remove unused import in MpFeatureTest
tjquinno Sep 8, 2023
7014503
Reenable test in gh2297
tjquinno Sep 8, 2023
3744bb1
Restore multiport test code
tjquinno Sep 8, 2023
638a5ad
Fix OCI metrics integration and restore disabled test
tjquinno Sep 8, 2023
96f5544
Invoke onAdd listeners even when a no-op meter is created
tjquinno Sep 10, 2023
3d2993e
Add metrics impl for runtime of http status example
tjquinno Sep 10, 2023
9157fa6
Add helidon-metrics runtime dep to bring in the Micrometer implementa…
tjquinno Sep 10, 2023
ee1c2e7
Unused import; missing newline at end
tjquinno Sep 11, 2023
b186b08
Update example to pass Pattern instead of String to exclude expression
tjquinno Sep 11, 2023
732eadc
Use supplier-based gauge instead of ToDoubleFunction-based to preserv…
tjquinno Sep 11, 2023
d422d63
Add dep on metrics impl and base meters to MP quickstart
tjquinno Sep 11, 2023
b821845
Even in no-op impl we need to invoke onAdd listeners so MP Registry c…
tjquinno Sep 11, 2023
2caaa6c
Explicitly initialize Registry with correct MetricsConfig early
tjquinno Sep 11, 2023
1224067
Slight relaxation in string matching for Prometheus output (remove re…
tjquinno Sep 11, 2023
b9c7a6c
Better handle no-op meter case in processing and tests
tjquinno Sep 11, 2023
9293e9e
Add depc on metrics bundle to bring along the implementation
tjquinno Sep 11, 2023
c9f8921
Include the Micrometer implementation in the TCK runner
tjquinno Sep 12, 2023
93a9a5b
Enforce no use of reserved MP tag names
tjquinno Sep 12, 2023
355fe2a
Make sure base metrics are of the correct type - gauge or counter - a…
tjquinno Sep 12, 2023
9257670
Allow exceptions to escape invocations of listeners so tag validation…
tjquinno Sep 12, 2023
16fd5e8
Avoid setting units or description if they are not meaningful
tjquinno Sep 12, 2023
0123567
Check scope selection earlier in the Prometheus output formatting
tjquinno Sep 12, 2023
d071b91
Unused import
tjquinno Sep 12, 2023
53e5b28
Reinstate metrics TCKs
tjquinno Sep 12, 2023
508b12d
Fine-tune helidon-metrics dependencies
tjquinno Sep 12, 2023
e2e4731
Add test dep. on Micrometer metrics implementation for FT and messagi…
tjquinno Sep 12, 2023
4f66b79
Remove unused imports frmo test
tjquinno Sep 12, 2023
df5c67b
Need to include the system meters and the metrics implementation for …
tjquinno Sep 12, 2023
df7f0fd
SE quickstart pom dependencies on observe-metrics and system-meters; …
tjquinno Sep 12, 2023
d829707
MetersProvider should use the provided MetricsFactory to get meter bu…
tjquinno Sep 12, 2023
f22b2f6
Add metrics implementation as depc for the observe-metrics component
tjquinno Sep 12, 2023
3980dad
Copyright
tjquinno Sep 12, 2023
2e72093
Fix up dependencies for metrics, mostly to depend on the Micrometer i…
tjquinno Sep 12, 2023
aef478c
Set scope in DB client metrics to application explicitly
tjquinno Sep 12, 2023
017b9a5
One more test re-enabled
tjquinno Sep 13, 2023
2f3478d
Review comments
tjquinno Sep 13, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static MeterMetadata.Builder builder(Meter meter) {
return new MeterMetadata.Builder(meter);
}

private static final String SCOPE = "application";
private final String name;
private final String description;
private final String unit;
Expand Down Expand Up @@ -118,6 +119,7 @@ <B extends Meter.Builder<B, M>, M extends Meter> B apply(B builder) {
if (unit != null) {
builder.baseUnit(unit);
}
builder.scope(SCOPE);
return builder;
}

Expand Down
9 changes: 5 additions & 4 deletions examples/cors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency><dependency>
<groupId>io.helidon.config</groupId>
<artifactId>helidon-config-yaml</artifactId>
</dependency>
Expand All @@ -81,10 +86,6 @@
<groupId>io.helidon.health</groupId>
<artifactId>helidon-health-checks</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
Expand Down
8 changes: 7 additions & 1 deletion examples/dbclient/jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,15 @@
<artifactId>helidon-examples-dbclient-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>

Expand Down
12 changes: 11 additions & 1 deletion examples/dbclient/mongodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,17 @@
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<artifactId>helidon-metrics-api</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.tracing</groupId>
Expand Down
7 changes: 6 additions & 1 deletion examples/dbclient/pokemons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,14 @@
<groupId>io.helidon.config</groupId>
<artifactId>helidon-config-yaml</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
8 changes: 7 additions & 1 deletion examples/employee-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,15 @@
<groupId>io.helidon.health</groupId>
<artifactId>helidon-health-checks</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.dbclient</groupId>
Expand Down
8 changes: 6 additions & 2 deletions examples/integrations/microstream/greetings-se/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,15 @@
<artifactId>helidon-metrics-api</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency><dependency>
tjquinno marked this conversation as resolved.
Show resolved Hide resolved
<groupId>io.helidon.webserver.testing.junit5</groupId>
<artifactId>helidon-webserver-testing-junit5</artifactId>
<scope>test</scope>
Expand Down
6 changes: 1 addition & 5 deletions examples/metrics/exemplar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-api</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
10 changes: 10 additions & 0 deletions examples/metrics/filtering/mp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@
<groupId>io.helidon.microprofile.metrics</groupId>
<artifactId>helidon-microprofile-metrics</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.webclient</groupId>
<artifactId>helidon-webclient</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ config_ordinal=1000
server.port=8080
server.host=0.0.0.0

metrics.registries.0.scope = application
metrics.registries.0.filter.exclude = .*Gets
metrics.scoping.scopes.0.name=application
metrics.scoping.scopes.0.filter.exclude = .*Gets
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.eclipse.microprofile.metrics.Counter;
import org.eclipse.microprofile.metrics.MetricRegistry;
import org.eclipse.microprofile.metrics.Timer;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static org.hamcrest.MatcherAssert.assertThat;
Expand All @@ -44,8 +43,6 @@ void checkEnabledMetric() {
personalizedGreetingsCounter.getCount() - before, is(1L));
}

// TODO metrics
@Disabled
@Test
void checkDisabledMetric() {
Timer getsTimer = appRegistry.timer(GreetResource.TIMER_FOR_GETS);
Expand Down
8 changes: 0 additions & 8 deletions examples/metrics/filtering/se/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-api</artifactId>
</dependency>
<!--
The following provides a full-featured metrics implementation so the example works correctly.
-->
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.config</groupId>
<artifactId>helidon-config-yaml</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package io.helidon.examples.metrics.filtering.se;

import java.util.regex.Pattern;

import io.helidon.common.config.Config;
import io.helidon.common.config.GlobalConfig;
import io.helidon.logging.common.LogConfig;
Expand Down Expand Up @@ -73,7 +75,7 @@ static void setup(WebServerConfig.Builder server) {
// the metrics feature class will use.
ScopeConfig scopeConfig = ScopeConfig.builder()
.name(Meter.Scope.APPLICATION)
.exclude(GreetService.TIMER_FOR_GETS)
.exclude(Pattern.compile(GreetService.TIMER_FOR_GETS))
.build();

MetricsConfig initialMetricsConfig = config.get(MetricsConfig.METRICS_CONFIG_KEY)
Expand Down
10 changes: 5 additions & 5 deletions examples/metrics/http-status-count-se/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-api</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe</artifactId>
Expand All @@ -63,6 +58,11 @@
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-health</artifactId>
Expand Down
6 changes: 1 addition & 5 deletions examples/metrics/kpi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-api</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
10 changes: 10 additions & 0 deletions examples/microprofile/http-status-count-mp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@
<groupId>io.helidon.microprofile.health</groupId>
<artifactId>helidon-microprofile-health</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>jandex</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@
import jakarta.ws.rs.core.Response;
import org.eclipse.microprofile.metrics.Counter;
import org.eclipse.microprofile.metrics.MetricRegistry;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

// TODO metrics
@Disabled
@HelidonTest
@TestMethodOrder(MethodOrderer.MethodName.class)
public class MainTest {
Expand Down
10 changes: 10 additions & 0 deletions examples/microprofile/multiport/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@
<groupId>io.helidon.microprofile.health</groupId>
<artifactId>helidon-microprofile-health</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
4 changes: 3 additions & 1 deletion examples/openapi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.openapi</groupId>
Expand Down
10 changes: 10 additions & 0 deletions examples/quickstarts/helidon-quickstart-mp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@
<groupId>io.helidon.microprofile.bundles</groupId>
<artifactId>helidon-microprofile</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>jandex</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/quickstarts/helidon-quickstart-se/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<artifactId>helidon-metrics-system-meters</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.openapi</groupId>
Expand Down
4 changes: 4 additions & 0 deletions examples/quickstarts/helidon-standalone-quickstart-mp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
<groupId>io.helidon.microprofile.bundles</groupId>
<artifactId>helidon-microprofile</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>jandex</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.config</groupId>
Expand Down
7 changes: 6 additions & 1 deletion examples/todo-app/frontend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,14 @@
<groupId>io.helidon.security.providers</groupId>
<artifactId>helidon-security-providers-http-sign</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.webserver.observe</groupId>
<artifactId>helidon-webserver-observe-metrics</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<artifactId>helidon-metrics-system-meters</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions examples/webclient/standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<artifactId>helidon-metrics-api</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics</artifactId>
<groupId>io.helidon.metrics.providers</groupId>
<artifactId>helidon-metrics-providers-micrometer</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
Loading
Loading