mirror of
https://github.com/floci-io/floci.git
synced 2026-12-02 17:58:05 -05:00
fix(cloudwatch): return storedBytes on DescribeLogGroups (#4202)
* fix(cloudwatch): return storedBytes on DescribeLogGroups AWS reports log-group storedBytes as the sum of stream sizes. Floci always returned 0, which breaks SDK clients that read the field. * style(cloudwatch): import collection test helpers
This commit is contained in:
1 parent
35605937c8
commit
babb43ac3d
5 files changed
+119
-29
No files matched your search
+1
-1
@@ -136,7 +136,7 @@ public class CloudWatchLogsHandler {
|
||||
if (g.getKmsKeyId() != null) {
|
||||
node.put("kmsKeyId", g.getKmsKeyId());
|
||||
}
|
||||
node.put("storedBytes", 0);
|
||||
node.put("storedBytes", logsService.getStoredBytesForLogGroup(g.getLogGroupName(), region));
|
||||
node.put("metricFilterCount", metricFilterHandler.metricFilterCount(g.getLogGroupName(), region));
|
||||
groupsArray.add(node);
|
||||
}
|
||||
|
||||
+7
@@ -337,6 +337,13 @@ public class CloudWatchLogsService implements ResourceProvider {
|
||||
return result;
|
||||
}
|
||||
|
||||
public long getStoredBytesForLogGroup(String groupName, String region) {
|
||||
String storagePrefix = streamKeyPrefix(region, groupName);
|
||||
return streamStore.scan(k -> k.startsWith(storagePrefix)).stream()
|
||||
.mapToLong(LogStream::getStoredBytes)
|
||||
.sum();
|
||||
}
|
||||
|
||||
public void putLogGroupDeletionProtection(String groupName, boolean enabled, String region) {
|
||||
String key = groupKey(region, groupName);
|
||||
LogGroup group = groupStore.get(key)
|
||||
|
||||
Reference in new issue
Block a user