Skip to content

Conversation

hectorhdzg
Copy link
Member

Packages impacted by this PR

@azure/monitor-opentelemetry-exporter

Adding support for RateLimitedSampler, inspired by Java Application Insights sampler
https://github.com/microsoft/ApplicationInsights-Java/blob/main/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/sampling/RateLimitedSamplingPercentage.java

Copy link

github-actions bot commented Jun 18, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

@azure/monitor-opentelemetry-exporter
@azure/monitor-opentelemetry

@hectorhdzg hectorhdzg marked this pull request as ready for review June 24, 2025 18:20
@Copilot Copilot AI review requested due to automatic review settings June 24, 2025 18:20
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for a new RateLimitedSampler to better control sampling rates, inspired by the Java Application Insights sampler.

  • Updated import references to use the new percentage-based sampler implementation.
  • Added a new RateLimitedSampler class and accompanying tests along with updates to API documentation and changelog.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sdk/monitor/monitor-opentelemetry-exporter/test/internal/sampling.spec.ts Updated import for ApplicationInsightsSampler to reference the new percentageSampler implementation.
sdk/monitor/monitor-opentelemetry-exporter/test/internal/rateLimitedSampler.spec.ts Added comprehensive tests for the new RateLimitedSampler.
sdk/monitor/monitor-opentelemetry-exporter/src/utils/metricUtils.ts Adjusted import style to align with type-only imports and value imports for constants.
sdk/monitor/monitor-opentelemetry-exporter/src/sampling/samplingUtils.ts Introduced utility functions for sampling calculations.
sdk/monitor/monitor-opentelemetry-exporter/src/sampling/rateLimitedSampler.ts Implemented RateLimitedSampler with state management and sampling logic.
sdk/monitor/monitor-opentelemetry-exporter/src/sampling/percentageSampler.ts Updated import paths and removed redundant internal hash function.
sdk/monitor/monitor-opentelemetry-exporter/src/index.ts Updated exports to include the new RateLimitedSampler.
sdk/monitor/monitor-opentelemetry-exporter/review/monitor-opentelemetry-exporter.api.md Updated API documentation to include public RateLimitedSampler APIs.
sdk/monitor/monitor-opentelemetry-exporter/CHANGELOG.md Documented the addition of RateLimitedSampler under features added.

…mitedSampler.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@hectorhdzg hectorhdzg changed the title [monitor-opentelemetry-exporter] Add RateLimitedSampler [monitor-opentelemetry] Add RateLimitedSampler Jun 25, 2025
@hectorhdzg hectorhdzg merged commit dfe63da into Azure:main Jul 24, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants