diff --git a/Documentation/metrics.txt b/Documentation/metrics.txt index 064859d15d..d99958787d 100644 --- a/Documentation/metrics.txt +++ b/Documentation/metrics.txt @@ -58,6 +58,18 @@ objects needing finalization. === 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/success_count`: Rate of REST API success responses. * `http/server/rest_api/count`: Rate of REST API calls by view. diff --git a/java/com/google/gerrit/pgm/http/jetty/JettyMetrics.java b/java/com/google/gerrit/pgm/http/jetty/JettyMetrics.java index 92edf403d1..b6a2d38710 100644 --- a/java/com/google/gerrit/pgm/http/jetty/JettyMetrics.java +++ b/java/com/google/gerrit/pgm/http/jetty/JettyMetrics.java @@ -28,42 +28,42 @@ public class JettyMetrics { JettyMetrics(JettyServer jetty, MetricMaker metrics) { CallbackMetric0 minPoolSize = metrics.newCallbackMetric( - "httpd/jetty/threadpool/min_pool_size", + "http/server/jetty/threadpool/min_pool_size", Integer.class, new Description("Minimum thread pool size").setGauge()); CallbackMetric0 maxPoolSize = metrics.newCallbackMetric( - "httpd/jetty/threadpool/max_pool_size", + "http/server/jetty/threadpool/max_pool_size", Integer.class, new Description("Maximum thread pool size").setGauge()); CallbackMetric0 poolSize = metrics.newCallbackMetric( - "httpd/jetty/threadpool/pool_size", + "http/server/jetty/threadpool/pool_size", Integer.class, new Description("Current thread pool size").setGauge()); CallbackMetric0 idleThreads = metrics.newCallbackMetric( - "httpd/jetty/threadpool/idle_threads", + "http/server/jetty/threadpool/idle_threads", Integer.class, - new Description("Idle httpd threads").setGauge().setUnit("threads")); + new Description("Idle threads").setGauge().setUnit("threads")); CallbackMetric0 busyThreads = metrics.newCallbackMetric( - "httpd/jetty/threadpool/active_threads", + "http/server/jetty/threadpool/active_threads", Integer.class, - new Description("Active httpd threads").setGauge().setUnit("threads")); + new Description("Active threads").setGauge().setUnit("threads")); CallbackMetric0 reservedThreads = metrics.newCallbackMetric( - "httpd/jetty/threadpool/reserved_threads", + "http/server/jetty/threadpool/reserved_threads", Integer.class, - new Description("Reserved httpd threads").setGauge().setUnit("threads")); + new Description("Reserved threads").setGauge().setUnit("threads")); CallbackMetric0 queueSize = metrics.newCallbackMetric( - "httpd/jetty/threadpool/queue_size", + "http/server/jetty/threadpool/queue_size", Integer.class, - new Description("Thread pool queue size").setGauge().setUnit("requests")); + new Description("Queued requests waiting for a thread").setGauge().setUnit("requests")); CallbackMetric0 lowOnThreads = metrics.newCallbackMetric( - "httpd/jetty/threadpool/is_low_on_threads", + "http/server/jetty/threadpool/is_low_on_threads", Boolean.class, new Description("Whether thread pool is low on threads").setGauge()); JettyServer.Metrics jettyMetrics = jetty.getMetrics(); diff --git a/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text_test.html b/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text_test.html index 6d413b7fab..19839a8c57 100644 --- a/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text_test.html +++ b/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text_test.html @@ -50,6 +50,10 @@ limitations under the License. match: '([Bb]ug|[Ii]ssue)\\s*#?(\\d+)', 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: { match: '(I[0-9a-f]{8,40})', link: '#/q/$1', @@ -116,6 +120,18 @@ limitations under the License. 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', () => { // "Change-Id:" pattern. const changeID = 'I11d6a37f5e9b5df0486f6c922d8836dfa780e03e'; diff --git a/polygerrit-ui/app/elements/shared/gr-linked-text/link-text-parser.js b/polygerrit-ui/app/elements/shared/gr-linked-text/link-text-parser.js index 23a71f99e3..027c632e12 100644 --- a/polygerrit-ui/app/elements/shared/gr-linked-text/link-text-parser.js +++ b/polygerrit-ui/app/elements/shared/gr-linked-text/link-text-parser.js @@ -312,14 +312,15 @@ let result = match[0].replace(pattern, 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) { + 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( result, susbtrIndex + match.index + i, @@ -329,8 +330,8 @@ this.addLink( match[0], result, - susbtrIndex + match.index + i, - match[0].length - i, + susbtrIndex + match.index, + match[0].length, outputArray); } else { throw Error('linkconfig entry ' + p +