From fe6735d68e0c400cbcf1339594c78b4833c78955 Mon Sep 17 00:00:00 2001 From: wei <493703217@qq.com> Date: Sun, 1 Sep 2024 17:06:56 +0800 Subject: [PATCH] feat: add model definition (#26) Signed-off-by: wei <493703217@qq.com> --- .../pulsar/admin/jdk/CompactionStats.java | 22 +++++ .../pulsar/admin/jdk/ConsumerStats.java | 72 ++++++++++++++ .../admin/jdk/PartitionedTopicStats.java | 21 +++++ .../pulsar/admin/jdk/ProducerAccessMode.java | 8 ++ .../pulsar/admin/jdk/PublisherStats.java | 63 +++++++++++++ .../pulsar/admin/jdk/ReplicatorStats.java | 38 ++++++++ .../pulsar/admin/jdk/SubscriptionStats.java | 94 +++++++++++++++++++ .../protocol/pulsar/admin/jdk/TopicStats.java | 82 ++++++++++++++++ 8 files changed, 400 insertions(+) create mode 100644 pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/CompactionStats.java create mode 100644 pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/ConsumerStats.java create mode 100644 pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/PartitionedTopicStats.java create mode 100644 pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/ProducerAccessMode.java create mode 100644 pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/PublisherStats.java create mode 100644 pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/ReplicatorStats.java create mode 100644 pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/SubscriptionStats.java create mode 100644 pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/TopicStats.java diff --git a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/CompactionStats.java b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/CompactionStats.java new file mode 100644 index 0000000..8bca42b --- /dev/null +++ b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/CompactionStats.java @@ -0,0 +1,22 @@ +package io.github.protocol.pulsar.admin.jdk; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@ToString +public class CompactionStats { + public long lastCompactionRemovedEventCount; + + public long lastCompactionSucceedTimestamp; + + public long lastCompactionFailedTimestamp; + + public long lastCompactionDurationTimeInMills; +} diff --git a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/ConsumerStats.java b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/ConsumerStats.java new file mode 100644 index 0000000..696dec9 --- /dev/null +++ b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/ConsumerStats.java @@ -0,0 +1,72 @@ +package io.github.protocol.pulsar.admin.jdk; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +import java.util.List; +import java.util.Map; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@ToString +public class ConsumerStats { + public double msgRateOut; + + public double msgThroughputOut; + + public long bytesOutCounter; + + public long msgOutCounter; + + public double msgRateRedeLiver; + + public double messageAckRate; + + public int chunkedMessageRate; + + public String consumerName; + + public int availablePermits; + + public long unackedMessages; + + public int avgMessagesPerEntry; + + public boolean blockedConsumerOnUnackedMsgs; + + public String readPositionWhenJoining; + + @JsonIgnore + private int addressOffset = -1; + + @JsonIgnore + private int addressLength; + + @JsonIgnore + private int connectedSinceOffset = -1; + + @JsonIgnore + private int connectedSinceLength; + + @JsonIgnore + private int clientVersionOffset = -1; + + @JsonIgnore + private int clientVersionLength; + + public long lastAckedTimestamp; + + public long lastConsumedTimestamp; + + public long lastConsumedFlowTimestamp; + + public List keyHashRanges; + + public Map metadata; +} diff --git a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/PartitionedTopicStats.java b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/PartitionedTopicStats.java new file mode 100644 index 0000000..ae1ba11 --- /dev/null +++ b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/PartitionedTopicStats.java @@ -0,0 +1,21 @@ +package io.github.protocol.pulsar.admin.jdk; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +import java.util.Map; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@ToString +public class PartitionedTopicStats extends TopicStats{ + + public PartitionedTopicMetadata metadata; + + public Map partitions; +} diff --git a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/ProducerAccessMode.java b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/ProducerAccessMode.java new file mode 100644 index 0000000..b341049 --- /dev/null +++ b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/ProducerAccessMode.java @@ -0,0 +1,8 @@ +package io.github.protocol.pulsar.admin.jdk; + +public enum ProducerAccessMode { + Shared, + Exclusive, + ExclusiveWithFencing, + WaitForExclusive; +} diff --git a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/PublisherStats.java b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/PublisherStats.java new file mode 100644 index 0000000..a3d74b6 --- /dev/null +++ b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/PublisherStats.java @@ -0,0 +1,63 @@ +package io.github.protocol.pulsar.admin.jdk; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +import java.util.Map; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@ToString +public class PublisherStats { + @JsonIgnore + private int count; + + public ProducerAccessMode accessMode; + + public double msgRateIn; + + public double msgThroughputIn; + + public double averageMsgSize; + + public double chunkedMessageRate; + + public long producerId; + + public boolean supportsPartialProducer; + + @JsonIgnore + private int producerNameOffset = -1; + + @JsonIgnore + private int producerNameLength; + + @JsonIgnore + private int addressOffset = -1; + + @JsonIgnore + private int addressLength; + + @JsonIgnore + private int connectedSinceOffset = -1; + + @JsonIgnore + private int connectedSinceLength; + + @JsonIgnore + private int clientVersionOffset = -1; + + @JsonIgnore + private int clientVersionLength; + + @JsonIgnore + private StringBuilder stringBuilder = new StringBuilder(); + + public Map metadata; +} diff --git a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/ReplicatorStats.java b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/ReplicatorStats.java new file mode 100644 index 0000000..7b2bc5f --- /dev/null +++ b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/ReplicatorStats.java @@ -0,0 +1,38 @@ +package io.github.protocol.pulsar.admin.jdk; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@ToString +public class ReplicatorStats { + public double msgRateIn; + + public double msgThroughputIn; + + public double msgRateOut; + + public double msgThroughputOut; + + public double msgRateExpired; + + public long replicationBacklog; + + public boolean connected; + + public long replicationDelayInSeconds; + + public String inboundConnection; + + public String inboundConnectedSince; + + public String outboundConnection; + + public String outboundConnectedSince; +} diff --git a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/SubscriptionStats.java b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/SubscriptionStats.java new file mode 100644 index 0000000..d35ec66 --- /dev/null +++ b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/SubscriptionStats.java @@ -0,0 +1,94 @@ +package io.github.protocol.pulsar.admin.jdk; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@ToString +public class SubscriptionStats { + public double msgRateOut; + + public double msgThroughputOut; + + public long bytesOutCounter; + + public long msgOutCounter; + + public double msgRateRedeLiver; + + public double messageAckRate; + + public int chunkedMessageRate; + + public int msgBacklog; + + public long backlogSize; + + public long earliestMsgPublishTimeInBacklog; + + public long msgBacklogNoDelayed; + + public boolean blockedSubscriptionOnUnackedMsgs; + + public boolean msgDelayed; + + public long unackedMessages; + + public String type; + + public String activeConsumerName; + + public double msgRateExpired; + + public long totalMsgExpired; + + public long lastExpireTimestamp; + + public long lastConsumedFlowTimestamp; + + public long lastConsumedTimestamp; + + public long lastAckedTimestamp; + + public long lastMarkDeleteAdvancedTimestamp; + + public List consumers = new ArrayList(); + + public boolean isDurable; + + public boolean isReplicated; + + public boolean allowOutOfOrderDelivery; + + public String keySharedMode; + + public Map consumesAfterMarkDeletePosition = new LinkedHashMap(); + + public int nonContiguousDeletedMessagesRanges; + + public int nonContiguousDeletedMessagesRangesSerializedSize; + + public long delayedTrackerMemoryUsage; + + public Map subsriptionProperties = new HashMap<>(); + + public long filterProcessedMsgCount; + + public long filterAcceptedMsgCount; + + public long filterRejectedMsgCount; + + public long filterRescheduledMsgCount; +} diff --git a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/TopicStats.java b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/TopicStats.java new file mode 100644 index 0000000..c3dfc3c --- /dev/null +++ b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/TopicStats.java @@ -0,0 +1,82 @@ +package io.github.protocol.pulsar.admin.jdk; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.concurrent.ConcurrentHashMap; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@ToString +public class TopicStats { + @JsonIgnore + private int count; + + public double msgRateIn; + + public double msgRateOut; + + public double msgThroughputIn; + + public double msgThroughputOut; + + public long bytesInCounter; + + public long msgInCounter; + + public long bytesOutCounter; + + public long msgOutCounter; + + public double averageMsgSize; + + public boolean msgChunkPublished; + + public long storageSize; + + public long backlogSize; + + public long earliestMsgPublishTimeInBacklogs; + + public long offloadedStorageSize; + + public long lastOffloadLedgerId; + + public long lastOffloadSuccessTimeStamp; + + public long lastOffloadFailureTimeStamp; + + private List publishers = new ArrayList(); + + private Map publishersMap = new ConcurrentHashMap<>(); + + public int waitingPublishers; + + public Map subscriptions = new HashMap(); + + public Map replication = new TreeMap(); + + public String deduplicationStatus; + + public Long topicEpoch; + + public int nonContiguousDeletedMessagesRanges; + + public int nonContiguousDeletedMessagesRangesSerializedSize; + + public int delayedMessageIndexSizeInBytes; + + public CompactionStats compaction = new CompactionStats(); + +}