diff --git a/ATI.Services.Consul/ConsulMetricsHttpClientWrapper.cs b/ATI.Services.Consul/ConsulMetricsHttpClientWrapper.cs index 96a3b5d..79e8cc0 100644 --- a/ATI.Services.Consul/ConsulMetricsHttpClientWrapper.cs +++ b/ATI.Services.Consul/ConsulMetricsHttpClientWrapper.cs @@ -243,6 +243,37 @@ public Task> PatchAsync( #endregion + #region Send + + public async Task>> SendAsync( + HttpMethod methodName, + string url, + TBody body, + string metricName, + Dictionary headers = null, + string urlTemplate = null, + string[] additionalLabels = null) + { + using var _ = + _metricsTracingFactory.CreateLoggingMetricsTimer(metricName, + $"{methodName}:{urlTemplate ?? url}", + additionalLabels); + { + try + { + var serviceAddress = await _serviceAddress.ToHttpAsync(); + return await _clientWrapper.SendAsync(new Uri(new Uri(serviceAddress),url), metricName, body, headers, methodName); + } + catch (Exception e) + { + _logger.LogWithObject(_serviceOptions.LogLevelOverride(LogLevel.Error), e); + return new(ActionStatus.InternalServerError); + } + } + } + + #endregion + private async Task> SendAsync(string url, string urlTemplate, string metricName, diff --git a/ATI.Services.Consul/ConsulServiceAddress.cs b/ATI.Services.Consul/ConsulServiceAddress.cs index 8c7daed..81b33f6 100644 --- a/ATI.Services.Consul/ConsulServiceAddress.cs +++ b/ATI.Services.Consul/ConsulServiceAddress.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using ATI.Services.Common.Behaviors; using ATI.Services.Common.Extensions; using Consul; using NLog;