From 7ff2165c1fba51f3bf855883f2308d5cd79f42c3 Mon Sep 17 00:00:00 2001 From: fengyubiao Date: Tue, 20 Sep 2022 18:45:47 +0800 Subject: [PATCH] when config.advertisedAddr is null, use default --- .../org/apache/pulsar/broker/PulsarService.java | 4 ++-- .../impl/TxnLogBufferedWriterMetricsStats.java | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java index 84a1db26f33467..04844d6c8379c5 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java @@ -823,8 +823,8 @@ public void start() throws PulsarServerException { // Register pulsar system namespaces and start transaction meta store service if (config.isTransactionCoordinatorEnabled()) { - MLTransactionMetadataStoreProvider.initBufferedWriterMetrics(getConfiguration().getAdvertisedAddress()); - MLPendingAckStoreProvider.initBufferedWriterMetrics(getConfiguration().getAdvertisedAddress()); + MLTransactionMetadataStoreProvider.initBufferedWriterMetrics(getAdvertisedAddress()); + MLPendingAckStoreProvider.initBufferedWriterMetrics(getAdvertisedAddress()); this.transactionBufferSnapshotService = new SystemTopicBaseTxnBufferSnapshotService(getClient()); this.transactionTimer = diff --git a/pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/TxnLogBufferedWriterMetricsStats.java b/pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/TxnLogBufferedWriterMetricsStats.java index 8034cd8df30cca..6eafe79638c4a7 100644 --- a/pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/TxnLogBufferedWriterMetricsStats.java +++ b/pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/TxnLogBufferedWriterMetricsStats.java @@ -110,7 +110,7 @@ public TxnLogBufferedWriterMetricsStats(String metricsPrefix, String[] labelName .help("Records per batch histogram") .buckets(RECORD_COUNT_PER_ENTRY_BUCKETS) .register(collectorRegistry); - recordsPerBatchHistogram = recordsPerBatchMetric.labels(labelValues); + recordsPerBatchHistogram = recordsPerBatchMetric.labels(this.labelValues); String batchSizeBytesMetricName = String.format("%s_bufferedwriter_batch_size_bytes", metricsPrefix); batchSizeBytesMetric = new Histogram.Builder() @@ -119,7 +119,7 @@ public TxnLogBufferedWriterMetricsStats(String metricsPrefix, String[] labelName .help("Batch size in bytes histogram") .buckets(BYTES_SIZE_PER_ENTRY_BUCKETS) .register(collectorRegistry); - batchSizeBytesHistogram = batchSizeBytesMetric.labels(labelValues); + batchSizeBytesHistogram = batchSizeBytesMetric.labels(this.labelValues); String oldestRecordInBatchDelayTimeSecondsMetricName = String.format("%s_bufferedwriter_batch_oldest_record_delay_time_second", metricsPrefix); @@ -130,7 +130,7 @@ public TxnLogBufferedWriterMetricsStats(String metricsPrefix, String[] labelName .buckets(MAX_DELAY_TIME_BUCKETS) .register(collectorRegistry); oldestRecordInBatchDelayTimeSecondsHistogram = - oldestRecordInBatchDelayTimeSecondsMetric.labels(labelValues); + oldestRecordInBatchDelayTimeSecondsMetric.labels(this.labelValues); String batchFlushTriggeringByMaxRecordsMetricName = String.format("%s_bufferedwriter_flush_trigger_max_records", metricsPrefix); @@ -139,7 +139,7 @@ public TxnLogBufferedWriterMetricsStats(String metricsPrefix, String[] labelName .labelNames(this.labelNames) .help("Event count of batch flush triggered by max records count") .register(collectorRegistry); - batchFlushTriggeredByMaxRecordsCounter = batchFlushTriggeredByMaxRecordsMetric.labels(labelValues); + batchFlushTriggeredByMaxRecordsCounter = batchFlushTriggeredByMaxRecordsMetric.labels(this.labelValues); String batchFlushTriggeringByMaxSizeMetricName = String.format("%s_bufferedwriter_flush_trigger_max_size", metricsPrefix); @@ -148,7 +148,7 @@ public TxnLogBufferedWriterMetricsStats(String metricsPrefix, String[] labelName .labelNames(this.labelNames) .help("Event count of batch flush triggered by max bytes size") .register(collectorRegistry); - batchFlushTriggeredByMaxSizeCounter = batchFlushTriggeredByMaxSizeMetric.labels(labelValues); + batchFlushTriggeredByMaxSizeCounter = batchFlushTriggeredByMaxSizeMetric.labels(this.labelValues); String batchFlushTriggeringByMaxDelayMetricName = String.format("%s_bufferedwriter_flush_trigger_max_delay", metricsPrefix); @@ -158,7 +158,7 @@ public TxnLogBufferedWriterMetricsStats(String metricsPrefix, String[] labelName .help("Event count of batch flush triggered by max delay time") .register(collectorRegistry); batchFlushTriggeredByMaxDelayCounter = - batchFlushTriggeredByMaxDelayMetric.labels(labelValues); + batchFlushTriggeredByMaxDelayMetric.labels(this.labelValues); String batchFlushTriggeringByLargeSingleDataMetricName = String.format("%s_bufferedwriter_flush_trigger_large_data", metricsPrefix); @@ -168,7 +168,7 @@ public TxnLogBufferedWriterMetricsStats(String metricsPrefix, String[] labelName .help("Event count of batch flush triggered by the single large data write") .register(collectorRegistry); batchFlushTriggeredByLargeSingleDataCounter = - batchFlushTriggeredByLargeSingleDataMetric.labels(labelValues); + batchFlushTriggeredByLargeSingleDataMetric.labels(this.labelValues); this.closed = new AtomicBoolean(false); }