Skip to content

fix(dotnet-sdk): add metrics reference documenting SENTRY1001 analyzer#80

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/update-sentry-dotnet-sdk
Draft

fix(dotnet-sdk): add metrics reference documenting SENTRY1001 analyzer#80
Copilot wants to merge 2 commits intomainfrom
copilot/update-sentry-dotnet-sdk

Conversation

Copy link
Contributor

Copilot AI commented Mar 24, 2026

SDK drift from getsentry/sentry-dotnet#4840 — the .NET SDK now ships a Roslyn analyzer (SENTRY1001) that warns at compile time when metrics APIs are called with unsupported numeric types.

New: references/metrics.md

  • Metrics APIEmitCounter, EmitGauge, EmitDistribution with usage examples
  • Supported typesbyte, short, int, long, float, double; unsupported types (decimal, ulong, uint, Int128) are no-ops at runtime
  • SENTRY1001 diagnostic — trigger conditions, severity, message format, suppression guidance
  • SetBeforeSendMetric callback for filtering/modifying metrics before send
  • SentryMetric.TryGetValue<T> — type-safe value extraction (same type rules apply)
  • Config options (EnableMetrics) and 5 troubleshooting entries

Updated: SKILL.md

Added Metrics to the feature recommendation list and reference file routing table.

// ✅ Supported — no warning
SentrySdk.Metrics.EmitCounter("my.counter", 1);      // int
SentrySdk.Metrics.EmitCounter("my.counter", 1.5);    // double

// ⚠️ SENTRY1001 at compile time, no-op at runtime
SentrySdk.Metrics.EmitCounter("my.counter", 1m);         // decimal
SentrySdk.Metrics.EmitCounter("my.counter", (ulong)100); // ulong

All API names verified against getsentry/sentry-dotnet source. build-skill-tree.sh --check passes.

Original prompt

This section details on the original issue you should resolve

<issue_title>[skill-drift] sentry-dotnet-sdk may need updates</issue_title>
<issue_description>cc @getsentry/team-web-sdk-backend

SDK Changes Detected

The following PR was merged to getsentry/sentry-dotnet in the last 7 days that may affect the sentry-dotnet-sdk skill:

Potential Skill Gaps

  1. New Roslyn Analyzer: PR #4840 adds a compile-time Roslyn Diagnostic Analyzer (SENTRY1001) that warns developers when the Sentry Metrics API is called with an unsupported numeric type (e.g., ulong, decimal, System.Int128). The analyzer also warns when SentryMetric.TryGetValue(T) is called with an unsupported type.

    Supported numeric types are: long, float, double, and 64-bit signed integral types.

    The skill's metrics reference does not document:

    • The SENTRY1001 diagnostic and what triggers it
    • The supported numeric types for EmitCounter, EmitGauge, EmitDistribution
    • The SetBeforeSendMetric callback (referenced in the PR as context for the analyzer)
    // This will produce SENTRY1001 at compile time:
    SentrySdk.Metrics.EmitCounter("my.counter", 1m);          // decimal — not supported
    SentrySdk.Metrics.EmitCounter("my.counter", (ulong)100);  // ulong — not supported
    
    // These are fine:
    SentrySdk.Metrics.EmitCounter("my.counter", 1);    // int → long
    SentrySdk.Metrics.EmitCounter("my.counter", 1.5f); // float
    SentrySdk.Metrics.EmitCounter("my.counter", 1.5);  // double

Skill Files to Review

  • skills/sentry-dotnet-sdk/SKILL.md

Priority

LOW — Developer tooling improvement (compile-time diagnostic) that improves DX but doesn't change runtime behavior. Useful to document so users understand why they see this diagnostic.

Generated by SDK Skill Drift Detector ·

  • expires on Apr 6, 2026, 11:02 PM UTC

Comments on the Issue (you are @copilot in this section)

Custom agent used: skill-updater
Expert Sentry SDK skill author that updates and creates SDK skill bundles. Specializes in researching SDK changes, verifying APIs against official docs and source code, and producing high-quality wizard flows with deep-dive reference files. Use when updating skills after SDK changes, creating new skills for new platforms, or fixing skill drift issues.


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Add references/metrics.md documenting:
- EmitCounter, EmitGauge, EmitDistribution API
- Supported numeric types (byte, short, int, long, float, double)
- SENTRY1001 Roslyn diagnostic analyzer
- SetBeforeSendMetric callback
- SentryMetric.TryGetValue<T>
- EnableMetrics config option

Update SKILL.md to include Metrics in feature recommendations
and reference file table.

Addresses getsentry/sentry-dotnet#4840

Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>

Co-authored-by: HazAT <363802+HazAT@users.noreply.github.com>
Agent-Logs-Url: https://github.com/getsentry/sentry-for-ai/sessions/a7f23faf-52d2-4883-89e9-a8846d16dd40
Copilot AI changed the title [WIP] Update sentry-dotnet-sdk for new Roslyn analyzer fix(dotnet-sdk): add metrics reference documenting SENTRY1001 analyzer Mar 24, 2026
Copilot AI requested a review from HazAT March 24, 2026 15:51
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.

[skill-drift] sentry-dotnet-sdk may need updates

2 participants