Skip to content

Commit 6ebab1b

Browse files
authored
Merge branch 'main' into duplicate-names-registration-validation
2 parents 9bf69c8 + 586eaf5 commit 6ebab1b

File tree

3 files changed

+100
-69
lines changed

3 files changed

+100
-69
lines changed

.github/workflows/test-release-build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1717
with:
1818
persist-credentials: false
19+
fetch-tags: "true"
20+
fetch-depth: 0
1921
- uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
2022
with:
2123
version: v2026.2.0
@@ -27,8 +29,10 @@ jobs:
2729
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
2830
restore-keys: |
2931
${{ runner.os }}-maven-
30-
- name: Build Javadoc
31-
run: mise run javadoc
32+
- name: Build GitHub Pages
33+
run: mise run build-gh-pages
34+
env:
35+
BASE_URL: "/client_java"
3236
- name: Build release version
3337
run: mise run build-release
3438
env:
Lines changed: 50 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,58 @@
11
{{ $isPage := or (and (ne .Type "posts") (in "section page" .Kind )) (and (eq .Type "posts") (eq .Kind "page")) }}
22
{{- if eq .Kind "home" }}
3+
{{- $schema := dict "@context" "http://schema.org" "@type" "WebSite" "name" .Site.Title "url" .Site.BaseURL "inLanguage" .Lang }}
4+
{{- with partial "utils/description" . }}
5+
{{- $schema = merge $schema (dict "description" (. | plainify | htmlUnescape | chomp)) }}
6+
{{- end }}
7+
{{- with partial "utils/featured" . }}
8+
{{- $schema = merge $schema (dict "thumbnailUrl" .) }}
9+
{{- end }}
10+
{{- with .Site.Params.geekdocContentLicense }}
11+
{{- $schema = merge $schema (dict "license" .name) }}
12+
{{- end }}
313
<script type="application/ld+json">
4-
{
5-
"@context": "http://schema.org",
6-
"@type": "WebSite",
7-
"name": {{ .Site.Title }},
8-
"url": {{ .Site.BaseURL }},
9-
{{- with partial "utils/description" . }}
10-
"description": "{{ . | plainify | htmlUnescape | chomp }}",
11-
{{- end }}
12-
{{- with partial "utils/featured" . }}
13-
"thumbnailUrl": {{ . }},
14-
{{- end }}
15-
{{- with .Site.Params.geekdocContentLicense }}
16-
"license": "{{ .name }}",
17-
{{- end }}
18-
"inLanguage": {{ .Lang }}
19-
}
14+
{{- $schema | jsonify | safeJS }}
2015
</script>
2116
{{- else if $isPage }}
17+
{{- $title := partial "utils/title" . }}
18+
{{- $schema := dict
19+
"@context" "http://schema.org"
20+
"@type" "TechArticle"
21+
"articleSection" (.Section | humanize | title)
22+
"name" $title
23+
"url" .Permalink
24+
"headline" $title
25+
"wordCount" (string .WordCount)
26+
"inLanguage" .Lang
27+
"isFamilyFriendly" "true"
28+
"copyrightHolder" .Site.Title
29+
"copyrightYear" (.Date.Format "2006")
30+
"dateCreated" (.Date.Format "2006-01-02T15:04:05.00Z")
31+
"datePublished" (.PublishDate.Format "2006-01-02T15:04:05.00Z")
32+
"dateModified" (.Lastmod.Format "2006-01-02T15:04:05.00Z")
33+
}}
34+
{{- with .Params.lead }}
35+
{{- $schema = merge $schema (dict "alternativeHeadline" .) }}
36+
{{- end }}
37+
{{- with partial "utils/description" . }}
38+
{{- $schema = merge $schema (dict "description" (. | plainify | htmlUnescape | chomp)) }}
39+
{{- end }}
40+
{{- with partial "utils/featured" . }}
41+
{{- $schema = merge $schema (dict "thumbnailUrl" .) }}
42+
{{- end }}
43+
{{- with .Site.Params.geekdocContentLicense }}
44+
{{- $schema = merge $schema (dict "license" .name) }}
45+
{{- end }}
46+
{{- $mainEntity := dict "@type" "WebPage" "@id" .Permalink }}
47+
{{- $schema = merge $schema (dict "mainEntityOfPage" $mainEntity) }}
48+
{{- with $tags := .Params.tags }}
49+
{{- $schema = merge $schema (dict "keywords" $tags) }}
50+
{{- end }}
51+
{{- $logoUrl := default "brand.svg" .Site.Params.logo | absURL }}
52+
{{- $logo := dict "@type" "ImageObject" "url" $logoUrl "width" "32" "height" "32" }}
53+
{{- $publisher := dict "@type" "Organization" "name" .Site.Title "url" .Site.BaseURL "logo" $logo }}
54+
{{- $schema = merge $schema (dict "publisher" $publisher) }}
2255
<script type="application/ld+json">
23-
{
24-
"@context": "http://schema.org",
25-
"@type": "TechArticle",
26-
"articleSection": "{{ .Section | humanize | title }}",
27-
"name": {{ partial "utils/title" . }},
28-
"url" : {{ .Permalink }},
29-
"headline": {{ partial "utils/title" . }},
30-
{{- with .Params.lead }}
31-
"alternativeHeadline": {{ . }},
32-
{{- end }}
33-
{{- with partial "utils/description" . }}
34-
"description": "{{ . | plainify | htmlUnescape | chomp }}",
35-
{{- end }}
36-
{{- with partial "utils/featured" . }}
37-
"thumbnailUrl": {{ . }},
38-
{{- end }}
39-
"wordCount" : "{{ .WordCount }}",
40-
{{- with .Site.Params.geekdocContentLicense }}
41-
"license": "{{ .name }}",
42-
{{- end }}
43-
"inLanguage": {{ .Lang }},
44-
"isFamilyFriendly": "true",
45-
"mainEntityOfPage": {
46-
"@type": "WebPage",
47-
"@id": {{ .Permalink }}
48-
},
49-
{{- with $tags := .Params.tags }}
50-
"keywords" : [ {{ range $i, $tag := $tags }}{{ if $i }}, {{ end }}"{{ $tag }}" {{ end }}],
51-
{{- end }}
52-
"copyrightHolder" : "{{ .Site.Title }}",
53-
"copyrightYear" : "{{ .Date.Format "2006" }}",
54-
"dateCreated": "{{ .Date.Format "2006-01-02T15:04:05.00Z" | safeJS }}",
55-
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05.00Z" | safeJS }}",
56-
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05.00Z" | safeJS }}",
57-
"publisher":{
58-
"@type":"Organization",
59-
"name": {{ .Site.Title }},
60-
"url": {{ .Site.BaseURL }},
61-
"logo": {
62-
"@type": "ImageObject",
63-
"url": {{ (default "brand.svg" .Site.Params.logo) | absURL }},
64-
"width":"32",
65-
"height":"32"
66-
}
67-
}
68-
}
56+
{{- $schema | jsonify | safeJS }}
6957
</script>
7058
{{- end }}

prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics/HistogramTest.java

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package io.prometheus.metrics.core.metrics;
22

33
import static io.prometheus.metrics.core.metrics.TestUtil.assertExemplarEquals;
4+
import static java.util.concurrent.TimeUnit.SECONDS;
45
import static org.assertj.core.api.Assertions.assertThat;
56
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
67
import static org.assertj.core.data.Offset.offset;
8+
import static org.awaitility.Awaitility.await;
79

810
import io.prometheus.metrics.config.EscapingScheme;
911
import io.prometheus.metrics.config.MetricsProperties;
@@ -1020,10 +1022,18 @@ public void markCurrentSpanAsExemplar() {}
10201022
assertThat(getExemplar(snapshot, Double.POSITIVE_INFINITY, "path", "/hello")).isNull();
10211023
assertThat(getExemplar(snapshot, Double.POSITIVE_INFINITY, "path", "/world")).isNull();
10221024

1023-
Thread.sleep(sampleIntervalMillis + 1);
1025+
waitForSampleInterval(sampleIntervalMillis);
10241026
histogram.labelValues("/hello").observe(4.5);
10251027
histogram.labelValues("/world").observe(4.5);
10261028

1029+
await()
1030+
.atMost(2, SECONDS)
1031+
.until(
1032+
() -> {
1033+
HistogramSnapshot s = histogram.collect();
1034+
return getExemplar(s, Double.POSITIVE_INFINITY, "path", "/hello") != null
1035+
&& getExemplar(s, Double.POSITIVE_INFINITY, "path", "/world") != null;
1036+
});
10271037
snapshot = histogram.collect();
10281038
assertExemplarEquals(ex1a, getExemplar(snapshot, 1.0, "path", "/hello"));
10291039
assertExemplarEquals(ex1b, getExemplar(snapshot, 1.0, "path", "/world"));
@@ -1036,16 +1046,28 @@ public void markCurrentSpanAsExemplar() {}
10361046
assertExemplarEquals(ex2a, getExemplar(snapshot, Double.POSITIVE_INFINITY, "path", "/hello"));
10371047
assertExemplarEquals(ex2b, getExemplar(snapshot, Double.POSITIVE_INFINITY, "path", "/world"));
10381048

1039-
Thread.sleep(sampleIntervalMillis + 1);
1049+
waitForSampleInterval(sampleIntervalMillis);
10401050
histogram.labelValues("/hello").observe(1.5);
10411051
histogram.labelValues("/world").observe(1.5);
1042-
Thread.sleep(sampleIntervalMillis + 1);
1052+
waitForSampleInterval(sampleIntervalMillis);
10431053
histogram.labelValues("/hello").observe(2.5);
10441054
histogram.labelValues("/world").observe(2.5);
1045-
Thread.sleep(sampleIntervalMillis + 1);
1055+
waitForSampleInterval(sampleIntervalMillis);
10461056
histogram.labelValues("/hello").observe(3.5);
10471057
histogram.labelValues("/world").observe(3.5);
10481058

1059+
await()
1060+
.atMost(2, SECONDS)
1061+
.until(
1062+
() -> {
1063+
HistogramSnapshot s = histogram.collect();
1064+
return getExemplar(s, 2.0, "path", "/hello") != null
1065+
&& getExemplar(s, 2.0, "path", "/world") != null
1066+
&& getExemplar(s, 3.0, "path", "/hello") != null
1067+
&& getExemplar(s, 3.0, "path", "/world") != null
1068+
&& getExemplar(s, 4.0, "path", "/hello") != null
1069+
&& getExemplar(s, 4.0, "path", "/world") != null;
1070+
});
10491071
snapshot = histogram.collect();
10501072
assertExemplarEquals(ex1a, getExemplar(snapshot, 1.0, "path", "/hello"));
10511073
assertExemplarEquals(ex1b, getExemplar(snapshot, 1.0, "path", "/world"));
@@ -1072,15 +1094,32 @@ public void markCurrentSpanAsExemplar() {}
10721094
"span_id",
10731095
"spanId-11"))
10741096
.build();
1075-
Thread.sleep(sampleIntervalMillis + 1);
1097+
waitForSampleInterval(sampleIntervalMillis);
10761098
histogram
10771099
.labelValues("/hello")
10781100
.observeWithExemplar(3.4, Labels.of("key1", "value1", "key2", "value2"));
1101+
await()
1102+
.atMost(2, SECONDS)
1103+
.until(
1104+
() -> {
1105+
Exemplar actual = getExemplar(histogram.collect(), 4.0, "path", "/hello");
1106+
return actual != null && Math.abs(actual.getValue() - 3.4) < 0.00001;
1107+
});
10791108
snapshot = histogram.collect();
10801109
// custom exemplars have preference, so the automatic exemplar is replaced
10811110
assertExemplarEquals(custom, getExemplar(snapshot, 4.0, "path", "/hello"));
10821111
}
10831112

1113+
/** Waits for the exemplar sampler's rate limit window so the next observation is accepted. */
1114+
private static void waitForSampleInterval(long sampleIntervalMillis) {
1115+
try {
1116+
Thread.sleep(2 * sampleIntervalMillis);
1117+
} catch (InterruptedException e) {
1118+
Thread.currentThread().interrupt();
1119+
throw new AssertionError("Interrupted while waiting for sample interval", e);
1120+
}
1121+
}
1122+
10841123
private Exemplar getExemplar(HistogramSnapshot snapshot, double le, String... labels) {
10851124
HistogramSnapshot.HistogramDataPointSnapshot data =
10861125
snapshot.getDataPoints().stream()

0 commit comments

Comments
 (0)