コード例 #1
0
 public ServiceInstanceModel(NuGetService service, object description, object status) : this()
 {
     Name = service.ServiceName.ToString();
     Service = service.ServiceName.Name;
     LastHeartbeat = service.LastHeartbeat;
     Description = description;
     Status = status;
 }
コード例 #2
0
 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
     };
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 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);
 }
コード例 #5
0
        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");
        }
コード例 #6
0
        protected override void Starting(NuGetService instance)
        {
            if (Config.Storage.Primary != null)
            {
                InitializeServiceLogging(instance);
            }

            base.Starting(instance);
        }
コード例 #7
0
 protected virtual void Starting(NuGetService instance)
 {
 }