11using FaasNet . Gateway . Core . Domains ;
22using FaasNet . Gateway . Core . Exceptions ;
33using FaasNet . Gateway . Core . Factories ;
4+ using FaasNet . Gateway . Core . Helpers ;
45using FaasNet . Gateway . Core . Repositories ;
56using FaasNet . Gateway . Core . Resources ;
67using MediatR ;
@@ -18,15 +19,18 @@ public class PublishFunctionCommandHandler : IRequestHandler<PublishFunctionComm
1819 {
1920 private readonly IHttpClientFactory _httpClientFactory ;
2021 private readonly IFunctionCommandRepository _functionRepository ;
22+ private readonly IPrometheusHelper _prometheusHelper ;
2123 private readonly GatewayConfiguration _configuration ;
2224
2325 public PublishFunctionCommandHandler (
2426 IHttpClientFactory httpClientFactory ,
2527 IFunctionCommandRepository functionRepository ,
28+ IPrometheusHelper prometheusHelper ,
2629 IOptions < GatewayConfiguration > configuration )
2730 {
2831 _httpClientFactory = httpClientFactory ;
2932 _functionRepository = functionRepository ;
33+ _prometheusHelper = prometheusHelper ;
3034 _configuration = configuration . Value ;
3135 }
3236
@@ -51,6 +55,7 @@ public async Task<bool> Handle(PublishFunctionCommand command, CancellationToken
5155 function = FunctionAggregate . Create ( command . Name , command . Image ) ;
5256 await _functionRepository . Add ( function , cancellationToken ) ;
5357 await _functionRepository . SaveChanges ( cancellationToken ) ;
58+ _prometheusHelper . Add ( command . Name ) ;
5459 return true ;
5560 }
5661 }
0 commit comments