This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1073 from zalando/ARUHA-2372
ARUHA-2372 Store event disk size stats from nakadi
- Loading branch information
Showing
14 changed files
with
498 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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 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 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
45 changes: 45 additions & 0 deletions
45
src/main/java/org/zalando/nakadi/repository/kafka/BubukuSizeStats.java
This file contains 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,45 @@ | ||
package org.zalando.nakadi.repository.kafka; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.Map; | ||
|
||
public class BubukuSizeStats { | ||
public static class TotalStats { | ||
private final long usedKb; | ||
private final long freeKb; | ||
|
||
public TotalStats( | ||
@JsonProperty("used_kb") final long usedKb, | ||
@JsonProperty("free_kb") final long freeKb) { | ||
this.usedKb = usedKb; | ||
this.freeKb = freeKb; | ||
} | ||
|
||
public long getUsedKb() { | ||
return usedKb; | ||
} | ||
|
||
public long getFreeKb() { | ||
return freeKb; | ||
} | ||
} | ||
|
||
private final TotalStats totalStats; | ||
private final Map<String, Map<String, Long>> perPartitionStats; | ||
|
||
public BubukuSizeStats( | ||
@JsonProperty("disk") final TotalStats totalStats, | ||
@JsonProperty("topics") final Map<String, Map<String, Long>> perPartitionStats) { | ||
this.totalStats = totalStats; | ||
this.perPartitionStats = perPartitionStats; | ||
} | ||
|
||
public TotalStats getTotalStats() { | ||
return totalStats; | ||
} | ||
|
||
public Map<String, Map<String, Long>> getPerPartitionStats() { | ||
return perPartitionStats; | ||
} | ||
} |
This file contains 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
39 changes: 39 additions & 0 deletions
39
src/main/java/org/zalando/nakadi/repository/kafka/KafkaZookeeper.java
This file contains 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,39 @@ | ||
package org.zalando.nakadi.repository.kafka; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.zalando.nakadi.repository.zookeeper.ZooKeeperHolder; | ||
|
||
import java.util.List; | ||
|
||
public class KafkaZookeeper { | ||
private final ZooKeeperHolder zooKeeperHolder; | ||
private final ObjectMapper objectMapper; | ||
|
||
public KafkaZookeeper( | ||
final ZooKeeperHolder zooKeeperHolder, | ||
final ObjectMapper objectMapper) { | ||
this.zooKeeperHolder = zooKeeperHolder; | ||
this.objectMapper = objectMapper; | ||
} | ||
|
||
public List<String> listTopics() throws Exception { | ||
return zooKeeperHolder.get() | ||
.getChildren() | ||
.forPath("/brokers/topics"); | ||
} | ||
|
||
public List<String> getBrokerIdsForSizeStats() throws Exception { | ||
return zooKeeperHolder.get().getChildren() | ||
.forPath("/bubuku/size_stats"); | ||
} | ||
|
||
public BubukuSizeStats getSizeStatsForBroker(final String brokerId) throws Exception { | ||
return objectMapper.readValue( | ||
zooKeeperHolder.get().getData().forPath("/bubuku/size_stats/" + brokerId), | ||
BubukuSizeStats.class); | ||
} | ||
|
||
public String getZookeeperConnectionString() { | ||
return zooKeeperHolder.get().getZookeeperClient().getCurrentConnectionString(); | ||
} | ||
} |
This file contains 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
55 changes: 55 additions & 0 deletions
55
src/main/java/org/zalando/nakadi/service/job/DiskUsageStatsConfig.java
This file contains 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,55 @@ | ||
package org.zalando.nakadi.service.job; | ||
|
||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@ConfigurationProperties(prefix = "nakadi.jobs.diskUsageStats") | ||
public class DiskUsageStatsConfig { | ||
private String authDataType; | ||
private String authValue; | ||
private String owningApplication; | ||
private String eventTypeName; | ||
private long runPeriodMs; | ||
|
||
public String getAuthDataType() { | ||
return authDataType; | ||
} | ||
|
||
public void setAuthDataType(final String authDataType) { | ||
this.authDataType = authDataType; | ||
} | ||
|
||
public String getAuthValue() { | ||
return authValue; | ||
} | ||
|
||
public void setAuthValue(final String authValue) { | ||
this.authValue = authValue; | ||
} | ||
|
||
public String getOwningApplication() { | ||
return owningApplication; | ||
} | ||
|
||
public void setOwningApplication(final String owningApplication) { | ||
this.owningApplication = owningApplication; | ||
} | ||
|
||
public String getEventTypeName() { | ||
return eventTypeName; | ||
} | ||
|
||
public void setEventTypeName(final String eventTypeName) { | ||
this.eventTypeName = eventTypeName; | ||
} | ||
|
||
public long getRunPeriodMs() { | ||
return runPeriodMs; | ||
} | ||
|
||
public void setRunPeriodMs(final long runPeriodMs) { | ||
this.runPeriodMs = runPeriodMs; | ||
} | ||
} |
Oops, something went wrong.