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

Add consumer rates to consumer view #180

Merged
merged 9 commits into from
Jul 2, 2019
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 2.3.1 (UNRELEASED)
## 2.4.0 (UNRELEASED)
#### New Features
- [PR-180]() Consumer Group inspector now shows average rate of consumption per partition.

#### Bug Fixes
- [ISSUE-175](https://github.com/SourceLabOrg/kafka-webview/issues/175) Update multi-threaded consumers with unique consumerId [PR](https://github.com/SourceLabOrg/kafka-webview/pull/176).
- [PR-178](https://github.com/SourceLabOrg/kafka-webview/pull/178) @[lucrito](https://github.com/lucrito) fixed shebang in start.sh script. Thanks!
- [PR-179](https://github.com/SourceLabOrg/kafka-webview/pull/179) Streaming consumer now persists consumer state.
- [PR-180](https://github.com/SourceLabOrg/kafka-webview/pull/180) Adds additional metrics (consume rate, producer rate, lag) and graphs to Consumer details page.

## 2.3.0 (06/19/2019)
#### New Features
Expand Down
4 changes: 2 additions & 2 deletions dev-cluster/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>kafka-webview</artifactId>
<groupId>org.sourcelab</groupId>
<version>2.3.1</version>
<version>2.4.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>dev-cluster</artifactId>
<version>2.3.1</version>
<version>2.4.0</version>

<!-- Require Maven 3.3.9 -->
<prerequisites>
Expand Down
2 changes: 1 addition & 1 deletion kafka-webview-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.sourcelab</groupId>
<artifactId>kafka-webview</artifactId>
<version>2.3.1</version>
<version>2.4.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>kafka-webview-plugin</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions kafka-webview-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<artifactId>kafka-webview</artifactId>
<groupId>org.sourcelab</groupId>
<version>2.3.1</version>
<version>2.4.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>kafka-webview-ui</artifactId>
<version>2.3.1</version>
<version>2.4.0</version>

<!-- Module Description and Ownership -->
<name>Kafka WebView UI</name>
Expand Down
14 changes: 14 additions & 0 deletions kafka-webview-ui/src/main/frontend/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,20 @@ var DateTools = {

return year + '-' + month + '-' + day + ' ' + hour + ':' + min + ':' + sec + DateTools.formatTz(myDate);
},
displayTimeOnly: function(timestampMs) {
// Adjusts timestamp into local timezone and locate
var myDate = new Date(timestampMs);

var hour = myDate.getHours();
var min = myDate.getMinutes();
var sec = myDate.getSeconds();

hour = (hour < 10 ? "0" : "") + hour;
min = (min < 10 ? "0" : "") + min;
sec = (sec < 10 ? "0" : "") + sec;

return hour + ':' + min + ':' + sec;
},
formatTz: function(date) {
var timezone_offset_min = date.getTimezoneOffset(),
offset_hrs = parseInt(Math.abs(timezone_offset_min/60)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.kafka.clients.admin.ConfigEntry;
import org.apache.kafka.clients.admin.CreateTopicsResult;
import org.apache.kafka.clients.admin.DeleteConsumerGroupsResult;
import org.apache.kafka.clients.admin.DeleteTopicsOptions;
import org.apache.kafka.clients.admin.DeleteTopicsResult;
import org.apache.kafka.clients.admin.DescribeConfigsResult;
import org.apache.kafka.clients.admin.DescribeConsumerGroupsResult;
Expand Down Expand Up @@ -506,7 +505,8 @@ public ConsumerGroupOffsetsWithTailPositions getConsumerGroupOffsetsWithTailOffs
return new ConsumerGroupOffsetsWithTailPositions(
consumerGroupId,
consumerGroupOffsets.getTopic(),
offsetsWithPartitions
offsetsWithPartitions,
System.currentTimeMillis()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,23 @@ public class ConsumerGroupOffsetsWithTailPositions {
private final String consumerId;
private final String topic;
private final Map<Integer, PartitionOffsetWithTailPosition> offsetMap;
private final long timestamp;

/**
* Constructor.
* @param consumerId id of consumer group.
* @param topic name of the topic.
* @param offsets details about each partition and offset.
* @param timestamp Timestamp offsets were retrieved.
*/
public ConsumerGroupOffsetsWithTailPositions(
final String consumerId,
final String topic,
final Iterable<PartitionOffsetWithTailPosition> offsets
) {
final Iterable<PartitionOffsetWithTailPosition> offsets,
final long timestamp) {
this.consumerId = consumerId;
this.topic = topic;
this.timestamp = timestamp;

final Map<Integer, PartitionOffsetWithTailPosition> copiedMap = new HashMap<>();
for (final PartitionOffsetWithTailPosition offset : offsets) {
Expand All @@ -74,6 +77,10 @@ public String getTopic() {
return topic;
}

public long getTimestamp() {
return timestamp;
}

/**
* Marked private to keep from being serialized in responses.
*/
Expand Down Expand Up @@ -143,6 +150,7 @@ public String toString() {
return "ConsumerGroupOffsetsWithTailPositions{"
+ "consumerId='" + consumerId + '\''
+ ", topic='" + topic + '\''
+ ", timestamp='" + timestamp + '\''
+ ", offsetMap=" + offsetMap
+ '}';
}
Expand Down
Loading