diff --git a/src/ApiService/ApiService/Program.cs b/src/ApiService/ApiService/Program.cs index 13c928f5b1..0cae4f43ed 100644 --- a/src/ApiService/ApiService/Program.cs +++ b/src/ApiService/ApiService/Program.cs @@ -48,6 +48,7 @@ public static List GetLoggers(IServiceConfig config) { return loggers; } + //Move out expensive resources into separate class, and add those as Singleton // ArmClient, Table Client(s), Queue Client(s), HttpClient, etc. public static void Main() { diff --git a/src/ApiService/ApiService/onefuzzlib/Events.cs b/src/ApiService/ApiService/onefuzzlib/Events.cs index 15b79d826f..ebed0245c5 100644 --- a/src/ApiService/ApiService/onefuzzlib/Events.cs +++ b/src/ApiService/ApiService/onefuzzlib/Events.cs @@ -21,12 +21,16 @@ public interface IEvents { public class Events : IEvents { private readonly IQueue _queue; private readonly IWebhookOperations _webhook; - private ILogTracer _log; + private readonly ILogTracer _log; + private readonly IContainers _containers; + private readonly ICreds _creds; - public Events(IQueue queue, IWebhookOperations webhook, ILogTracer log) { + public Events(IQueue queue, IWebhookOperations webhook, ILogTracer log, IContainers containers, ICreds creds) { _queue = queue; _webhook = webhook; _log = log; + _containers = containers; + _creds = creds; } public async Async.Task QueueSignalrEvent(EventMessage eventMessage) { @@ -37,12 +41,14 @@ public async Async.Task QueueSignalrEvent(EventMessage eventMessage) { public async Async.Task SendEvent(BaseEvent anEvent) { var eventType = anEvent.GetEventType(); + var instanceId = await _containers.GetInstanceId(); + var eventMessage = new EventMessage( Guid.NewGuid(), eventType, anEvent, - Guid.NewGuid(), // todo - "test" //todo + instanceId, + _creds.GetInstanceName() ); await QueueSignalrEvent(eventMessage); await _webhook.SendEvent(eventMessage);