You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/03/17 02:42:43 UTC
[GitHub] [pulsar] tjiuming opened a new pull request #14723: [Broker] Improve SchemaRegistry logs and metrics
tjiuming opened a new pull request #14723:
URL: https://github.com/apache/pulsar/pull/14723
### Motivation
Add logs and metrics for SchemaRegistry to help troubleshooting
### Modifications
1. Add SchemaRegistryStat class
2. Record metrics by calling SchemaRegistryStat methods
3. add logs in SchemaRegistryServiceImpl
### Does this pull request potentially affect one of the following parts:
*If `yes` was chosen, please highlight the changes*
- Dependencies (does it add or upgrade a dependency): (no)
- The public API: (no)
- The schema: (no)
- The default values of configurations: (no)
- The wire protocol: (no)
- The rest endpoints: (no)
- The admin cli options: (no)
- Anything that affects deployment: (no)
### Documentation
Check the box below or label this PR directly (if you have committer privilege).
Need to update docs?
- [x] `doc-required`
(If you need help on updating docs, create a doc issue)
- [ ] `no-need-doc`
(Please explain why)
- [ ] `doc`
(If this PR contains doc changes)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Anonymitaet commented on pull request #14723: [Broker] Improve SchemaRegistry logs and metrics
Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #14723:
URL: https://github.com/apache/pulsar/pull/14723#issuecomment-1072085970
@momo-jun a soft reminder: here is a PR targeted at 2.11 w/ `doc-required` label.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] momo-jun commented on pull request #14723: [Broker] Improve SchemaRegistry logs and metrics
Posted by GitBox <gi...@apache.org>.
momo-jun commented on pull request #14723:
URL: https://github.com/apache/pulsar/pull/14723#issuecomment-1075890072
Doc updates: @tjiuming will submit a doc PR to add the new metrics for schema as soon as this PR gets merged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] tjiuming commented on pull request #14723: [Broker] Improve SchemaRegistry logs and metrics
Posted by GitBox <gi...@apache.org>.
tjiuming commented on pull request #14723:
URL: https://github.com/apache/pulsar/pull/14723#issuecomment-1069956038
Tests to be completed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codelipenghui commented on a change in pull request #14723: [Broker] Improve SchemaRegistry logs and metrics
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #14723:
URL: https://github.com/apache/pulsar/pull/14723#discussion_r828931987
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryStats.java
##########
@@ -0,0 +1,157 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.pulsar.broker.service.schema;
+
+import io.prometheus.client.CollectorRegistry;
+import io.prometheus.client.Counter;
+import io.prometheus.client.Summary;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+class SchemaRegistryStats implements AutoCloseable {
+ private static final String SCHEMA_ID = "schema";
+ private static final String STATUS = "status";
+ private static final String CLUSTER = "cluster";
+ private static final String STATUS_SUCCESS = "success";
+ private static final String STATUS_FAILED = "failed";
+ private static final double[] QUANTILES = {0.50, 0.75, 0.95, 0.99};
+ private static final AtomicBoolean CLOSED = new AtomicBoolean(false);
+
+ private final Counter delSchemaOps;
+ private final Counter getSchemaOps;
+ private final Counter putSchemaOps;
+
+ private final Counter schemaIncompatibleCount;
+ private final Counter schemaCompatibleCount;
+
+ private final Summary delSchemaLatency;
+ private final Summary getSchemaLatency;
+ private final Summary putSchemaLatency;
+ private final String clusterName;
+
+ private static volatile SchemaRegistryStats instance;
+
+ static synchronized SchemaRegistryStats getInstance(final int interval, final String cluster) {
+ if (null == instance) {
+ instance = new SchemaRegistryStats(interval, cluster);
+ }
+
+ return instance;
+ }
+
+ private SchemaRegistryStats(final int interval, final String cluster) {
+ this.clusterName = cluster;
+
+ this.delSchemaOps = Counter.build("pulsar_schema_del_ops_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID, STATUS)
+ .create()
+ .register();
+ this.getSchemaOps = Counter.build("pulsar_schema_get_ops_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID, STATUS)
+ .create()
+ .register();
+ this.putSchemaOps = Counter.build("pulsar_schema_put_ops_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID, STATUS)
+ .create()
+ .register();
+
+ this.schemaCompatibleCount = Counter.build("pulsar_schema_compatible_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID)
+ .create()
+ .register();
+ this.schemaIncompatibleCount = Counter.build("pulsar_schema_incompatible_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID)
+ .create()
+ .register();
+
+ this.delSchemaLatency = this.setQuantiles(
+ Summary.build("pulsar_schema_del_ops_latency", "-")
+ .maxAgeSeconds(interval).labelNames(CLUSTER, SCHEMA_ID));
+ this.getSchemaLatency = this.setQuantiles(
+ Summary.build("pulsar_schema_get_ops_latency", "-")
+ .maxAgeSeconds(interval).labelNames(CLUSTER, SCHEMA_ID));
+ this.putSchemaLatency = this.setQuantiles(
+ Summary.build("pulsar_schema_put_ops_latency", "-")
+ .maxAgeSeconds(interval).labelNames(CLUSTER, SCHEMA_ID));
Review comment:
If we use summary here, we don't need to add _count above? The summary should expose the _count and _sum.
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryStats.java
##########
@@ -0,0 +1,157 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.pulsar.broker.service.schema;
+
+import io.prometheus.client.CollectorRegistry;
+import io.prometheus.client.Counter;
+import io.prometheus.client.Summary;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+class SchemaRegistryStats implements AutoCloseable {
+ private static final String SCHEMA_ID = "schema";
+ private static final String STATUS = "status";
+ private static final String CLUSTER = "cluster";
+ private static final String STATUS_SUCCESS = "success";
+ private static final String STATUS_FAILED = "failed";
+ private static final double[] QUANTILES = {0.50, 0.75, 0.95, 0.99};
Review comment:
```suggestion
private static final double[] QUANTILES = {0.50, 0.75, 0.95, 0.99, 0.999, 0.9999, 1};
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] tjiuming commented on a change in pull request #14723: [Broker] Improve SchemaRegistry logs and metrics
Posted by GitBox <gi...@apache.org>.
tjiuming commented on a change in pull request #14723:
URL: https://github.com/apache/pulsar/pull/14723#discussion_r829017208
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryStats.java
##########
@@ -0,0 +1,157 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.pulsar.broker.service.schema;
+
+import io.prometheus.client.CollectorRegistry;
+import io.prometheus.client.Counter;
+import io.prometheus.client.Summary;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+class SchemaRegistryStats implements AutoCloseable {
+ private static final String SCHEMA_ID = "schema";
+ private static final String STATUS = "status";
+ private static final String CLUSTER = "cluster";
+ private static final String STATUS_SUCCESS = "success";
+ private static final String STATUS_FAILED = "failed";
+ private static final double[] QUANTILES = {0.50, 0.75, 0.95, 0.99};
+ private static final AtomicBoolean CLOSED = new AtomicBoolean(false);
+
+ private final Counter delSchemaOps;
+ private final Counter getSchemaOps;
+ private final Counter putSchemaOps;
+
+ private final Counter schemaIncompatibleCount;
+ private final Counter schemaCompatibleCount;
+
+ private final Summary delSchemaLatency;
+ private final Summary getSchemaLatency;
+ private final Summary putSchemaLatency;
+ private final String clusterName;
+
+ private static volatile SchemaRegistryStats instance;
+
+ static synchronized SchemaRegistryStats getInstance(final int interval, final String cluster) {
+ if (null == instance) {
+ instance = new SchemaRegistryStats(interval, cluster);
+ }
+
+ return instance;
+ }
+
+ private SchemaRegistryStats(final int interval, final String cluster) {
+ this.clusterName = cluster;
+
+ this.delSchemaOps = Counter.build("pulsar_schema_del_ops_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID, STATUS)
+ .create()
+ .register();
+ this.getSchemaOps = Counter.build("pulsar_schema_get_ops_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID, STATUS)
+ .create()
+ .register();
+ this.putSchemaOps = Counter.build("pulsar_schema_put_ops_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID, STATUS)
+ .create()
+ .register();
+
+ this.schemaCompatibleCount = Counter.build("pulsar_schema_compatible_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID)
+ .create()
+ .register();
+ this.schemaIncompatibleCount = Counter.build("pulsar_schema_incompatible_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID)
+ .create()
+ .register();
+
+ this.delSchemaLatency = this.setQuantiles(
+ Summary.build("pulsar_schema_del_ops_latency", "-")
+ .maxAgeSeconds(interval).labelNames(CLUSTER, SCHEMA_ID));
+ this.getSchemaLatency = this.setQuantiles(
+ Summary.build("pulsar_schema_get_ops_latency", "-")
+ .maxAgeSeconds(interval).labelNames(CLUSTER, SCHEMA_ID));
+ this.putSchemaLatency = this.setQuantiles(
+ Summary.build("pulsar_schema_put_ops_latency", "-")
+ .maxAgeSeconds(interval).labelNames(CLUSTER, SCHEMA_ID));
Review comment:
It‘s not same, the delSchemaOpsCount record both failed and succeed ops count, distinguish with label `status`.
But the summary only record succeed ops latency
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Anonymitaet commented on pull request #14723: [Broker] Improve SchemaRegistry logs and metrics
Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #14723:
URL: https://github.com/apache/pulsar/pull/14723#issuecomment-1072085970
@momo-jun a soft reminder: here is a PR targeted at 2.11 w/ `doc-required` label.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] tjiuming commented on a change in pull request #14723: [Broker] Improve SchemaRegistry logs and metrics
Posted by GitBox <gi...@apache.org>.
tjiuming commented on a change in pull request #14723:
URL: https://github.com/apache/pulsar/pull/14723#discussion_r829017208
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryStats.java
##########
@@ -0,0 +1,157 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.pulsar.broker.service.schema;
+
+import io.prometheus.client.CollectorRegistry;
+import io.prometheus.client.Counter;
+import io.prometheus.client.Summary;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+class SchemaRegistryStats implements AutoCloseable {
+ private static final String SCHEMA_ID = "schema";
+ private static final String STATUS = "status";
+ private static final String CLUSTER = "cluster";
+ private static final String STATUS_SUCCESS = "success";
+ private static final String STATUS_FAILED = "failed";
+ private static final double[] QUANTILES = {0.50, 0.75, 0.95, 0.99};
+ private static final AtomicBoolean CLOSED = new AtomicBoolean(false);
+
+ private final Counter delSchemaOps;
+ private final Counter getSchemaOps;
+ private final Counter putSchemaOps;
+
+ private final Counter schemaIncompatibleCount;
+ private final Counter schemaCompatibleCount;
+
+ private final Summary delSchemaLatency;
+ private final Summary getSchemaLatency;
+ private final Summary putSchemaLatency;
+ private final String clusterName;
+
+ private static volatile SchemaRegistryStats instance;
+
+ static synchronized SchemaRegistryStats getInstance(final int interval, final String cluster) {
+ if (null == instance) {
+ instance = new SchemaRegistryStats(interval, cluster);
+ }
+
+ return instance;
+ }
+
+ private SchemaRegistryStats(final int interval, final String cluster) {
+ this.clusterName = cluster;
+
+ this.delSchemaOps = Counter.build("pulsar_schema_del_ops_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID, STATUS)
+ .create()
+ .register();
+ this.getSchemaOps = Counter.build("pulsar_schema_get_ops_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID, STATUS)
+ .create()
+ .register();
+ this.putSchemaOps = Counter.build("pulsar_schema_put_ops_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID, STATUS)
+ .create()
+ .register();
+
+ this.schemaCompatibleCount = Counter.build("pulsar_schema_compatible_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID)
+ .create()
+ .register();
+ this.schemaIncompatibleCount = Counter.build("pulsar_schema_incompatible_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID)
+ .create()
+ .register();
+
+ this.delSchemaLatency = this.setQuantiles(
+ Summary.build("pulsar_schema_del_ops_latency", "-")
+ .maxAgeSeconds(interval).labelNames(CLUSTER, SCHEMA_ID));
+ this.getSchemaLatency = this.setQuantiles(
+ Summary.build("pulsar_schema_get_ops_latency", "-")
+ .maxAgeSeconds(interval).labelNames(CLUSTER, SCHEMA_ID));
+ this.putSchemaLatency = this.setQuantiles(
+ Summary.build("pulsar_schema_put_ops_latency", "-")
+ .maxAgeSeconds(interval).labelNames(CLUSTER, SCHEMA_ID));
Review comment:
It‘s not same, the delSchemaOpsCount record both failed and succeed ops count, distinguish with label `status`.
But the summary only record succeed ops latency
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryStats.java
##########
@@ -0,0 +1,157 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.pulsar.broker.service.schema;
+
+import io.prometheus.client.CollectorRegistry;
+import io.prometheus.client.Counter;
+import io.prometheus.client.Summary;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+class SchemaRegistryStats implements AutoCloseable {
+ private static final String SCHEMA_ID = "schema";
+ private static final String STATUS = "status";
+ private static final String CLUSTER = "cluster";
+ private static final String STATUS_SUCCESS = "success";
+ private static final String STATUS_FAILED = "failed";
+ private static final double[] QUANTILES = {0.50, 0.75, 0.95, 0.99};
+ private static final AtomicBoolean CLOSED = new AtomicBoolean(false);
+
+ private final Counter delSchemaOps;
+ private final Counter getSchemaOps;
+ private final Counter putSchemaOps;
+
+ private final Counter schemaIncompatibleCount;
+ private final Counter schemaCompatibleCount;
+
+ private final Summary delSchemaLatency;
+ private final Summary getSchemaLatency;
+ private final Summary putSchemaLatency;
+ private final String clusterName;
+
+ private static volatile SchemaRegistryStats instance;
+
+ static synchronized SchemaRegistryStats getInstance(final int interval, final String cluster) {
+ if (null == instance) {
+ instance = new SchemaRegistryStats(interval, cluster);
+ }
+
+ return instance;
+ }
+
+ private SchemaRegistryStats(final int interval, final String cluster) {
+ this.clusterName = cluster;
+
+ this.delSchemaOps = Counter.build("pulsar_schema_del_ops_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID, STATUS)
+ .create()
+ .register();
+ this.getSchemaOps = Counter.build("pulsar_schema_get_ops_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID, STATUS)
+ .create()
+ .register();
+ this.putSchemaOps = Counter.build("pulsar_schema_put_ops_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID, STATUS)
+ .create()
+ .register();
+
+ this.schemaCompatibleCount = Counter.build("pulsar_schema_compatible_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID)
+ .create()
+ .register();
+ this.schemaIncompatibleCount = Counter.build("pulsar_schema_incompatible_count", "-")
+ .labelNames(CLUSTER, SCHEMA_ID)
+ .create()
+ .register();
+
+ this.delSchemaLatency = this.setQuantiles(
+ Summary.build("pulsar_schema_del_ops_latency", "-")
+ .maxAgeSeconds(interval).labelNames(CLUSTER, SCHEMA_ID));
+ this.getSchemaLatency = this.setQuantiles(
+ Summary.build("pulsar_schema_get_ops_latency", "-")
+ .maxAgeSeconds(interval).labelNames(CLUSTER, SCHEMA_ID));
+ this.putSchemaLatency = this.setQuantiles(
+ Summary.build("pulsar_schema_put_ops_latency", "-")
+ .maxAgeSeconds(interval).labelNames(CLUSTER, SCHEMA_ID));
Review comment:
Reimplemented here, when get/del/put ops failed then record failed ops count, if succeed only record latency.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org