Skip to content

feat(metrics): add health check status metric #9

Description

@CalvinAllen

Summary

Expose extension health status as a metric that can be monitored in dashboards. Allows operators to quickly see if extensions are healthy across a fleet of VS installations.

Proposed API

// Report health status
VsixTelemetry.ReportHealth(HealthStatus.Healthy);
VsixTelemetry.ReportHealth(HealthStatus.Degraded, "Cache connection slow");
VsixTelemetry.ReportHealth(HealthStatus.Unhealthy, "Database unreachable");

// Or with a health check function
VsixTelemetry.RegisterHealthCheck("database", () => 
{
    return database.IsConnected 
        ? HealthCheckResult.Healthy() 
        : HealthCheckResult.Unhealthy("Connection lost");
});

// Periodic health reporting (background)
VsixTelemetry.EnablePeriodicHealthReporting(interval: TimeSpan.FromMinutes(1));

Metrics Emitted

  • vs.extension.health.status (gauge: 0=unhealthy, 1=degraded, 2=healthy)
  • vs.extension.health.check.duration (histogram per check)
  • vs.extension.health.check.failures (counter)

Benefits

  • Quick visibility into extension health
  • Enables alerting on degraded status
  • Useful for monitoring dashboards
  • Follows ASP.NET Core health check patterns

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions