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

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • API Analytics: Unleashing the Power of Data-Driven Insights for Enhanced API Management
  • The Rising Risks and Opportunities in API Security
  • Power BI Embedded Analytics — Part 1.1: Power BI Authoring Data Federation
  • Power BI Embedded Analytics — Part 1: Introduction and Power BI Authoring Overview

Trending

  • Recurrent Workflows With Cloud Native Dapr Jobs
  • A Modern Stack for Building Scalable Systems
  • Streamlining Event Data in Event-Driven Ansible
  • Mastering Fluent Bit: Installing and Configuring Fluent Bit on Kubernetes (Part 3)
  1. DZone
  2. Data Engineering
  3. Data
  4. What Is Dynamic Sampling and How It Works

What Is Dynamic Sampling and How It Works

Sometimes you may want to limit the amount of analytics data coming into your API management program. Learn to optimize your data with dynamic sampling!

By 
Dylan Frankcom user avatar
Dylan Frankcom
·
Nov. 08, 23 · Analysis
Likes (2)
Comment
Save
Tweet
Share
1.9K Views

Join the DZone community and get the full member experience.

Join For Free

Sometimes you may want to limit the amount of analytics data coming into your API management tool. This could be because you want to exclude specific traffic, such as internal or health check traffic, or you may want to reduce unnecessary data to control cost. Dynamic sampling does just this. Dynamic sampling lets you control which API calls are logged to your API management tool based on customer or API behavior. Intelligently extrapolate metrics for accurate reporting even with multiple sample rates so that no matter what rules or sample rates you have set up, you can be sure you are still seeing an accurate representation of your data.

Dynamic sampling is controlled by setting up sampling rules in the API management tool's dashboard. You can create rules based on criteria such as request path, response status codes, user or company behaviors, and more. You can also control the applied sample rate for each rule. The sample rate is the percentage of events that will make their way into your API management tool. For example, if you set a rule to sample 50% of events, your management tool will log half of the matching events intelligently (and not just log every other event to meet the 50% sampling rate).

Why Use Dynamic Sampling?

Dynamic sampling serves two use cases:

  • Gives users the capability to trim down excessive or uninteresting calls populating while retaining the insight you gain from the platform.
  • Allows users to reduce subscription costs and save money. 

When Not to Use Dynamic Sampling

It would be best if you avoided dynamic sampling on specific events moving into your API management tool. 

Dynamically sampling the number of API calls coming into your API management tool would impact a monetized API because it would fail to track the exact usage, likely missing some events depending on the sampling rate applied. This will affect your billing meters and the invoices being sent to customers. However, a way around this is to apply dynamic sampling to endpoints that are not monetized and let events counted within your Billing Meter sample at 100%.

Another reason not to use dynamic sampling is when your logged API calls are less than the number of calls your subscription plan supports. For example, suppose you are making fewer API calls than your subscription plan includes. In that case, dynamic sampling is unnecessary unless you are simply trying to exclude data you don’t want in your management tool to keep data cleaner. Examples of this may be not including traffic from health check probes or internal testing.

Four Types of Sample Rates

Dynamic sampling rules are categorized into four kinds of sample sets and are prioritized in the following manner:

  • Sample rates for a single user or company
  • Sample rates based on regex rules
  • Sample rates based on user behaviors and demographics (Saved Cohorts)
  • Sample rates applied globally

This means that if a sample rate is set for a specific customer, this will take priority over a sample rate associated with a behavioral cohort that a customer belongs to. Global sample rates have the lowest priority and are, by default, set to 100% for all customers. If an API call matches multiple rules, it gets processed by the first kind of sample rate in the prioritization hierarchy.

In conclusion, utilizing dynamic sampling for API products offers a smart and effective strategy to maximize the benefits of your API offerings. By adapting to evolving data requirements and usage patterns in real-time, dynamic sampling ensures resource efficiency, cost control, and responsive performance, all while maintaining data security and compliance. This approach not only enhances user experience but also positions your users to harness the full potential of your API in a sustainable and agile manner, making it a crucial tool for the success of modern API products.

API Analytics Data (computing)

Published at DZone with permission of Dylan Frankcom. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • API Analytics: Unleashing the Power of Data-Driven Insights for Enhanced API Management
  • The Rising Risks and Opportunities in API Security
  • Power BI Embedded Analytics — Part 1.1: Power BI Authoring Data Federation
  • Power BI Embedded Analytics — Part 1: Introduction and Power BI Authoring Overview

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!