@page "/"
@inject ILogger<Home> Logger

<PageTitle>Home</PageTitle>

<h1>Blazor Server App - Grafana Observability Demo</h1>

<p>Welcome! This application is configured with:</p>

<ul>
    <li><strong>Serilog</strong> - Structured logging</li>
    <li><strong>Application Insights</strong> - Azure native monitoring</li>
    <li><strong>OpenTelemetry</strong> - Distributed tracing</li>
    <li><strong>Prometheus</strong> - Metrics endpoint at <code>/metrics</code></li>
</ul>

<h2>Available Endpoints</h2>

<ul>
    <li><code>/health</code> - Health check endpoint</li>
    <li><code>/metrics</code> - Prometheus metrics</li>
</ul>

<div class="alert alert-info mt-4">
    <h4>Getting Started with Grafana</h4>
    <p>To visualize this data in Grafana:</p>
    <ol>
        <li>Add Prometheus as a data source pointing to this app's <code>/metrics</code> endpoint</li>
        <li>Add Azure Monitor as a data source for Application Insights</li>
        <li>Create dashboards to visualize your metrics and logs</li>
    </ol>
</div>

<button class="btn btn-primary" @onclick="LogTestMessage">Generate Test Log</button>

@code {
    private void LogTestMessage()
    {
        Logger.LogInformation("Test log message generated from Home page at {Timestamp}", DateTime.UtcNow);
        Logger.LogWarning("This is a warning message for testing");
    }
}
