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: Revise MetricsFeature with new metrics implementation; reorg formatting of output #2

Open
wants to merge 40 commits into
base: neutral-metrics-api
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
19d3b61
Initial commit of neutral metrics API with high-level interfaces; mor…
tjquinno Jul 27, 2023
6eaa316
Some clean-up of earlier push; add more API interfaces and no-op impl…
tjquinno Jul 28, 2023
4bb5e95
Incorporate some review comments: move micrometer impl under provider…
tjquinno Jul 31, 2023
b804896
Other review comment; change recordCallable to record
tjquinno Jul 31, 2023
8b240b1
More review comment changes; fix up temporary dep. in service-api on …
tjquinno Aug 1, 2023
90d93ec
Temporary for successful build while adding the neutral metrics API
tjquinno Aug 1, 2023
03f9a41
Two intermixed changes: trimming the API exposed by Metrics and Meter…
tjquinno Aug 3, 2023
6ccb69d
Some clean-up of checkstyle, spotbugs.
tjquinno Aug 3, 2023
a0398f6
Adapt to change in Prototype.Blueprint
tjquinno Aug 3, 2023
3f10796
Add more tests of the neutral API; add some convenience methods
tjquinno Aug 3, 2023
f43c1c8
Neutral API tests
tjquinno Aug 3, 2023
3076253
WIP adding Micrometer implementation; pushing for safekeeping even th…
tjquinno Aug 5, 2023
6ed24a2
Fix API for remove to return Optional; more Micrometer implementation…
tjquinno Aug 7, 2023
2aa467d
Further work on Micrometer impl; some changes to API as well
tjquinno Aug 8, 2023
af124b1
Various clean-up, remove some TODOs
tjquinno Aug 8, 2023
c79d165
Some tests for the Micrometer implementation; working on exposing con…
tjquinno Aug 10, 2023
52df7b5
Try workaround for providing visibility to config
tjquinno Aug 10, 2023
dada8d2
Resolve merge conflict re: Fix from Tomas for builder
tjquinno Aug 11, 2023
2c6f202
Adding more tests in the Micrometer implementation based on the old u…
tjquinno Aug 11, 2023
e516cd7
Add straggler new file
tjquinno Aug 11, 2023
e1eb005
Add a missing requires clause
tjquinno Aug 11, 2023
a9bbe28
More tests and associated code changes
tjquinno Aug 11, 2023
5ea43b8
More tests; push for safe keeping
tjquinno Aug 13, 2023
5a9cc92
Add common unit tests for implementations
tjquinno Aug 13, 2023
05c4fec
Remove commented unneeded lines; clarify comments
tjquinno Aug 13, 2023
5fa681b
Expand tests; corresponding changes to interfaces and implementations
tjquinno Aug 14, 2023
10e1321
Further gauge tests
tjquinno Aug 14, 2023
9cf45ec
Rebase: Adopt Tomas's changes for two builder classes rather than the…
tjquinno Aug 14, 2023
9e47f1b
Adapt to recent changes in support for config method in builder/gener…
tjquinno Aug 14, 2023
310aeeb
Some simplification of the API; use longs not doubles for counts, etc.
tjquinno Aug 14, 2023
40a9b5b
Add tests; fix some timer/sample problems
tjquinno Aug 15, 2023
2bf97c7
Some clean-up
tjquinno Aug 15, 2023
e8643c0
Clean up bom
tjquinno Aug 15, 2023
1d12c74
Fix line length
tjquinno Aug 15, 2023
1480ce1
Rename Wrapped to Wrapper
tjquinno Aug 15, 2023
4ea2a6b
Review comments; some other clean-up
tjquinno Aug 15, 2023
d5ee44a
adopt latest Micrometer release 1.11.3
tjquinno Aug 15, 2023
4beba70
Update release of Micrometer Prometheus registry as well
tjquinno Aug 15, 2023
f5aa39c
Remove unneeded (and moved) test-time dep.
tjquinno Aug 16, 2023
60029a4
Revise metrics feature with new metrics implementation; add JSON form…
tjquinno Aug 16, 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
10 changes: 10 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,16 @@
<artifactId>helidon-metrics-api</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-testing</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-micrometer</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.metrics</groupId>
<artifactId>helidon-metrics-service-api</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
<version.lib.logback>1.4.0</version.lib.logback>
<version.lib.mariadb-java-client>2.6.2</version.lib.mariadb-java-client>
<version.lib.maven-wagon>2.10</version.lib.maven-wagon>
<version.lib.micrometer>1.11.1</version.lib.micrometer>
<version.lib.micrometer-prometheus>1.11.1</version.lib.micrometer-prometheus>
<version.lib.micrometer>1.11.3</version.lib.micrometer>
<version.lib.micrometer-prometheus>1.11.3</version.lib.micrometer-prometheus>
<version.lib.micronaut>3.4.3</version.lib.micronaut>
<version.lib.micronaut.data>3.3.0</version.lib.micronaut.data>
<version.lib.micronaut.sql>4.4.0</version.lib.micronaut.sql>
Expand Down
34 changes: 30 additions & 4 deletions metrics/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@
<groupId>io.helidon.common</groupId>
<artifactId>helidon-common-config</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.builder</groupId>
<artifactId>helidon-builder-api</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.inject.configdriven</groupId>
<artifactId>helidon-inject-configdriven-api</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.helidon.inject.configdriven</groupId>
<artifactId>helidon-inject-configdriven-runtime</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.helidon.config</groupId>
<artifactId>helidon-config-metadata</artifactId>
Expand All @@ -50,13 +64,10 @@
<groupId>org.eclipse.microprofile.metrics</groupId>
<artifactId>microprofile-metrics-api</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.common.testing</groupId>
<artifactId>helidon-common-testing-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down Expand Up @@ -88,11 +99,26 @@
<configuration>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<annotationProcessorPaths>
<path>
<groupId>io.helidon.common.features</groupId>
<artifactId>helidon-common-features-processor</artifactId>
<version>${helidon.version}</version>
</path>
<path>
<groupId>io.helidon.config</groupId>
<artifactId>helidon-config-metadata-processor</artifactId>
<version>${helidon.version}</version>
</path>
<path>
<groupId>io.helidon.inject.configdriven</groupId>
<artifactId>helidon-inject-configdriven-processor</artifactId>
<version>${helidon.version}</version>
</path>
<path>
<groupId>io.helidon.builder</groupId>
<artifactId>helidon-builder-processor</artifactId>
<version>${helidon.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
Expand Down
51 changes: 51 additions & 0 deletions metrics/api/src/main/java/io/helidon/metrics/api/Bucket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.helidon.metrics.api;

import java.util.concurrent.TimeUnit;

/**
* Representation of a histogram bucket, including the boundary value and the count of observations in that bucket.
* <p>
* The boundary value is an upper bound on the observation values that can occupy the bucket.
* That is, an observation occupies a bucket if its value is less than or equal to the bucket's boundary value.
* </p>
*/
public interface Bucket extends Wrapper {

/**
* Returns the bucket boundary.
*
* @return bucket boundary value
*/
double boundary();

/**
* Returns the bucket boundary interpreted as a time in nanoseconds and expressed in the specified
* {@link java.util.concurrent.TimeUnit}.
*
* @param unit time unit in which to express the bucket boundary
* @return bucket boundary value
*/
double boundary(TimeUnit unit);

/**
* Returns the number of observations in the bucket.
*
* @return observation count for the bucket
*/
long count();
}
72 changes: 72 additions & 0 deletions metrics/api/src/main/java/io/helidon/metrics/api/Clock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.helidon.metrics.api;

/**
* Reports absolute time (and, therefore, is also useful in computing elapsed times).
*/
public interface Clock extends Wrapper {

/**
* Returns the system clock for the Helidon metrics implementation.
* <p>
* The system clock methods are functionally equivalent to {@link System#currentTimeMillis()}
* and {@link System#nanoTime()}.
* </p>
*
* @return the system clock
*/
static Clock system() {
return MetricsFactoryManager.getInstance().clockSystem();
}

/**
* Returns the current wall time in milliseconds since the epoch.
*
* <p>
* Typically equivalent to {@link System#currentTimeMillis()}. Should not be used to determine durations.
* For that use {@link #monotonicTime()} instead.
* </p>
*
* @return wall time in milliseconds
*/
long wallTime();

/**
* Returns the current time in nanoseconds from a monotonic clock source.
*
* <p>
* The value is only meaningful when compared with another value returned from this method to determine the elapsed time
* for an operation. The difference between two samples will have a unit of nanoseconds. The returned value is
* typically equivalent to {@link System#nanoTime()}.
* </p>
*
* @return monotonic time in nanoseconds
*/
long monotonicTime();

/**
* Unwraps the clock to the specified type (typically not needed for custom clocks).
*
* @param c {@link Class} to which to cast this object
* @return unwrapped clock
* @param <R> the type of the unwrapped clock
*/
@Override
default <R> R unwrap(Class<? extends R> c) {
throw new UnsupportedOperationException();
}
}
58 changes: 58 additions & 0 deletions metrics/api/src/main/java/io/helidon/metrics/api/Counter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.helidon.metrics.api;

/**
* Records a monotonically increasing value.
*/
public interface Counter extends Meter {

/**
* Creates a new builder for a counter.
*
* @param name counter name
* @return new builder
*/
static Builder builder(String name) {
return MetricsFactory.getInstance().counterBuilder(name);
}


/**
* Updates the counter by one.
*/
void increment();

/**
* Updates the counter by the specified amount which should be non-negative.
*
* @param amount amount to add to the counter.
*/
void increment(long amount);

/**
* Returns the cumulative count since this counter was registered.
*
* @return cumulative count since this counter was registered
*/
long count();

/**
* Builder for a new counter.
*/
interface Builder extends Meter.Builder<Builder, Counter> {
}
}
Loading