Implement MongoDB-based storage for Pack Run approval, artifact, log, and state management
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
- Added MongoPackRunApprovalStore for managing approval states with MongoDB. - Introduced MongoPackRunArtifactUploader for uploading and storing artifacts. - Created MongoPackRunLogStore to handle logging of pack run events. - Developed MongoPackRunStateStore for persisting and retrieving pack run states. - Implemented unit tests for MongoDB stores to ensure correct functionality. - Added MongoTaskRunnerTestContext for setting up MongoDB test environment. - Enhanced PackRunStateFactory to correctly initialize state with gate reasons.
This commit is contained in:
@@ -13,7 +13,10 @@ public sealed class AdvisoryPipelineMetrics : IDisposable
|
||||
private readonly Counter<long> _plansProcessed;
|
||||
private readonly Counter<long> _outputsStored;
|
||||
private readonly Counter<long> _guardrailBlocks;
|
||||
private readonly Counter<long> _validationFailures;
|
||||
private readonly Histogram<double> _planBuildDuration;
|
||||
private readonly Histogram<double> _pipelineLatencySeconds;
|
||||
private readonly Histogram<double> _citationCoverageRatio;
|
||||
private bool _disposed;
|
||||
|
||||
public AdvisoryPipelineMetrics(IMeterFactory meterFactory)
|
||||
@@ -25,8 +28,11 @@ public sealed class AdvisoryPipelineMetrics : IDisposable
|
||||
_plansQueued = _meter.CreateCounter<long>("advisory_plans_queued");
|
||||
_plansProcessed = _meter.CreateCounter<long>("advisory_plans_processed");
|
||||
_outputsStored = _meter.CreateCounter<long>("advisory_outputs_stored");
|
||||
_guardrailBlocks = _meter.CreateCounter<long>("advisory_guardrail_blocks");
|
||||
_guardrailBlocks = _meter.CreateCounter<long>("advisory_ai_guardrail_blocks_total");
|
||||
_validationFailures = _meter.CreateCounter<long>("advisory_ai_validation_failures_total");
|
||||
_planBuildDuration = _meter.CreateHistogram<double>("advisory_plan_build_duration_seconds");
|
||||
_pipelineLatencySeconds = _meter.CreateHistogram<double>("advisory_ai_latency_seconds");
|
||||
_citationCoverageRatio = _meter.CreateHistogram<double>("advisory_ai_citation_coverage_ratio");
|
||||
}
|
||||
|
||||
public void RecordPlanCreated(double buildSeconds, AdvisoryTaskType taskType)
|
||||
@@ -55,12 +61,40 @@ public sealed class AdvisoryPipelineMetrics : IDisposable
|
||||
KeyValuePair.Create<string, object?>("guardrail_blocked", guardrailBlocked));
|
||||
}
|
||||
|
||||
public void RecordGuardrailResult(AdvisoryTaskType taskType, bool blocked)
|
||||
public void RecordGuardrailOutcome(AdvisoryTaskType taskType, bool blocked, int validationFailures)
|
||||
{
|
||||
if (blocked)
|
||||
{
|
||||
_guardrailBlocks.Add(1, KeyValuePair.Create<string, object?>("task_type", taskType.ToString()));
|
||||
}
|
||||
|
||||
if (validationFailures > 0)
|
||||
{
|
||||
_validationFailures.Add(
|
||||
validationFailures,
|
||||
KeyValuePair.Create<string, object?>("task_type", taskType.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
public void RecordPipelineLatency(AdvisoryTaskType taskType, double seconds, bool planFromCache)
|
||||
{
|
||||
_pipelineLatencySeconds.Record(
|
||||
seconds,
|
||||
KeyValuePair.Create<string, object?>("task_type", taskType.ToString()),
|
||||
KeyValuePair.Create<string, object?>("plan_cache_hit", planFromCache));
|
||||
}
|
||||
|
||||
public void RecordCitationCoverage(
|
||||
AdvisoryTaskType taskType,
|
||||
double coverageRatio,
|
||||
int citationCount,
|
||||
int structuredChunkCount)
|
||||
{
|
||||
_citationCoverageRatio.Record(
|
||||
coverageRatio,
|
||||
KeyValuePair.Create<string, object?>("task_type", taskType.ToString()),
|
||||
KeyValuePair.Create<string, object?>("citations", citationCount),
|
||||
KeyValuePair.Create<string, object?>("structured_chunks", structuredChunkCount));
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
Reference in New Issue
Block a user