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

Implementation of Metric Explorer #86

Merged
merged 14 commits into from
Nov 11, 2021
33 changes: 29 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,25 +128,50 @@ This project offers a way to run kafka official tool by container. For example:

---

## Kafka Metric Client
## Kafka Metric Explorer

This tool can be used to access Kafka's MBean metrics via JMX.

Run the tool from source code

```shell
# fetch every Mbeans from specific JMX server.
./gradlew run --args="metrics --jmx.server 192.168.50.178:1099"

# fetch any Mbean that its object name contains property "type=Memory".
./gradlew run --args="metrics --jmx.server 192.168.50.178:1099 --property type=Memory"

# fetch any Mbean that belongs to "kafka.network" domain name,
# and it's object name contains two properties "request=Metadata" and "name=LocalTimeMs".
./gradlew run --args="metrics --jmx.server 192.168.50.178:1099 --domain kafka.network --property request=Metadata --property name=LocalTimeMs"

# list all Mbeans' object name on specific JMX server.
./gradlew run --args="metrics --jmx.server 192.168.50.178:1099 --view-object-name-list"
```

Run the tool from release
```shell
# fetch every Mbeans from specific JMX server.
java -jar app-0.0.1-SNAPSHOT-all.jar metrics --jmx.server 192.168.50.178:1099

# fetch any Mbean that its object name contains property "type=Memory".
java -jar app-0.0.1-SNAPSHOT-all.jar metrics --jmx.server 192.168.50.178:1099 --property type=Memory

# fetch any Mbean that belongs to "kafka.network" domain name,
# and it's object name contains two properties "request=Metadata" and "name=LocalTimeMs".
java -jar app-0.0.1-SNAPSHOT-all.jar metrics --jmx.server 192.168.50.178:1099 --domain kafka.network --property request=Metadata --property name=LocalTimeMs

# list all Mbeans' object name on specific JMX server.
java -jar app-0.0.1-SNAPSHOT-all.jar metrics --jmx.server 192.168.50.178:1099 --view-object-name-list
```

### Metric Client Configurations
### Metric Explorer Configurations

1. --jmx.server: the address to connect to Kafka JMX remote server
2. --metrics: the Mbean metric to fetch. Default: All metrics
1. --jmx.server: the address to connect to Kafka JMX remote server.
2. --domain: query Mbeans from the specific domain name (support wildcard "\*" and "?"). Default: "\*".
3. --property: query mbeans with the specific property (support wildcard "\*" and "?"). You can specify this argument multiple times. Default: [].
4. --strict-match: only Mbeans with its object name completely match the given criteria shows. Default: false.
5. --view-object-name-list: show the list view of MBeans' domain name & properties. Default: false.

---

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/astraea/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.astraea.metrics.KafkaMetricClientApp;
import org.astraea.metrics.MetricExplorer;
import org.astraea.performance.Performance;
import org.astraea.topic.ReplicaCollie;
import org.astraea.topic.TopicExplorer;
Expand All @@ -14,7 +14,7 @@ public class App {
private static final Map<String, Class<?>> MAIN_CLASSES =
Map.of(
"offset", TopicExplorer.class,
"metrics", KafkaMetricClientApp.class,
"metrics", MetricExplorer.class,
"replica", ReplicaCollie.class,
"performance", Performance.class);

Expand Down
88 changes: 0 additions & 88 deletions app/src/main/java/org/astraea/metrics/KafkaMetricClientApp.java

This file was deleted.

Loading