-
Notifications
You must be signed in to change notification settings - Fork 27
Feature: expose librdkafka statistics as swift metrics #92
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
Merged
FranzBusch
merged 26 commits into
swift-server:main
from
ordo-one:feature/sc-1976/gsoc-expose-librdkafka-statistics
Nov 6, 2023
Merged
Changes from 16 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
c870864
introduce statistics for producer
blindspotbounty 633773f
Merge remote-tracking branch 'origin/main' into feature/sc-1976/gsoc-…
blindspotbounty d9887b9
add statistics to new consumer with events
blindspotbounty e5f0483
Merge remote-tracking branch 'origin/main' into feature/sc-1976/gsoc-…
blindspotbounty d55a7fd
fix some artefacts
blindspotbounty 8b4525b
adjust to KeyRefreshAttempts
blindspotbounty 23e08fc
draft: statistics with metrics
blindspotbounty 612a3c4
make structures internal
blindspotbounty 5c10435
Update Sources/Kafka/Configuration/KafkaConfiguration+Metrics.swift
blindspotbounty 2be2bd9
Update Sources/Kafka/Configuration/KafkaConsumerConfiguration.swift
blindspotbounty 2cd0f8b
Update Sources/Kafka/Configuration/KafkaConfiguration+Metrics.swift
blindspotbounty abd97de
Update Sources/Kafka/Configuration/KafkaConfiguration+Metrics.swift
blindspotbounty 15284e1
address review comments
blindspotbounty a4ee678
formatting
blindspotbounty 0a0f1b8
map gauges in one place
blindspotbounty dcdbe21
Merge remote-tracking branch 'origin/main' into feature/sc-1976/gsoc-…
blindspotbounty 5448eb4
move json mode as rd kafka statistics, misc renaming + docc
blindspotbounty 900cb38
Merge branch 'main' into feature/sc-1976/gsoc-expose-librdkafka-stati…
blindspotbounty a83c970
address review comments
blindspotbounty 4ebdf9d
remove import Metrics
blindspotbounty 05cf1b9
divide producer/consumer configuration
blindspotbounty 3febfcd
apply swiftformat
blindspotbounty 455be80
Merge branch 'main' into feature/sc-1976/gsoc-expose-librdkafka-stati…
blindspotbounty a96edf7
Merge branch 'main' into feature/sc-1976/gsoc-expose-librdkafka-stati…
blindspotbounty af05f5b
fix code after conflicts
blindspotbounty 8a3caf3
fix formatting
blindspotbounty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
Sources/Kafka/Configuration/KafkaConfiguration+Metrics.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the swift-kafka-client open source project | ||
// | ||
// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import Metrics | ||
|
||
extension KafkaConfiguration { | ||
// MARK: - Metrics | ||
|
||
/// Use to configure metrics. | ||
blindspotbounty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public struct KafkaMetrics: Sendable { | ||
blindspotbounty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
internal var someMetricsSet: Bool { | ||
self.timestamp != nil || | ||
self.time != nil || | ||
self.age != nil || | ||
self.replyQueue != nil || | ||
self.messageCount != nil || | ||
self.messageSize != nil || | ||
self.messageMax != nil || | ||
self.messageSizeMax != nil || | ||
self.totalRequestsSent != nil || | ||
self.totalBytesSent != nil || | ||
self.totalResponsesRecieved != nil || | ||
self.totalBytesReceived != nil || | ||
self.totalMessagesSent != nil || | ||
self.totalMessagesBytesSent != nil || | ||
self.totalBytesReceived != nil || | ||
self.metadataCacheCount != nil | ||
} | ||
|
||
/// librdkafka's internal monotonic clock (microseconds) | ||
public var timestamp: Gauge? | ||
/// Wall clock time in seconds since the epoch | ||
public var time: Timer? | ||
/// Time since this client instance was created | ||
public var age: Timer? | ||
blindspotbounty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/// Number of ops (callbacks, events, etc) waiting in queue for application to serve | ||
public var replyQueue: Gauge? | ||
blindspotbounty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/// Current number of messages in producer queues | ||
public var messageCount: Gauge? | ||
/// Current total size of messages in producer queues | ||
public var messageSize: Gauge? | ||
blindspotbounty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/// Threshold: maximum number of messages allowed allowed on the producer queues | ||
public var messageMax: Gauge? | ||
/// Threshold: maximum total size of messages allowed on the producer queues | ||
public var messageSizeMax: Gauge? | ||
blindspotbounty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Total number of requests sent to Kafka brokers | ||
public var totalRequestsSent: Gauge? | ||
blindspotbounty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/// Total number of bytes transmitted to Kafka brokers | ||
public var totalBytesSent: Gauge? | ||
/// Total number of responses received from Kafka brokers | ||
public var totalResponsesRecieved: Gauge? | ||
/// Total number of bytes received from Kafka brokers | ||
public var totalBytesReceived: Gauge? | ||
blindspotbounty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Total number of messages transmitted (produced) to Kafka brokers | ||
blindspotbounty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public var totalMessagesSent: Gauge? | ||
/// Total number of message bytes (including framing, such as per-Message framing and MessageSet/batch framing) transmitted to Kafka brokers | ||
public var totalMessagesBytesSent: Gauge? | ||
/// Total number of messages consumed, not including ignored messages (due to offset, etc), from Kafka brokers. | ||
public var totalMessagesRecieved: Gauge? | ||
/// Total number of message bytes (including framing) received from Kafka brokers | ||
public var totalMessagesBytesRecieved: Gauge? | ||
|
||
/// Number of topics in the metadata cache. | ||
public var metadataCacheCount: Gauge? | ||
blindspotbounty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
public enum Metrics: Sendable { | ||
blindspotbounty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
case disabled | ||
case enabled(updateInterval: Duration, options: KafkaMetrics) | ||
blindspotbounty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.