Merge branch 'stable-2.16' into stable-3.0
* stable-2.16: Move documentation for Jetty metrics to a separate section Improve Jetty thread pool metrics Fix commentlinks with same prefix in pattern and link NoteDbMigrator: Totally skip migration for orphan changes Change-Id: Iff7f3ee762d3ca725144ad516f4b06ccb5759a07
This commit is contained in:
@@ -58,6 +58,18 @@ objects needing finalization.
|
|||||||
|
|
||||||
=== HTTP
|
=== HTTP
|
||||||
|
|
||||||
|
==== Jetty
|
||||||
|
|
||||||
|
* `http/server/jetty/threadpool/active_threads`: Active threads
|
||||||
|
* `http/server/jetty/threadpool/idle_threads`: Idle threads
|
||||||
|
* `http/server/jetty/threadpool/reserved_threads`: Reserved threads
|
||||||
|
* `http/server/jetty/threadpool/max_pool_size`: Maximum thread pool size
|
||||||
|
* `http/server/jetty/threadpool/min_pool_size`: Minimum thread pool size
|
||||||
|
* `http/server/jetty/threadpool/pool_size`: Current thread pool size
|
||||||
|
* `http/server/jetty/threadpool/queue_size`: Queued requests waiting for a thread
|
||||||
|
|
||||||
|
==== REST API
|
||||||
|
|
||||||
* `http/server/error_count`: Rate of REST API error responses.
|
* `http/server/error_count`: Rate of REST API error responses.
|
||||||
* `http/server/success_count`: Rate of REST API success responses.
|
* `http/server/success_count`: Rate of REST API success responses.
|
||||||
* `http/server/rest_api/count`: Rate of REST API calls by view.
|
* `http/server/rest_api/count`: Rate of REST API calls by view.
|
||||||
|
|||||||
@@ -28,42 +28,42 @@ public class JettyMetrics {
|
|||||||
JettyMetrics(JettyServer jetty, MetricMaker metrics) {
|
JettyMetrics(JettyServer jetty, MetricMaker metrics) {
|
||||||
CallbackMetric0<Integer> minPoolSize =
|
CallbackMetric0<Integer> minPoolSize =
|
||||||
metrics.newCallbackMetric(
|
metrics.newCallbackMetric(
|
||||||
"httpd/jetty/threadpool/min_pool_size",
|
"http/server/jetty/threadpool/min_pool_size",
|
||||||
Integer.class,
|
Integer.class,
|
||||||
new Description("Minimum thread pool size").setGauge());
|
new Description("Minimum thread pool size").setGauge());
|
||||||
CallbackMetric0<Integer> maxPoolSize =
|
CallbackMetric0<Integer> maxPoolSize =
|
||||||
metrics.newCallbackMetric(
|
metrics.newCallbackMetric(
|
||||||
"httpd/jetty/threadpool/max_pool_size",
|
"http/server/jetty/threadpool/max_pool_size",
|
||||||
Integer.class,
|
Integer.class,
|
||||||
new Description("Maximum thread pool size").setGauge());
|
new Description("Maximum thread pool size").setGauge());
|
||||||
CallbackMetric0<Integer> poolSize =
|
CallbackMetric0<Integer> poolSize =
|
||||||
metrics.newCallbackMetric(
|
metrics.newCallbackMetric(
|
||||||
"httpd/jetty/threadpool/pool_size",
|
"http/server/jetty/threadpool/pool_size",
|
||||||
Integer.class,
|
Integer.class,
|
||||||
new Description("Current thread pool size").setGauge());
|
new Description("Current thread pool size").setGauge());
|
||||||
CallbackMetric0<Integer> idleThreads =
|
CallbackMetric0<Integer> idleThreads =
|
||||||
metrics.newCallbackMetric(
|
metrics.newCallbackMetric(
|
||||||
"httpd/jetty/threadpool/idle_threads",
|
"http/server/jetty/threadpool/idle_threads",
|
||||||
Integer.class,
|
Integer.class,
|
||||||
new Description("Idle httpd threads").setGauge().setUnit("threads"));
|
new Description("Idle threads").setGauge().setUnit("threads"));
|
||||||
CallbackMetric0<Integer> busyThreads =
|
CallbackMetric0<Integer> busyThreads =
|
||||||
metrics.newCallbackMetric(
|
metrics.newCallbackMetric(
|
||||||
"httpd/jetty/threadpool/active_threads",
|
"http/server/jetty/threadpool/active_threads",
|
||||||
Integer.class,
|
Integer.class,
|
||||||
new Description("Active httpd threads").setGauge().setUnit("threads"));
|
new Description("Active threads").setGauge().setUnit("threads"));
|
||||||
CallbackMetric0<Integer> reservedThreads =
|
CallbackMetric0<Integer> reservedThreads =
|
||||||
metrics.newCallbackMetric(
|
metrics.newCallbackMetric(
|
||||||
"httpd/jetty/threadpool/reserved_threads",
|
"http/server/jetty/threadpool/reserved_threads",
|
||||||
Integer.class,
|
Integer.class,
|
||||||
new Description("Reserved httpd threads").setGauge().setUnit("threads"));
|
new Description("Reserved threads").setGauge().setUnit("threads"));
|
||||||
CallbackMetric0<Integer> queueSize =
|
CallbackMetric0<Integer> queueSize =
|
||||||
metrics.newCallbackMetric(
|
metrics.newCallbackMetric(
|
||||||
"httpd/jetty/threadpool/queue_size",
|
"http/server/jetty/threadpool/queue_size",
|
||||||
Integer.class,
|
Integer.class,
|
||||||
new Description("Thread pool queue size").setGauge().setUnit("requests"));
|
new Description("Queued requests waiting for a thread").setGauge().setUnit("requests"));
|
||||||
CallbackMetric0<Boolean> lowOnThreads =
|
CallbackMetric0<Boolean> lowOnThreads =
|
||||||
metrics.newCallbackMetric(
|
metrics.newCallbackMetric(
|
||||||
"httpd/jetty/threadpool/is_low_on_threads",
|
"http/server/jetty/threadpool/is_low_on_threads",
|
||||||
Boolean.class,
|
Boolean.class,
|
||||||
new Description("Whether thread pool is low on threads").setGauge());
|
new Description("Whether thread pool is low on threads").setGauge());
|
||||||
JettyServer.Metrics jettyMetrics = jetty.getMetrics();
|
JettyServer.Metrics jettyMetrics = jetty.getMetrics();
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ limitations under the License.
|
|||||||
match: '([Bb]ug|[Ii]ssue)\\s*#?(\\d+)',
|
match: '([Bb]ug|[Ii]ssue)\\s*#?(\\d+)',
|
||||||
link: 'https://bugs.chromium.org/p/gerrit/issues/detail?id=$2',
|
link: 'https://bugs.chromium.org/p/gerrit/issues/detail?id=$2',
|
||||||
},
|
},
|
||||||
|
prefixsameinlinkandpattern: {
|
||||||
|
match: '([Hh][Tt][Tt][Pp]example)\\s*#?(\\d+)',
|
||||||
|
link: 'https://bugs.chromium.org/p/gerrit/issues/detail?id=$2',
|
||||||
|
},
|
||||||
changeid: {
|
changeid: {
|
||||||
match: '(I[0-9a-f]{8,40})',
|
match: '(I[0-9a-f]{8,40})',
|
||||||
link: '#/q/$1',
|
link: '#/q/$1',
|
||||||
@@ -116,6 +120,18 @@ limitations under the License.
|
|||||||
assert.equal(linkEl.textContent, 'Bug 3650');
|
assert.equal(linkEl.textContent, 'Bug 3650');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Pattern with same prefix as link was correctly parsed', () => {
|
||||||
|
// Pattern starts with the same prefix (`http`) as the url.
|
||||||
|
element.content = 'httpexample 3650';
|
||||||
|
|
||||||
|
assert.equal(element.$.output.childNodes.length, 1);
|
||||||
|
const linkEl = element.$.output.childNodes[0];
|
||||||
|
const url = 'https://bugs.chromium.org/p/gerrit/issues/detail?id=3650';
|
||||||
|
assert.equal(linkEl.target, '_blank');
|
||||||
|
assert.equal(linkEl.href, url);
|
||||||
|
assert.equal(linkEl.textContent, 'httpexample 3650');
|
||||||
|
});
|
||||||
|
|
||||||
test('Change-Id pattern was parsed and linked', () => {
|
test('Change-Id pattern was parsed and linked', () => {
|
||||||
// "Change-Id:" pattern.
|
// "Change-Id:" pattern.
|
||||||
const changeID = 'I11d6a37f5e9b5df0486f6c922d8836dfa780e03e';
|
const changeID = 'I11d6a37f5e9b5df0486f6c922d8836dfa780e03e';
|
||||||
|
|||||||
@@ -312,14 +312,15 @@
|
|||||||
let result = match[0].replace(pattern,
|
let result = match[0].replace(pattern,
|
||||||
patterns[p].html || patterns[p].link);
|
patterns[p].html || patterns[p].link);
|
||||||
|
|
||||||
let i;
|
|
||||||
// Skip portion of replacement string that is equal to original.
|
|
||||||
for (i = 0; i < result.length; i++) {
|
|
||||||
if (result[i] !== match[0][i]) { break; }
|
|
||||||
}
|
|
||||||
result = result.slice(i);
|
|
||||||
|
|
||||||
if (patterns[p].html) {
|
if (patterns[p].html) {
|
||||||
|
let i;
|
||||||
|
// Skip portion of replacement string that is equal to original to
|
||||||
|
// allow overlapping patterns.
|
||||||
|
for (i = 0; i < result.length; i++) {
|
||||||
|
if (result[i] !== match[0][i]) { break; }
|
||||||
|
}
|
||||||
|
result = result.slice(i);
|
||||||
|
|
||||||
this.addHTML(
|
this.addHTML(
|
||||||
result,
|
result,
|
||||||
susbtrIndex + match.index + i,
|
susbtrIndex + match.index + i,
|
||||||
@@ -329,8 +330,8 @@
|
|||||||
this.addLink(
|
this.addLink(
|
||||||
match[0],
|
match[0],
|
||||||
result,
|
result,
|
||||||
susbtrIndex + match.index + i,
|
susbtrIndex + match.index,
|
||||||
match[0].length - i,
|
match[0].length,
|
||||||
outputArray);
|
outputArray);
|
||||||
} else {
|
} else {
|
||||||
throw Error('linkconfig entry ' + p +
|
throw Error('linkconfig entry ' + p +
|
||||||
|
|||||||
Reference in New Issue
Block a user