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

[improve][broker] PIP-192 Added operation counters in ServiceUnitStateChannelImpl #19410

Merged
merged 2 commits into from
Feb 6, 2023

Conversation

heesung-sn
Copy link
Contributor

Master Issue: #16691

Motivation

We will start raising PRs to implement PIP-192, #16691

Modifications

This PR added operation counters in ServiceUnitStateChannelImpl and its unit test.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • *Added unit tests.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

We will have separate PRs to update the Doc later.

Matching PR in forked repository

PR in forked repository: heesung-sn#27

}

private void handle(String serviceUnit, ServiceUnitStateData data) {
long totalHandledRequests = getHandlerTotalCounter(data).incrementAndGet();
Copy link
Contributor

@gaoran10 gaoran10 Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to record all events for all brokers? Or record event metrics only for the target broker.

Copy link
Contributor Author

@heesung-sn heesung-sn Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we want to record all events for all brokers.

The goal is to monitor the consistency of the tableviews across all brokers.

We need to monitor if the rate of the increase of HandlerTotalCounters( increase / x sec) is the same across all brokers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for your explanation.

} catch (Throwable e) {
log.error("Failed to publish assign event. serviceUnit:{}, broker:{}, assignPublishFailureCount:{}",
serviceUnit, broker, eventCounters.get(eventType).getFailure().incrementAndGet(), e);
throw e;
Copy link
Contributor

@gaoran10 gaoran10 Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that we need to return to an exceptional future. There are some similar methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this exception handling by returning an exceptional future from validateChannelState(). This outer try-catch is no longer required.

long handlerTotalCount = getHandlerTotalCounter(data).get();
long handlerFailureCount = getHandlerFailureCounter(data).get();
log.info("{} handled {} event for serviceUnit:{}, cur:{}, next:{}, "
+ "totalHandledRequests{}, totalFailedRequests:{}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems the log level is debug

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is meant for info. If this is a transfer command, we want to log it at the info level.

In other PRs, I will clean the debug logs based on isLoadBalancerDebugModeEnabled.

private boolean debug() {
return pulsar.getConfiguration().isLoadBalancerDebugModeEnabled() || log.isDebugEnabled();
}

@heesung-sn heesung-sn force-pushed the pip-192-bsc-op-metrics branch from 659074e to c053fc9 Compare February 3, 2023 19:26
@Technoboy- Technoboy- added this to the 3.0.0 milestone Feb 5, 2023
@Technoboy- Technoboy- closed this Feb 5, 2023
@Technoboy- Technoboy- reopened this Feb 5, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #19410 (c053fc9) into master (91c7ef7) will increase coverage by 1.02%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #19410      +/-   ##
============================================
+ Coverage     62.58%   63.61%   +1.02%     
- Complexity     3471    26088   +22617     
============================================
  Files          1829     1832       +3     
  Lines        133919   134124     +205     
  Branches      14733    14756      +23     
============================================
+ Hits          83812    85318    +1506     
+ Misses        42384    40976    -1408     
- Partials       7723     7830     +107     
Flag Coverage Δ
inttests 24.53% <0.00%> (-0.23%) ⬇️
systests 25.41% <0.00%> (-0.17%) ⬇️
unittests 60.82% <0.00%> (+1.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...apache/pulsar/broker/admin/v2/SchemasResource.java 74.69% <ø> (ø)
...xtensions/channel/ServiceUnitStateChannelImpl.java 0.85% <0.00%> (-0.12%) ⬇️
...ker/loadbalance/impl/RoundRobinBrokerSelector.java 0.00% <0.00%> (ø)
...oker/service/schema/SchemaRegistryServiceImpl.java 64.05% <0.00%> (-3.58%) ⬇️
...n/java/org/apache/pulsar/admin/cli/CmdSchemas.java 76.78% <ø> (ø)
...a/org/apache/pulsar/client/util/TypeCheckUtil.java 0.00% <0.00%> (-83.34%) ⬇️
...a/org/apache/pulsar/client/impl/TableViewImpl.java 61.66% <0.00%> (-24.17%) ⬇️
...ker/loadbalance/impl/LeastLongTermMessageRate.java 73.33% <0.00%> (-20.00%) ⬇️
.../apache/pulsar/broker/admin/impl/PackagesBase.java 59.63% <0.00%> (-15.60%) ⬇️
...ker/authorization/PulsarAuthorizationProvider.java 41.62% <0.00%> (-15.39%) ⬇️
... and 196 more

@Technoboy- Technoboy- merged commit 7075075 into apache:master Feb 6, 2023
@heesung-sn heesung-sn deleted the pip-192-bsc-op-metrics branch April 2, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants