Book Image

Learning Apache Flink

By : Tanmay Deshpande
Book Image

Learning Apache Flink

By: Tanmay Deshpande

Overview of this book

<p>With the advent of massive computer systems, organizations in different domains generate large amounts of data on a real-time basis. The latest entrant to big data processing, Apache Flink, is designed to process continuous streams of data at a lightning fast pace.</p> <p>This book will be your definitive guide to batch and stream data processing with Apache Flink. The book begins with introducing the Apache Flink ecosystem, setting it up and using the DataSet and DataStream API for processing batch and streaming datasets. Bringing the power of SQL to Flink, this book will then explore the Table API for querying and manipulating data. In the latter half of the book, readers will get to learn the remaining ecosystem of Apache Flink to achieve complex tasks such as event processing, machine learning, and graph processing. The final part of the book would consist of topics such as scaling Flink solutions, performance optimization and integrating Flink with other tools such as ElasticSearch.</p> <p>Whether you want to dive deeper into Apache Flink, or want to investigate how to get more out of this powerful technology, you’ll find everything you need inside.</p>
Table of Contents (17 chapters)
Learning Apache Flink
About the Author
About the Reviewers
Customer Feedback


Flink supports a metrics system which allows users to know more about the Flink setup and the applications running on it. This would be very useful if you are using Flink in a very big production system where a huge number of jobs are running and we need to get details of each. We can also use these to feed external monitoring systems. So let's try to understand what is available and how to use them.

Registering metrics

Metric functions are available for use from any user function which extends RichFunction by calling getRuntimeContext().getMetricGroup(). These methods return a MetricGroup object, which can be used to create and register a new metric.

Flink supports various metrics types, such as:

  • Counters

  • Gauges

  • Histograms

  • Meters


A counter can be used to count certain things while processing. A simple use of a counter can be to count invalid records in the data. You can choose to either increment or decrement the counter, based on the conditions. The following code snippet shows...