DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Confusion Matrix vs. ROC Curve: When to Use Which for Model Evaluation
  • Building Product to Learn AI, Part 3: Taste Testing and Evaluating
  • Kafka-Streams - Tips on How to Decrease Re-Balancing Impact for Real-Time Event Processing On Highly Loaded Topics
  • 4 Key Observability Metrics for Distributed Applications

Trending

  • The Evolution of Scalable and Resilient Container Infrastructure
  • Supervised Fine-Tuning (SFT) on VLMs: From Pre-trained Checkpoints To Tuned Models
  • Chat With Your Knowledge Base: A Hands-On Java and LangChain4j Guide
  • Traditional Testing and RAGAS: A Hybrid Strategy for Evaluating AI Chatbots
  1. DZone
  2. Data Engineering
  3. Big Data
  4. What Is the Difference Between Metrics and Events?

What Is the Difference Between Metrics and Events?

We gather all types of data from our systems when we adopt monitoring technologies and tools.

By 
Katy Farmer user avatar
Katy Farmer
·
Mar. 18, 19 · Analysis
Likes (3)
Comment
Save
Tweet
Share
6.9K Views

Join the DZone community and get the full member experience.

Join For Free

We gather all types of data from our systems when we adopt monitoring technologies and tools. We might, for example, want to see application metrics, database logs, and network traffic side-by-side. We don't always talk about the differences in these types of data, so today we're covering a question I get asked most often: what is the difference between metrics and events?

Image title

See if you can spot the differences!

Technical Differences

Metrics and events are two different types of time series data: regular and irregular, respectively. Regular data (metrics) are evenly distributed across time and can be used for processes like forecasting. Irregular data (events) are unpredictable, and while they still occur in temporal order, the intervals between events are inconsistent, which means that using them for forecasting or averaging could lead to unreliable results.

The basic difference is metrics occur at regular intervals and events don't. Imagine I'm monitoring my personal website — I want to track the response codes to make sure the site is available, so I collect them at frequent intervals. I could then query those response code metrics to figure out what percentage of the time my site was down (because it was too popular). But I also want to know when a user clicks on an ad. I don't know when or if this click will happen, so collecting at a regular interval doesn't make sense. If I have 12 clicks for the past year, the average will be one click a month regardless if they could have all happened October (the peak of my popularity).

Image title

It’s time series meets gossip!

In order to use event data for forecasting or averages, it has to be transformed into regular data. If you're interested in modeling time series data, I recommend reading this blog on shaping and analyzing your data. If you're using InfluxDB, you can see an example of working with irregular time series data here.

Because metrics and events are different types of data, this changes how the database can efficiently store and compress the data being ingested (e.g. different compression algorithms might be needed for different types of data). This is why at InfluxDB, we emphasize the ability to track both metrics and events — not every system can do both, and not every system is optimized for both. Ideally, our database does its job, and we don't have to worry about the ways it handles data. We can send metrics and events into InfluxDB without knowing or caring about how the database differentiates between the two.

Practical Differences

The way we can interact with data changes depending on whether it's regular or irregular, so sometimes we do need to know whether the data we're collecting are metrics or events. For example, metrics can be used for aggregates since we have data that is evenly spaced across time. We don't want to use irregular data to find aggregates because they won't be distributed across time evenly, and they'll return some useless results.

Monitoring Metrics and Events

I want to keep track of my piggy bank closely. Right now, there's only one metric I care about: total funds. Anyone can put money into my piggy bank, so I want to report the total funds at a one-minute interval. This means that every minute, my database will receive a data point with the timestamp and the number of total funds in my piggy bank.

Image title

Her name is Oinky and she is a fine accountant.

Now, I want to track specific events for my piggy bank: deposits and withdrawals. When a deposit occurs, my database will receive a data point with the "deposit" tag, the timestamp, and the amount of the deposit. Similarly, when a withdrawal occurs, my database will receive a data point with the "withdrawal" tag, the timestamp, and the amount of the withdrawal.

This very simple dataset makes sure that the total funds reported by my piggy bank match the total deposits and withdrawals. This is the same way my parents balanced their checkbook and the same way I used to close out the cash register during my retail career.

Imagine now that this is the same basic idea behind online banking. We could add more metadata to add detail to the events, like attaching a user ID to a deposit or withdrawal.

Conclusion

Metrics and events are complementary. The ability to monitor both is more necessary than ever, and it shouldn't take a data scientist to be able to do it (data scientists are pretty cool though).

Original artwork by Katy Farmer.
Event Metric (unit) Data science

Published at DZone with permission of Katy Farmer, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Confusion Matrix vs. ROC Curve: When to Use Which for Model Evaluation
  • Building Product to Learn AI, Part 3: Taste Testing and Evaluating
  • Kafka-Streams - Tips on How to Decrease Re-Balancing Impact for Real-Time Event Processing On Highly Loaded Topics
  • 4 Key Observability Metrics for Distributed Applications

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!