新增 EF Core 数据库拦截器,记录耗时、失败数、慢查询数、TraceId、查询标签和 SQL 哈希;默认不记录完整 SQL及参数。 未配置 OTLP Collector 时不启动 SDK,避免无收益的性能开销。 为课表的作息、课程、灵活课程、考试、实验等六类查询增加稳定标签。 增加可配置的 500ms 慢查询阈值,以及生产环境变量示例。 README 补充 MySQL 慢查询与 EXPLAIN ANALYZE 操作规范。
13 lines
429 B
C#
13 lines
429 B
C#
namespace Jiaowu.Api.Infrastructure.Observability;
|
|
|
|
public sealed class ObservabilityOptions
|
|
{
|
|
public const string SectionName = "Observability";
|
|
|
|
public bool Enabled { get; set; } = true;
|
|
public string ServiceName { get; set; } = "jiaowu-api";
|
|
public int SlowQueryThresholdMilliseconds { get; set; } = 500;
|
|
public bool IncludeSqlText { get; set; }
|
|
public int MaximumSqlTextLength { get; set; } = 2000;
|
|
}
|