Skip to content

Implement Customer Facing Statsbeat #41669

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

Merged
merged 17 commits into from
Jul 8, 2025

Conversation

rads-1996
Copy link
Member

Description

Implement customer facing statsbeat as a preview feature.

Packages impacted by this PR

@azure/monitor-opentelemetry-exporter

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@Copilot Copilot AI review requested due to automatic review settings June 19, 2025 19:38
@github-actions github-actions bot added the Monitor - Exporter Monitor OpenTelemetry Exporter label Jun 19, 2025
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

Implements preview support for customer-facing Statsbeat by integrating metric tracking into the exporter and local storage, and adding unit/integration tests.

  • Hooks CustomerStatsbeatMetrics into the base exporter to count successful, dropped, and retried items.
  • Enhances LocalFileStorage.put and get_items to emit Statsbeat metrics on storage errors, capacity, and expiry.
  • Adds comprehensive tests for metrics collection and backend integration, plus updates constants and changelog.

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
azure/monitor/opentelemetry/exporter/export/_base.py Integrated customer statsbeat initialization and tracking in the transmission flow.
azure/monitor/opentelemetry/exporter/_storage.py Extended storage to set and use customer_statsbeat_metrics for recording storage-related drops.
tests/statsbeat/test_customer_statsbeat_metrics.py New unit tests covering success, drop, and retry counting methods.
tests/statsbeat/test_customer_statsbeat_integration.py New integration tests verifying end-to-end metric export and failure handling.
tests/statsbeat/test_customer_statsbeat.py Simplified initialization tests and disabled-mode behavior.
azure/monitor/opentelemetry/exporter/statsbeat/_customer_statsbeat_types.py Defined new types and counters for customer Statsbeat.
azure/monitor/opentelemetry/exporter/statsbeat/init.py Lazy-import setup for CustomerStatsbeatMetrics.
azure/monitor/opentelemetry/exporter/_constants.py Added environment variable constant for enabling preview.
CHANGELOG.md Documented the preview feature under 1.0.0b36.

Copy link

github-actions bot commented Jun 19, 2025

API Change Check

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

azure-monitor-opentelemetry-exporter

@rads-1996 rads-1996 force-pushed the rads-1996/customer-facing-statsbeat branch from 8d7b027 to 916f0ba Compare July 2, 2025 18:54
@rads-1996
Copy link
Member Author

@lzchen I discovered that the envelope names and the base_type to determine the type of telemetry are a bit different. The envelope names are usually of the format - "Microsoft.ApplicationInsights.RemoteDependency", whereas the base_type is "RemoteDependencyData", that is with the suffix "data". I saw that although the envelope names are added to _constants.py, the base_type is hardcoded. I found this code from _exporter.py -

image

In the follow up PR, should I add the constants for base_type and use it in both customer statsbeat and the regular statsbeat. For now I have added the _REMOTE_DEPENDENCY_ENVELOPE_DATA in _constants.py.

Copy link
Member

@lzchen lzchen left a comment

Choose a reason for hiding this comment

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

LGTM! Great job on this!

@rads-1996 rads-1996 merged commit 2fc8535 into Azure:main Jul 8, 2025
19 checks passed
@rads-1996 rads-1996 deleted the rads-1996/customer-facing-statsbeat branch July 8, 2025 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Monitor - Exporter Monitor OpenTelemetry Exporter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants