Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][broker] Fix incorrect bundle split count metric #17970

Merged
merged 2 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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