version-0.1 (#1)
Squash and merge of version-0.1 Co-authored-by: James Wampler <james@wamp.dev> Co-committed-by: James Wampler <james@wamp.dev>
This commit was merged in pull request #1.
This commit is contained in:
10
src/api/MicCheck.Api/Features/FeatureEvaluationService.cs
Normal file → Executable file
10
src/api/MicCheck.Api/Features/FeatureEvaluationService.cs
Normal file → Executable file
@@ -8,7 +8,8 @@ namespace MicCheck.Api.Features;
|
||||
public class FeatureEvaluationService(
|
||||
MicCheckDbContext db,
|
||||
SegmentEvaluator segmentEvaluator,
|
||||
FlagCache flagCache)
|
||||
FlagCache flagCache,
|
||||
FeatureUsageMetrics usageMetrics)
|
||||
{
|
||||
public async Task<IReadOnlyList<FeatureStateResult>> EvaluateForEnvironmentAsync(
|
||||
int environmentId, CancellationToken ct = default)
|
||||
@@ -32,6 +33,10 @@ public class FeatureEvaluationService(
|
||||
).ToListAsync(ct);
|
||||
|
||||
flagCache.Set(environmentId, results);
|
||||
|
||||
foreach (var r in results)
|
||||
usageMetrics.RecordEvaluation(environmentId, r.Feature.Id, r.Feature.Name);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -134,6 +139,9 @@ public class FeatureEvaluationService(
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var r in results)
|
||||
usageMetrics.RecordEvaluation(environmentId, r.Feature.Id, r.Feature.Name);
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user