The NServiceBus.
component enables sending monitoring data gathered with NServiceBus.
to a ServiceControl.
service.
Configuration
After adding the package to the project, metrics are sent to ServiceControl once enabled.
It can be enabled via:
const string SERVICE_CONTROL_METRICS_ADDRESS = "particular.monitoring";
var metrics = endpointConfiguration.EnableMetrics();
metrics.SendMetricDataToServiceControl(
serviceControlMetricsAddress: SERVICE_CONTROL_METRICS_ADDRESS,
interval: TimeSpan.FromSeconds(10),
instanceId: "INSTANCE_ID_OPTIONAL");
Service Control Metrics Address
The default instance name is particular.
which is also used as the input queue for ServiceControl monitoring.
Interval
Specifies maximum delay for sending metrics report.
Time To Be Received
By default, messages sent to the monitoring instance of ServiceControl have Time To Be Received set to 7 days. This value can be overridden when needed using following API:
metrics.SetServiceControlMetricsMessageTTBR(TimeSpan.FromHours(1));
Instance ID
An override for $.
and $.
.
It is recommended to override the host id and host display name via NServiceBus core and to use the API without the InstanceId
argument. By default, the monitoring plug-in will use these values to identify the monitored endpoint instances in the user-interface.
InstanceId
value is unique and human readable.A human readable value is being passed in the following example:
const string SERVICE_CONTROL_METRICS_ADDRESS = "particular.monitoring";
var endpointName = "MyEndpoint";
var machineName = $"{Dns.GetHostName()}.{IPGlobalProperties.GetIPGlobalProperties().DomainName}";
var instanceIdentifier = $"{endpointName}@{machineName}";
var metrics = endpointConfiguration.EnableMetrics();
metrics.SendMetricDataToServiceControl(
serviceControlMetricsAddress: SERVICE_CONTROL_METRICS_ADDRESS,
interval: TimeSpan.FromSeconds(10),
instanceId: instanceIdentifier);
InstanceId
is not required to be physically identifying the running instance uniquely. The plugin uses its own internal unique session identifier for this.