public ServiceInstanceModel(NuGetService service, object description, object status) : this() { Name = service.ServiceName.ToString(); Service = service.ServiceName.Name; LastHeartbeat = service.LastHeartbeat; Description = description; Status = status; }
private ServiceVersionInformation CreateVersionInfo(NuGetService service) { var asmName = service.GetType().Assembly.GetName(); var asmInfo = service.GetType().GetAssemblyInfo(); return new ServiceVersionInformation() { Version = asmInfo.SemanticVersion, Branch = asmInfo.BuildBranch, Commit = asmInfo.BuildCommit, BuildDateUtc = asmInfo.BuildDate.UtcDateTime }; }
protected override void Starting(NuGetService instance) { foreach (var source in instance.GetEventSources()) { EventListener.EnableEvents(source, EventLevel.Informational); } base.Starting(instance); foreach (var eventSource in instance.GetEventSources()) { EventListener.EnableEvents(eventSource, EventLevel.LogAlways); } }
private async Task RunService(NuGetService service) { ServicePlatformEventSource.Log.ServiceRunning(service.ServiceName); try { await service.Run(); } catch (Exception ex) { ServicePlatformEventSource.Log.ServiceException(service.ServiceName, ex); throw; } ServicePlatformEventSource.Log.ServiceStoppedRunning(service.ServiceName); }
private void InitializeServiceLogging(NuGetService instance) { // Start logging this service's events to azure storage var serviceEventStream = new ObservableEventListener(); foreach (var source in instance.GetEventSources()) { serviceEventStream.EnableEvents(source, TraceLevel); } var mergedEvents = Observable.Merge( serviceEventStream, _platformEventStream.Where(evt => Equals(ServiceName.GetCurrent(), instance.ServiceName))); mergedEvents.LogToWindowsAzureTable( instanceName: instance.ServiceName.ToString(), connectionString: Config.Storage.Primary.GetConnectionString(), tableAddress: "NG" + instance.ServiceName.Name + "Trace"); // Trace Http Requests var httpEventStream = new ObservableEventListener(); httpEventStream.EnableEvents(HttpTraceEventSource.Log, EventLevel.LogAlways); httpEventStream .Where(e => Equals(ServiceName.GetCurrent(), instance.ServiceName)) .LogToWindowsAzureTable( instanceName: instance.ServiceName.ToString(), connectionString: Config.Storage.Primary.GetConnectionString(), tableAddress: "NG" + instance.ServiceName.Name + "Http"); }
protected override void Starting(NuGetService instance) { if (Config.Storage.Primary != null) { InitializeServiceLogging(instance); } base.Starting(instance); }
protected virtual void Starting(NuGetService instance) { }