forked from micrometer-metrics/micrometer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from auto1-oss/COR-4981-upgrade-to-1_13_4
COR-4981: upgrade to 1.13.4
- Loading branch information
Showing
59 changed files
with
1,017 additions
and
380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
.../jcstress/java/io/micrometer/concurrencytests/PrometheusMeterRegistryConcurrencyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
/* | ||
* Copyright 2024 VMware, Inc. | ||
* | ||
* 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 | ||
* | ||
* https://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.micrometer.concurrencytests; | ||
|
||
import io.micrometer.core.Issue; | ||
import io.micrometer.core.instrument.DistributionSummary; | ||
import io.micrometer.core.instrument.LongTaskTimer; | ||
import io.micrometer.core.instrument.LongTaskTimer.Sample; | ||
import io.micrometer.core.instrument.Timer; | ||
import io.micrometer.prometheusmetrics.PrometheusConfig; | ||
import io.micrometer.prometheusmetrics.PrometheusMeterRegistry; | ||
import org.openjdk.jcstress.annotations.Actor; | ||
import org.openjdk.jcstress.annotations.JCStressTest; | ||
import org.openjdk.jcstress.annotations.Outcome; | ||
import org.openjdk.jcstress.annotations.State; | ||
import org.openjdk.jcstress.infra.results.Z_Result; | ||
|
||
import java.time.Duration; | ||
|
||
import static org.openjdk.jcstress.annotations.Expect.ACCEPTABLE; | ||
import static org.openjdk.jcstress.annotations.Expect.FORBIDDEN; | ||
|
||
/** | ||
* Concurrency tests for histogram using {@link PrometheusMeterRegistry}. | ||
*/ | ||
public class PrometheusMeterRegistryConcurrencyTest { | ||
|
||
@Issue("#5193") | ||
@JCStressTest | ||
@State | ||
@Outcome(id = "true", expect = ACCEPTABLE, desc = "Successful scrape") | ||
@Outcome(expect = FORBIDDEN, desc = "Failed scrape") | ||
public static class ConsistentTimerHistogram { | ||
|
||
PrometheusMeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT); | ||
|
||
Timer timer = Timer.builder("test").publishPercentileHistogram().register(registry); | ||
|
||
@Actor | ||
public void record() { | ||
timer.record(Duration.ofMillis(100)); | ||
} | ||
|
||
@Actor | ||
public void scrape(Z_Result r) { | ||
try { | ||
registry.scrape(); | ||
r.r1 = true; | ||
} | ||
catch (Exception e) { | ||
r.r1 = false; | ||
} | ||
} | ||
|
||
} | ||
|
||
@Issue("#5193") | ||
@JCStressTest | ||
@State | ||
@Outcome(id = "true", expect = ACCEPTABLE, desc = "Successful scrape") | ||
@Outcome(expect = FORBIDDEN, desc = "Failed scrape") | ||
public static class ConsistentDistributionSummaryHistogram { | ||
|
||
PrometheusMeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT); | ||
|
||
DistributionSummary ds = DistributionSummary.builder("test").publishPercentileHistogram().register(registry); | ||
|
||
@Actor | ||
public void record() { | ||
ds.record(100); | ||
} | ||
|
||
@Actor | ||
public void scrape(Z_Result r) { | ||
try { | ||
registry.scrape(); | ||
r.r1 = true; | ||
} | ||
catch (Exception e) { | ||
r.r1 = false; | ||
} | ||
} | ||
|
||
} | ||
|
||
@Issue("#5193") | ||
@JCStressTest | ||
@State | ||
@Outcome(id = "true", expect = ACCEPTABLE, desc = "Successful scrape") | ||
@Outcome(expect = FORBIDDEN, desc = "Failed scrape") | ||
public static class ConsistentLongTaskTimerHistogram { | ||
|
||
PrometheusMeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT); | ||
|
||
LongTaskTimer ltt = LongTaskTimer.builder("test").publishPercentileHistogram().register(registry); | ||
|
||
@Actor | ||
public void record() { | ||
Sample sample = ltt.start(); | ||
sample.stop(); | ||
} | ||
|
||
@Actor | ||
public void scrape(Z_Result r) { | ||
try { | ||
registry.scrape(); | ||
r.r1 = true; | ||
} | ||
catch (Exception e) { | ||
r.r1 = false; | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
[[meters]] | ||
= Meters | ||
|
||
A `Meter` is the interface for collecting a set of measurements (which we individually call metrics) about your application. | ||
|
||
Micrometer supports a set of `Meter` primitives, including `Timer`, `Counter`, `Gauge`, `DistributionSummary`, `LongTaskTimer`, `FunctionCounter`, `FunctionTimer`, and `TimeGauge`. Different meter types result in a different number of time series metrics. For example, while there is a single metric that represents a `Gauge`, a `Timer` measures both the count of timed events and the total time of all timed events. | ||
|
||
TIP: Recording a measurement for a `Meter` is expected to be a relatively cheap operation and should not throw any exception. | ||
If the xref:./registry.adoc[registry] supports publishing metrics to a monitoring system, this is done in a separate thread and should not affect recording metrics. | ||
|
||
A meter is uniquely identified by its name and dimensions. We use the terms, "`dimensions`" and "`tags,`" interchangeably, and the Micrometer interface is `Tag` simply because it is shorter. As a general rule, it should be possible to use the name as a pivot. Dimensions let a particular named metric be sliced to drill down and reason about the data. This means that, if only the name is selected, you can drill down by using other dimensions and reason about the value being shown. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.