• Stars
    star
    51
  • Rank 549,372 (Top 12 %)
  • Language
    C#
  • License
    Other
  • Created over 11 years ago
  • Updated 22 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Backend for ServiceInsight and ServicePulse

ServiceControl Current Version

ServiceControl is the monitoring brain in the Particular Service Platform, which includes NServiceBus and tools to build, monitor, and debug distributed systems. ServiceControl collects data on every single message flowing through the system (Audit Queue), errors (Error Queue), as well as additional information regarding sagas, endpoints heartbeats, and custom checks (Control Queue). The information is then exposed to ServicePulse and ServiceInsight via an HTTP API and SignalR notifications.

See the ServiceControl documentation for more information.

How to run/debug locally

ServiceControl, ServiceControl.Audit, and ServiceControl.Monitoring can be run/debugged locally by following these steps:

  • Edit the app.config file of the instance type that needs to be run/debugged to select which transport and persistence to use.
    • The configuration file contains commented settings for each supported transport and persistence. It also provides some guidance on additional required settings for specific persisters.
  • Run or debug the project as usual

A video demo showing how to set it up is available on the Particular YouTube channel:

Infrastructure setup

If the instance is executed for the first time, it must set up the required infrastructure. To do so, once the instance is configured to use the selected transport and persister, run/debug it in setup mode by adding a launchSettings.json file to the project of the instance to set up. The file content for the ServiceControl.Audit instance looks like the following:

{
 "profiles": {
  "ServiceControl.Audit": {
   "commandName": "Project",
   "commandLineArgs": "/setup"
  }
 }
}

Replace ServiceControl.Audit with the project name of the instance to set up.

The instance will start as usual, execute the setup process, and exit. Remove the launchSettings.json file and run/debug the instance normally.

Run Instances on Learning transport

To help with local testing, the Learning transport has been added to the list of available transports when setting up a new instance in SCMU. For it to become available, an environment variable ServiceControl_IncludeLearningTransport needs to be created with a value of true.

Secrets

Testing using the CI workflow depends on the following secrets, which must be defined for both Actions and Dependabot secrets. The Particular values for these secrets are stored in the secure note named ServiceControl Repo Secrets.

  • LICENSETEXT: Particular Software license text
  • AWS_ACCESS_KEY_ID: For testing SQS
  • AWS_SECRET_ACCESS_KEY: For testing SQS
  • AWS_REGION: For testing SQS

Running the Tests

Running all tests all the times takes a lot of resources. Tests are filtered based on the ServiceControl_TESTS_FILTER environment variable. To run only a subset, e.g., SQS transport tests, define the variable as ServiceControl_TESTS_FILTER=SQS. The following list contains all the possible ServiceControl_TESTS_FILTER values:

  • Default - runs only non-transport-specific tests
  • AzureServiceBus
  • AzureStorageQueues
  • MSMQ
  • RabbitMQ
  • SqlServer
  • SQS

NOTE: If no variable is defined all tests will be executed.

Use the x64 test agent

The tests need to be run in x64 otherwise an exception about RavenDB (Voron) not being supported in 32bit mode will be thrown. The ServiceControl.runsettings file in each test project should automatically ensure that tests are run in 64 bit mode. For reference, there is also a setting in Visual Studio that can be used to ensure test execution is using x64 only:

image

Integration Tests

Ù‹By default integration tests use MSMQ transport to run. This can be overridden by renaming the _connection.txt file in the root of the solution to connection.txt and updating the transport type and connection string. Only the first 3 lines of this file are read with the following information:

  • First line is the Transport name
  • Second line is the ServiceControl Transport type information (implementation of ITransportIntegration interface)
  • Third line is the connection string

To change the tests to use LearningTransport, rename the file and change the content to this:

LearningTransport
ConfigureEndpointLearningTransport
c:\Temp\ServiceControlTemp

How to developer test the PowerShell Module

