Skip to content

Commit

Permalink
[fix][broker] Fix incorrect bundle split count metric (#17970)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawyeok authored Oct 11, 2022
1 parent c9651ec commit 882fcfb
Show file tree
Hide file tree
Showing 20 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@ public void checkNamespaceBundleSplit() {
synchronized (bundleSplitStrategy) {
final Set<String> bundlesToBeSplit = bundleSplitStrategy.findBundlesToSplit(loadData, pulsar);
NamespaceBundleFactory namespaceBundleFactory = pulsar.getNamespaceService().getNamespaceBundleFactory();
int splitCount = 0;
for (String bundleName : bundlesToBeSplit) {
try {
final String namespaceName = LoadManagerShared.getNamespaceNameFromBundleName(bundleName);
Expand All @@ -771,24 +772,25 @@ public void checkNamespaceBundleSplit() {
pulsar.getAdminClient().namespaces().splitNamespaceBundle(namespaceName, bundleRange,
unloadSplitBundles, null);

splitCount++;
log.info("Successfully split namespace bundle {}", bundleName);
} catch (Exception e) {
log.error("Failed to split namespace bundle {}", bundleName, e);
}
}

updateBundleSplitMetrics(bundlesToBeSplit);
updateBundleSplitMetrics(splitCount);
}

}

/**
* As leader broker, update bundle split metrics.
*
* @param bundlesToBeSplit
* @param bundlesSplit the number of bundles splits
*/
private void updateBundleSplitMetrics(Set<String> bundlesToBeSplit) {
bundleSplitCount += bundlesToBeSplit.size();
private void updateBundleSplitMetrics(int bundlesSplit) {
bundleSplitCount += bundlesSplit;

List<Metrics> metrics = new ArrayList<>();
Map<String, String> dimensions = new HashMap<>();
Expand Down
2 changes: 1 addition & 1 deletion site2/docs/reference-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ All the bundleUnloading metrics are labeled with the following labels:

| Name | Type | Description |
|-------------------------------|---------|------------------------------------------------------------|
| pulsar_lb_bundles_split_total | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_total | Counter | The total count of bundle split in this leader broker |

#### Bundle metrics
All the bundle metrics are labeled with the following labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

#### Bundle metrics
All the bundle metrics are labelled with the following labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ All the bundleUnloading metrics are labelled with the following labels:

| Name | Type | Description |
| --- | --- | --- |
| pulsar_lb_bundles_split_count | Counter | bundle split count in this bundle splitting check interval |
| pulsar_lb_bundles_split_count | Counter | The total count of bundle split in this leader broker |

### Subscription metrics

Expand Down

0 comments on commit 882fcfb

Please sign in to comment.