Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 50 additions & 14 deletions src/ServicePulse.Host/app/js/endpoints/endpoints.controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
; (function (window, angular, undefined) {
;
(function(window, angular, undefined) {

'use strict';

Expand All @@ -8,32 +9,67 @@

$scope.model = { active: [], inactive: [] };

$scope.$on('$destroy', function () {
$scope.$on('$destroy', function() {
$timeout.cancel(timeoutId);
});

function updateUI() {
configurationService.getData().then(function (endpoints) {
$scope.model.active = [];
$scope.model.inactive = [];
configurationService.getData().then(function(endpoints) {

var endpointList = endpoints.data;

for (var j = 0; j < endpointList.length; j++) {
var item = endpointList[j];
// remove unmonitored
var unmonitored = endpointList.filter(function(umi) {
return !umi.monitor_heartbeat;
});

if (!item.monitor_heartbeat) {
continue;
var i, obj;

for (i = 0; i < $scope.model.active.length; i++) {
obj = $scope.model.active[i];
if (unmonitored.indexOf(obj.id) !== -1) {
$scope.model.active.splice(i, 1);
i--; // we just made the array 1 shorter
}
}

for (i = 0; i < $scope.model.inactive.length; i++) {
obj = $scope.model.inactive[i];
if (unmonitored.indexOf(obj.id) !== -1) {
$scope.model.inactive.splice(i, 1);
i--;
}
}

var monitored = endpointList.filter(function(mi) {
return mi.monitor_heartbeat;
});

for (var j = 0; j < monitored.length; j++) {
var item = monitored[j];

var activeIndex = $scope.model.active.map(function(bi) { return bi.id; }).indexOf(item.id);
var inactiveIndex = $scope.model.inactive.map(function(bi) { return bi.id; }).indexOf(item.id);

if (item.hasOwnProperty('heartbeat_information') && item.heartbeat_information.reported_status === 'beating') {
$scope.model.active.push(item);
if (activeIndex === -1) {
$scope.model.active.push(item);
}
if (inactiveIndex !== -1) {
$scope.model.inactive.splice(inactiveIndex, 1);
}
} else {
$scope.model.inactive.push(item);
if (inactiveIndex === -1) {
$scope.model.inactive.push(item);
}
if (activeIndex !== -1) {
$scope.model.active.splice(activeIndex, 1);
}

}
}

timeoutId = $timeout(function () {
timeoutId = $timeout(function() {
updateUI();
}, 5000);
});
Expand All @@ -43,10 +79,10 @@
};

controller.$inject = [
'$scope', '$timeout' , 'configurationService'
'$scope', '$timeout', 'configurationService'
];

angular.module('endpoints')
.controller('EndpointsCtrl', controller);

} (window, window.angular));
}(window, window.angular));
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
};

function getTotalFailingCustomChecks() {
var url = uri.join(scConfig.service_control_url, 'customchecks?status=unresolved');
var url = uri.join(scConfig.service_control_url, 'customchecks?status=fail');
return $http.get(url).then(function(response) {
return response.headers('Total-Count');
});
Expand Down
23 changes: 23 additions & 0 deletions src/ServicePulse.sln
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Chocolatey", "Chocolatey",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePulse.Host.Tests", "ServicePulse.Host.Tests\ServicePulse.Host.Tests.csproj", "{113A09CC-9665-4E87-9FC7-7E5C8C0AFE71}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SmokeTesting", "SmokeTesting", "{E4018B8E-ED2B-464C-B9A7-70BD97448D4B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmokeTest.Client", "SmokeTest.Client\SmokeTest.Client.csproj", "{A9B109A2-71C7-40C5-B1F4-D637D3808796}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmokeTest.Server", "SmokeTest.Server\SmokeTest.Server.csproj", "{CBC386E8-36FB-4427-A212-88F75C65A6A9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmokeTest.Shared", "SmokeTest.Shared\SmokeTest.Shared.csproj", "{122AD54A-B249-41C7-858F-CB75E7C0F463}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -40,11 +48,26 @@ Global
{113A09CC-9665-4E87-9FC7-7E5C8C0AFE71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{113A09CC-9665-4E87-9FC7-7E5C8C0AFE71}.Release|Any CPU.ActiveCfg = Release|Any CPU
{113A09CC-9665-4E87-9FC7-7E5C8C0AFE71}.Release|Any CPU.Build.0 = Release|Any CPU
{A9B109A2-71C7-40C5-B1F4-D637D3808796}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A9B109A2-71C7-40C5-B1F4-D637D3808796}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9B109A2-71C7-40C5-B1F4-D637D3808796}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9B109A2-71C7-40C5-B1F4-D637D3808796}.Release|Any CPU.Build.0 = Release|Any CPU
{CBC386E8-36FB-4427-A212-88F75C65A6A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CBC386E8-36FB-4427-A212-88F75C65A6A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CBC386E8-36FB-4427-A212-88F75C65A6A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CBC386E8-36FB-4427-A212-88F75C65A6A9}.Release|Any CPU.Build.0 = Release|Any CPU
{122AD54A-B249-41C7-858F-CB75E7C0F463}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{122AD54A-B249-41C7-858F-CB75E7C0F463}.Debug|Any CPU.Build.0 = Debug|Any CPU
{122AD54A-B249-41C7-858F-CB75E7C0F463}.Release|Any CPU.ActiveCfg = Release|Any CPU
{122AD54A-B249-41C7-858F-CB75E7C0F463}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{FA2792B9-B82D-4936-871E-16812FA60D13} = {CBD21A52-A2D6-45FF-B921-A0743CFB13F7}
{A9B109A2-71C7-40C5-B1F4-D637D3808796} = {E4018B8E-ED2B-464C-B9A7-70BD97448D4B}
{CBC386E8-36FB-4427-A212-88F75C65A6A9} = {E4018B8E-ED2B-464C-B9A7-70BD97448D4B}
{122AD54A-B249-41C7-858F-CB75E7C0F463} = {E4018B8E-ED2B-464C-B9A7-70BD97448D4B}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions src/SmokeTest.Client/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
59 changes: 59 additions & 0 deletions src/SmokeTest.Client/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System;
using NServiceBus;

class Program
{
const string wordblob = "Flank filet mignon rump prosciutto kevin Tail pancetta tenderloin tongue prosciutto, short loin pork pastrami flank swine leberkas Pig beef ribs hamburger, ball tip pastrami ham hock flank meatloaf Shoulder boudin meatloaf sirloin porchetta short loin ground round corned beef T-bone ground round pork chop pancetta short ribs, tenderloin brisket frankfurter Pig chuck porchetta meatball tongue capicola swine turducken, beef pastrami prosciutto bresaola bacon alcatra";


static void Main()
{
var busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("SmokeTest.Client");
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EnableInstallers();
busConfiguration.UsePersistence<InMemoryPersistence>();

using (var bus = Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press enter to send a message");
Console.WriteLine("Press any key to exit");

while (true)
{
var killMe = false;
var count = 1;

var key = Console.ReadKey();
switch (key.Key)
{
case ConsoleKey.Enter:
killMe = true;
count = 10;
break;
case ConsoleKey.Spacebar:
killMe = true;
break;
case ConsoleKey.Q:
return;
}

var text = wordblob.LoremIpsum(5, 5, 1, 1, 1);
for (var i = 0; i < count; i++)
{
var id = Guid.NewGuid();

bus.Send("SmokeTest.Server", new MyMessage
{
Id = id,
KillMe = killMe,
SomeText = text
});

Console.WriteLine("Sent a new message with id: {0}", id.ToString("N"));
}

}
}
}
}
36 changes: 36 additions & 0 deletions src/SmokeTest.Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SmokeTest.Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SmokeTest.Client")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a9b109a2-71c7-40c5-b1f4-d637d3808796")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
75 changes: 75 additions & 0 deletions src/SmokeTest.Client/SmokeTest.Client.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A9B109A2-71C7-40C5-B1F4-D637D3808796}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SmokeTest.Client</RootNamespace>
<AssemblyName>SmokeTest.Client</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="NServiceBus.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
<HintPath>..\packages\NServiceBus.5.2.9\lib\net45\NServiceBus.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceControl.Plugin.Nsb5.Heartbeat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceControl.Plugin.Nsb5.Heartbeat.2.0.0\lib\net45\ServiceControl.Plugin.Nsb5.Heartbeat.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SmokeTest.Shared\SmokeTest.Shared.csproj">
<Project>{122ad54a-b249-41c7-858f-cb75e7c0f463}</Project>
<Name>SmokeTest.Shared</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
5 changes: 5 additions & 0 deletions src/SmokeTest.Client/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NServiceBus" version="5.2.9" targetFramework="net452" />
<package id="ServiceControl.Plugin.Nsb5.Heartbeat" version="2.0.0" targetFramework="net452" />
</packages>
6 changes: 6 additions & 0 deletions src/SmokeTest.Server/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
42 changes: 42 additions & 0 deletions src/SmokeTest.Server/MyHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;

using NServiceBus;

public class MyHandler : IHandleMessages<MyMessage>
{
public void Handle(MyMessage message)
{
Console.WriteLine(@"Message received. Id: {0}", message.Id);

if (!message.KillMe)
{
return;
}

if (!Program.KillMe)
{
return;
}

RandomException(message.SomeText);
}

static void RandomException(string message)
{
var rand = new Random();
var wheelOfFortune = rand.Next(3) + 1;

switch (wheelOfFortune)
{
case 1:
throw new OutOfMemoryException(message + "Uh oh...I forget Why this happened");
case 2:
throw new NullReferenceException(message + "Uh oh...Nulls are bad MK");
case 3:
throw new DivideByZeroException(message + "Uh oh...Zero and Divisions just don't get along");
default:
throw new Exception(message + "Uh oh...Because, Reasons");
}

}
}
Loading