Skip to content

KAFKA-10350: add forwarding manager implementation with metrics#9580

Merged
abbccdda merged 3 commits intoapache:trunkfrom
abbccdda:forwarding-metrics-KAFKA-10350
Nov 12, 2020
Merged

KAFKA-10350: add forwarding manager implementation with metrics#9580
abbccdda merged 3 commits intoapache:trunkfrom
abbccdda:forwarding-metrics-KAFKA-10350

Conversation

@abbccdda
Copy link
Copy Markdown

@abbccdda abbccdda commented Nov 9, 2020

Add metric for forwarding request tracking. Note that the implementation is slightly diverged from the KIP, where we decide to get rid of the client.id tag since most admin clients would only have one inflight forwarding request.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@abbccdda abbccdda force-pushed the forwarding-metrics-KAFKA-10350 branch from f0b82d0 to 25d8955 Compare November 9, 2020 21:05
@abbccdda abbccdda requested a review from mumrah November 10, 2020 17:05
Copy link
Copy Markdown
Member

@mumrah mumrah left a comment

Choose a reason for hiding this comment

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

Thanks for the patch, @abbccdda. Few questions inline

BrokerToControllerChannelManagerImpl(metadataCache, time, metrics,
config, "forwardingChannel", threadNamePrefix) with KafkaMetricsGroup {

private val forwardingMetricName = "NumRequestsForwardingToControllerPerSec"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wdyt about also adding a "forwarded" boolean to the request log? (in RequestChannel#updateRequestMetrics)

Would this be useful? cc @cmccabe

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added the logging in RequestChannel.

Comment thread core/src/main/scala/kafka/server/ForwardingManager.scala
metrics: Metrics,
config: KafkaConfig,
threadNamePrefix: Option[String] = None) extends
BrokerToControllerChannelManagerImpl(metadataCache, time, metrics,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we extend the BrokerToControllerChannel here? It looks like we only ever call forwardRequest, so maybe it's better for ForwardingManager not to extend BrokerToControllerChannel and instead take it as a dependency. Otherwise we are exposing the sendRequest method which we don't really want anyone to use on the forwardingManager instance.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Actually we do need sendRequest on the forwarding manager interface in the topic creation routing (WIP here.. The forwardRequest is serving the purpose of embedding client request inside an Envelope, while for certain cases broker would like to send direct CreateTopicsRequest on behalf of its own principal instead of the client principal. I think we could debate whether to rename forwardingManager to a different name to also include the possibility of sending direct request, just not have yet come up a better name here.

Copy link
Copy Markdown
Member

@mumrah mumrah Nov 10, 2020

Choose a reason for hiding this comment

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

Ah, ok 👍 Thanks for the explanation. Another option would be to let KafkaApis have BrokerToControllerChannelManager and ForwardingManager as separate dependencies. However, we already have lots of dependencies there, so I could see us wanting to use one instance for forwarding and regular requests. I don't really have a strong opinion either way, I'm ok leaving it as-is

Comment thread core/src/main/scala/kafka/server/ForwardingManager.scala
Comment thread core/src/main/scala/kafka/network/RequestChannel.scala Outdated
Copy link
Copy Markdown
Member

@mumrah mumrah left a comment

Choose a reason for hiding this comment

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

LGTM!

@abbccdda abbccdda merged commit bb34c5c into apache:trunk Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants