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

Make use of consumer_lag in dashboard #14863

Merged
merged 9 commits into from
Dec 4, 2019

Conversation

ChrsMark
Copy link
Member

@ChrsMark ChrsMark commented Nov 29, 2019

This PR updates the Kafka Consumer Group Lag vs Time [Metricbeat Kafka] ECS visualisation to make use of the consumer_lag field added on #14822.

Screenshot 2019-12-04 at 19 00 12

This may resolve_ #3608

Manual Testing

Note: Manual testing can be tricky since this requires an actual Kafka setup with consumer/producers.

An easy way to manual test this is to make use of the container we provide for the integration tests.

Start a Kafka service using the testing container: https://github.com/elastic/beats/blob/master/metricbeat/module/kafka/_meta/Dockerfile

One can run the tests in order to bring up the container like go test -v -tags=integration github.com/elastic/beats/metricbeat/module/kafka/partition.

Verify that tests are successful and you can go on to manual testing. After the tests have finished the container is still alive so we can use it for the manual testing too.

Check what are the exported ports from Docker with a docker ps:

5da9631cfa25        docker.elastic.co/observability-ci/beats-integration-kafka:2.1.1-1   "/run.sh"           23 minutes ago      Up 23 minutes (healthy)   2181/tcp, 0.0.0.0:32771->8774/tcp, 0.0.0.0:32770->8775/tcp, 0.0.0.0:32769->8779/tcp, 0.0.0.0:32768->9092/tcp   metricbeat_kafka_1

Kafka Module configuration

In Kafka module configuration make use of the testing creds -> https://github.com/elastic/beats/blob/master/metricbeat/module/kafka/consumergroup/consumergroup_integration_test.go#L38

The config should look like:

- module: kafka
  metricsets:
    - partition
    - consumergroup
  period: 10s
  hosts: ["0.0.0.0:32784"]
  username: stats
  password: test-secret

Where 0.0.0.0:32784 comes from the port mapping of Docker like: 0.0.0.0:32784->9092/tcp, use docker ps to see which the mapped port to the host network.

Sample producer/consumer pairs

In order to populate consumer lag data exec into the Kafka container and spawn 2 pairs of consumer/producer like:
Producer:
{ while sleep 1; do echo message; done } | KAFKA_OPTS="-Djava.security.auth.login.config=/kafka/bin/jaas-kafka-client-producer.conf" /kafka/bin/kafka-console-producer.sh --topic test2 --broker-list localhost:9091 --producer.config /kafka/bin/sasl-producer.properties
https://github.com/elastic/beats/blob/master/metricbeat/module/kafka/_meta/run.sh#L76
Consumer:
KAFKA_OPTS="-Djava.security.auth.login.config=/kafka/bin/jaas-kafka-client-consumer.conf" /kafka/bin/kafka-console-consumer.sh --topic=test2 --bootstrap-server=localhost:9091 --consumer.config /kafka/bin/sasl-producer.properties
https://github.com/elastic/beats/blob/master/metricbeat/module/kafka/_meta/run.sh#L82

After that the data in the dashboard is expected to be populated accordingly.

@ChrsMark ChrsMark requested a review from a team as a code owner November 29, 2019 14:37
@ChrsMark ChrsMark self-assigned this Nov 29, 2019
Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo in the PR title and description. I'm raising it just to prevent from any copy-paste bugs.

BTW. do you plan to update PNG screenshots?

@ChrsMark ChrsMark changed the title Make use of conusmer_lag in dashboard Make use of consumer_lag in dashboard Dec 2, 2019
@ChrsMark ChrsMark requested a review from jsoriano December 2, 2019 10:16
Signed-off-by: chrismark <[email protected]>
@ChrsMark ChrsMark force-pushed the fix_consumer_lag_visualization branch from b52307b to b7dee38 Compare December 2, 2019 10:26
Signed-off-by: chrismark <[email protected]>
@ChrsMark ChrsMark added the v7.6.0 label Dec 4, 2019
@jsoriano jsoriano added the test-plan Add this PR to be manual test plan label Dec 4, 2019
Signed-off-by: chrismark <[email protected]>
Signed-off-by: chrismark <[email protected]>
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ChrsMark ChrsMark merged commit dd99d7e into elastic:master Dec 4, 2019
ChrsMark added a commit to ChrsMark/beats that referenced this pull request Dec 5, 2019
ChrsMark added a commit that referenced this pull request Dec 5, 2019
@andresrc andresrc assigned sayden and unassigned ChrsMark Jan 14, 2020
@sayden sayden added the test-plan-ok This PR passed manual testing label Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Dashboards Metricbeat Metricbeat review Team:Integrations Label for the Integrations team test-plan Add this PR to be manual test plan test-plan-ok This PR passed manual testing v7.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants