Add details about endpoint display names in ServicePulse under Azure
Completes https://github.com/Particular/NServiceBus.Host.AzureCloudService/issues/49
We need docu about hosting in Azure and how it relates to ServicePulse, specifically setting the display name so ServicePulse shows the instance using Azure relevant information. Ideally, but not required, we would created this document in a way that is inclusive of WebJob hosting as well.
Host v7 shipped changing the behavior to display CurrentRoleName_CurrentRoleInstanceId
Host v6 currently displays the old endpointname@machinename value. We didn't backport the change we made when we released host v7. We should provide a suggested work around as described in #54 to replicate the Host v7 style:
var roleName = SafeRoleEnvironment.CurrentRoleName;
var instanceId = SafeRoleEnvironment.CurrentRoleInstanceId;
busConfiguration.GetSettings().Set("NServiceBus.HostInformation.DisplayName", $"{roleName}_{instanceId}");
To provide a similar experience for WebJobs we would explain how to get a similar experience, and one of our customers has already done the legwork. We should adapt this approach to show an override combing the Azure web app name and the instance id similar to the approach we took for cloud services, using the environment variables provided as demonstrated on Amit's Blog post:
For Core V5 endpoints:
var instanceId = Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID");
var siteName = Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME");
busConfiguration.GetSettings().Set("NServiceBus.HostInformation.DisplayName", $"{siteName}_{instanceId}");
For Core V6 endpoints:
var instanceId = Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID");
var siteName = Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME");
endpointConfiguration
.UniquelyIdentifyRunningInstance()
.UsingNames(instanceId, siteName)
.UsingCustomDisplayName($"{siteName}_{instanceId}");
Ping @Particular/azure-maintainers
Is this Azure specific or it could be suitable for any other environment? Sounds like SP related information that should be captures with SP as well as he "Overriding the Host Identifier" page.
@SeanFeldman It seems like as soon as we start assuming environment variables being present the documentation becomes Azure specific.
Putting myself in the customer shoes*, I'd be looking for this information under the product first. It could have general guidance as well as specific sections for specific environments such as Azure.
* scaling out my endpoints -> they all use the same name -> searching SP doco about endpoint instances -> boom, it has that info.
Why not do both?
Fine with that. Where would it go under "azure"?
@boblangley @SeanFeldman Is figuring out the right place the only thing left here? Can I help?
@weralabaj you could arbitrate and decide where that information could go. What Bob suggested could be a way of handling.
I am working on a PR for this now.
@boblangley ping
ServicePulse can show logical endpoints in heartbeats now. The outstanding bit is for the monitoring portion which is tracked by https://github.com/Particular/ServicePulse/issues/468. Closing.