To view the detailed information about a single topic, you can use the Google Cloud console, the Google Cloud CLI, the client library, the Managed Kafka API, or the open source Apache Kafka APIs.
Required roles and permissions to view a topic
To get the permissions that you need to view a topic,
ask your administrator to grant you the
Managed Kafka Viewer (roles/managedkafka.viewer
) IAM role on your project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
This predefined role contains the permissions required to view a topic. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to view a topic:
-
List topics:
managedkafka.topics.list
-
Get topic:
managedkafka.topics.get
You might also be able to get these permissions with custom roles or other predefined roles.
For more information about the Managed Kafka Viewer (roles/managedkafka.viewer
) IAM role,
see Managed Service for Apache Kafka predefined roles.
Topic properties in the console
In the console, you can view the following topic properties:
Configurations: This tab provides general configuration details about the topic, including the following:
Name: The unique identifier of the topic within the cluster.
Partitions: The number of partitions in the topic. Partitions divide the topic's data into segments for scalability and parallelism.
Replicas: The number of copies (replicas) maintained for each partition to ensure data redundancy and availability.
Cluster: The name of the Managed Service for Apache Kafka cluster to which the topic belongs.
Region: The Google Cloud region where the cluster and the topic is located.
Non-default topic parameters: Any topic-level configuration overrides that have been set for the topic, different from the cluster-wide defaults.
Monitoring: This tab provides visual charts that display key metrics related to the topic's activity and performance. These charts include the following:
Byte count: A time-series chart showing the rate at which bytes are produced or sent to the topic. This indicates the volume of data published to the topic over time. The corresponding metric is
managedkafka.googleapis.com/byte_in_count
.Request count: A time-series chart representing the rate of requests made to the topic. It reflects the overall activity and usage of the topic. The related metric is
managedkafka.googleapis.com/topic_request_count
.Log segments by partition: This chart displays the number of active log segments for each partition within the topic. Log segments are the physical files on disk where Kafka stores the topic data. The relevant metric is
managedkafka.googleapis.com/log_segments
.
Consumer groups: This section lists the consumer groups that are subscribed to the topic. A consumer group is a set of consumers that work together to read messages from the topic.
View a topic
Console
In the Google Cloud console, go to the Clusters page.
The clusters that you created in a project are listed.
- Click the cluster for which you want to see the topics.
The cluster details page is displayed. In the cluster details page, for the Resources tab, the topics are listed.
- To view a specific topic, click the topic name.
The topic details page is displayed.
gcloud
-
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
Run the
gcloud managed-kafka topics describe
command:gcloud managed-kafka topics describe TOPIC_ID \ --cluster=CLUSTER_ID --location=LOCATION_ID
This command fetches and displays comprehensive details about the specified topic. This information includes its configuration settings, such as the number of partitions, replication factor, and any topic-level configuration overrides.
Replace the following:
TOPIC_ID: The ID of the topic.
CLUSTER_ID: The ID of the cluster containing the topic.
LOCATION_ID: The location of the cluster.