Steps:

  • Build the solution

  • Open PowerShell 7

  • Import the module by specifying the path to the ServiceControl git repo folder deploy\PowerShellModules\Particular.ServiceControl.Management

    Import-Module -Name S:\ServiceControl\deploy\PowerShellModules\Particular.ServiceControl.Management -Verbose 
    • If there are any issues running the import script, try setting the execution policy to "unrestricted' by running the following script in PowerShell 7 admin mode. Then run the command to import the module.
      Set-ExecutionPolicy Unrestricted
  • Now that the module has been successfully imported, enter any of the ServiceControl PowerShell scripts to test them out. Eg: the following creates a new ServiceControl Instance

    $serviceControlInstance = New-ServiceControlInstance `
       -Name 'Test.DEV.ServiceControl' `
       -InstallPath C:\ServiceControl\Bin `
       -DBPath C:\ServiceControl\DB `
       -LogPath C:\ServiceControl\Logs `
       -Port 44334 `
       -DatabaseMaintenancePort 44335 `
       -Transport 'RabbitMQ - Direct routing topology (quorum queues)' `
       -ConnectionString 'host=localhost;username=guest;password=guest' `
       -ErrorQueue errormq `
       -ErrorRetentionPeriod 10:00:00:00 `
       -Acknowledgements RabbitMQBrokerVersion310

How to build and run Docker images

NOTE: The following instructions are provided to ease development stages only. To run container images in production, refer to the ones available on Docker Hub.

Docker images are built by the ServiceControl.DockerImages project. In order to keep the overall build time under control, the project is not automatically built when building the solution. To explicitly build Docker images, build that project using the IDE or MSBuild from the command line.

NOTE: The project will build Docker images for all supported transports. To build images for a subset of the transports, edit the .csproj file and comment out, or delete the unneeded transport definitions in the SupportedTransport ItemGroup.

Once the images are built, the instances can be started by first running the init container to provision the required queues and databases (using RabbitMQ Conventional topology as an example):

docker run --name servicecontrol.init -e "ServiceControl/ConnectionString=host=[connectionstring]" -e 'ServiceControl/LicenseText=[licensecontents]' -v C:/ServiceControl/:c:/data/ particular/servicecontrolrabbitdirect.init
docker run --name servicecontrol.monitoring.init -e "Monitoring/ConnectionString=[connectionstring]" -e 'ServiceControl/LicenseText=[licensecontents]' particular/servicecontrolrabbitconventional.monitoring.init
docker run --name servicecontrol.audit.init -e "ServiceControl.Audit/ConnectionString=host=[connectionstring]" -e 'ServiceControl/LicenseText=[licensecontents]' -v C:/ServiceControl.Audit/:c:/data/ particular/servicecontrolrabbitdirect.audit.init

That will create the required queues and the database for ServiceControl and ServiceControl.Audit. To run the containers now that everything is provisioned, first run the audit container:

docker run --name servicecontrol.audit -p 44444:44444 -e "ServiceControl.Audit/ConnectionString=host=[connectionstring]" -e 'ServiceControl.Audit/LicenseText=[licensecontents]' -e 'ServiceControl.Audit/ServiceControlQueueAddress=Particular.ServiceControl' -v C:/ServiceControl.Audit/:c:/data/ -d particular/servicecontrolrabbitdirect.audit

Then grab its IP address using docker inspect, and specify it using the ServiceControl/RemoteInstances environment variable when starting the servicecontrol container.

docker run --name servicecontrol -p 33333:33333 -e "ServiceControl/ConnectionString=host=[connectionstring]" -e 'ServiceControl/LicenseText=[licensecontents]' -e 'ServiceControl.Audit/ServiceControlQueueAddress=Particular.ServiceControl' -e "ServiceControl/RemoteInstances=[{'api_uri':'http://172.28.XXX.XXX:44444/api'}]" -v C:/ServiceControl:c:/data/ -d particular/servicecontrolrabbitdirect

ServiceControl will now run in a docker container.

To run a ServiceControl Monitoring instance:

docker run --name servicecontrol.monitoring -p 33633:33633 -e "Monitoring/ConnectionString=host=[connectionstring]" -e 'Monitoring/LicenseText=[licensecontents]' -d particular/servicecontrolrabbitdirect.monitoring

Notes

  • RabbitMQ can either be installed on the host or run in another Docker container. In either case, the ServiceControl connection strings will need to refer to the host IP address.
  • The special DNS name host.docker.internal does not work on Docker Desktop for Windows, and it also doesn't support host networks. To get the IP address of the host for the connection string environment variables, use ipconfig and find the IP address of the vEthernet adapter Docker is using, e.g.
Ethernet adapter vEthernet (nat):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::c12a:27cf:ad50:8b7b%41
   IPv4 Address. . . . . . . . . . . : 172.29.144.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :
  • RabbitMQ's default guest account cannot be used, since authentication will fail when ServiceControl is running in a docker container.
  • The ServiceControl docker images are currently Windows based images while the RabbitMQ docker image is Linux based. As such, these cannot be managed by docker-compose on a single Windows host.
  • Refer to here for more in depth documentation on running ServiceControl docker images (including on how to mount the license file rather than pass it in as an environment variable)

More Repositories

1

NServiceBus

Build, version, and monitor better microservices with the most powerful service platform for .NET
C#
2,043
star
2

Workshop

SOA Done Right
C#
576
star
3

eShopOnContainers

186
star
4

docs.particular.net

All content for ParticularDocs
C#
101
star
5

NServiceBus.RabbitMQ

RabbitMQ transport for NServiceBus
C#
86
star
6

NServiceBus.SqlServer

SQL Server Transport for NServiceBus
C#
40
star
7

Presentation.MultiDimensional

C#
35
star
8

NServiceBus.AmazonSQS

An AWS SQS transport for NServiceBus.
C#
35
star
9

NServiceBus.Persistence.Sql

Native SQL Persistence for NServiceBus
C#
34
star
10

ServicePulse

Production monitoring for distributed systems.
JavaScript
32
star
11

GitHubReleaseNotes

Generate release notes based on github issues assigned to milestones
C#
29
star
12

NServiceBus.Transport.AzureServiceBus

Azure Service Bus transport
C#
21
star
13

ServiceInsight

Advanced debugging for NServiceBus
C#
16
star
14

Particular.Analyzers

Analyzers for use in Particular Software C# projects.
C#
15
star
15

NServiceBus.AzureServiceBus

The Azure ServiceBus Transport
C#
13
star
16

NServiceBus.Extensions.Hosting

NServiceBus extension to support Microsoft.Extensions.Hosting
C#
13
star
17

Webinar.SignalR

A sample code demonstrating how to connect frontend to backend using SignalR and messaging
JavaScript
12
star
18

NServiceBus.NHibernate

Persistence support for NServiceBus using NHibernate
C#
12
star
19

NServiceBus.AzureFunctions.InProcess.ServiceBus

Process messages in AzureFunctions using the Azure Service Bus trigger and the NServiceBus message pipeline.
C#
11
star
20

NServiceBus.RavenDB

C#
10
star
21

NServiceBus.Azure

Transports and storage for Windows Azure
10
star
22

HashBus

A Twitter leaderboard. A demo of messaging and distributed apps built with love and NServiceBus
C#
10
star
23

install-sql-server-action

Runs SQL Server for a GitHub Actions workflow
9
star
24

NServiceBus.Testing

A framework for composing tests for NServiceBus
C#
8
star
25

ServiceMatrix

Visual Studio integrated modeling tools for NServiceBus [State: Deprecated]
C#
8
star
26

ParticularTemplates

dotnet-new templates for the Particular Service Platform
C#
7
star
27

NServiceBus.Newtonsoft.Json

Add support for NServiceBus message serialization via Newtonsoft.Json
C#
7
star
28

NServiceBus.PowerShell

Powershell extensions for NServiceBus
C#
7
star
29

NServiceBus.Host

C#
6
star
30

NServiceBus.Persistence.AzureTable

Azure Table storage persistence for NServiceBus
C#
5
star
31

NServiceBus.AzureFunctions.Worker.ServiceBus

Process messages in AzureFunctions using the Azure Service Bus trigger and the NServiceBus message pipeline.
C#
5
star
32

NServiceBus.Metrics

NServiceBus.Metrics provides a convenient way of gathering metrics like processing time or critical time.
C#
5
star
33

HandsOnLabs

Contains all of the templated exercises and the completed solution for the hands on labs [State: Deprecated]
C#
4
star
34

SagaMasterClass.Skeleton

C#
4
star
35

NServiceBus.Persistence.CosmosDB

NServiceBus persistence for Microsoft Azure Cosmos DB Core (SQL) API
C#
4
star
36

NServiceBus.MessagingBridge

C#
4
star
37

NServiceBus.Gateway

C#
4
star
38

SagaMasterClass

Sample app and material for the Saga Master class for NSBCON 2015
C#
4
star
39

NServiceBus.AzureStorageQueues

Azure Storage Queues Transport for NServiceBus
C#
4
star
40

NServiceBus.Transport.Msmq

MSMQ transport for NServiceBus
C#
4
star
41

NServiceBus.Storage.MongoDB

NServiceBus MongoDB persistence
C#
4
star
42

TimeoutMigrationTool

C#
4
star
43

ServiceControl.Monitoring

A standalone service gathering metrics from endpoints and providing them with an http endpoint
C#
4
star
44

Particular.Approvals

Approval test infrastructure for Particular repositories
C#
4
star
45

NServiceBus.DataBus.AzureBlobStorage

DataBus implementation using Azure Blobs to store the payload
C#
3
star
46

PBot

[Deprecated] Our friendly robotic helper
3
star
47

NServiceBus.TransactionalSession

Transactional message session implementation for NServiceBus
C#
3
star
48

ServiceControl.TransportAdapter

C#
3
star
49

MonitoringDemo

Self-contained demo showing all of the monitoring components working together
C#
3
star
50

NServiceBus.Bootstrap.WindowsService

Self hosting NServiceBus
C#
3
star
51

NServiceBus.Distributor.Msmq

C#
3
star
52

NServiceBus.Callbacks

C#
2
star
53

Workshop.NServiceBus

The NServiceBus workshop as provided by Particular Software
C#
2
star
54

EndToEnd

Home to End-to-End tests for NServiceBus (performance, wire, backwards compatibility, etc)
C#
2
star
55

NServiceBus.Unity

C#
2
star
56

NServiceBus.Metrics.ServiceControl

This package enables sending data gathered by NServiceBus.Metrics to an instance of ServiceControl.Monitoring
C#
2
star
57

NServiceBus.Heartbeat

C#
2
star
58

NServiceBus.StructureMap

C#
2
star
59

PlatformInstaller

Particular Platform Installer for Development PCs
C#
2
star
60

NServiceBus.Persistence.ServiceFabric

A persister for ServiceFabric
C#
2
star
61

ServiceControl.Monitoring.Data

A library providing the wire format protocols and the data structures required to report to ServiceControl.Monitoring
C#
2
star
62

NServiceBus.Encryption.MessageProperty

Provides encryption for properties on messages
C#
2
star
63

NServiceBus.Autofac

Support for the Autofac container for NServiceBus
C#
2
star
64

Particular.PlatformSample

A package containing the Particular Service Platform for use in samples and tutorials
C#
2
star
65

Particular.EndpointThroughputCounter

C#
2
star
66

NServiceBus.Wcf

C#
2
star
67

NServiceBus.SagaAudit

Enables audit of saga state changes for NServiceBus endpoints to facilitate the SagaView state change diagram in ServiceInsight.
C#
1
star
68

NServiceBus.CastleWindsor

Support for the Castle Windsor container for NServiceBus
C#
1
star
69

NServiceBus.AwsLambda.Sqs

Integration package for AWS Lambda using SQS as transport
C#
1
star
70

Webinar.AzureServiceBus

1
star
71

Compatibility.NServiceBus.Transport.SqlServer

C#
1
star
72

Particular.Packaging

C#
1
star
73

virus-scan-action

A GitHub Action to perform virus scanning on every published release
1
star
74

NServiceBus.WireCompatibilityTests

Tests to ensure wire compatibility between versions of NServiceBus
C#
1
star
75

TeamCityProjectCreator

A script for creating TC projects based on a template
PowerShell
1
star
76

Particular.AzureTable.Export

A tool to extract saga data from NServiceBus.Persistence.AzureStorage for import into NServiceBus.Persistence.CosmosDB
C#
1
star
77

Course.Workbook

1
star
78

IssueDetection

This repository contains source code for tools created to assist in the detection of issues so that further corrective action can be taken.
C#
1
star
79

NServiceBus.Extensions.Logging

C#
1
star
80

ServiceControl.Contracts

Contains the message contracts for external events pushed by ServiceControl
C#
1
star
81

ConsoleTweet

A twitter console app
C#
1
star
82

NServiceBus.Persistence.NonDurable

C#
1
star
83

setup-oracle-action

PowerShell
1
star
84

NuGetPackager

Creates nuget packages based on the Particular naming conventions
C#
1
star
85

NServiceBus.CustomChecks

Enables sending state of custom checks to ServicePulse
C#
1
star
86

NServiceBus.NLog

C#
1
star