-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it the responsability of Arcus to enable adding correlation-id's to dependency calls ? #6
Comments
Yep, I think that would be a good first step. I think it will be very valuable to also document this in a cross-repo way. Or some sort. That we can show people how to set this up. Even when in the first phase we don't provide built-in functionality that does the 'add' of correlation information in HTTP and/or Azure Service Bus messages. |
This is more of a discussion, really, than an issue 😄 . |
This is already the case I think as the HTTP correlation middleware in Web API has several options to how the correlation should be extracted from the request, how the response should be structure, and many more... https://webapi.arcus-azure.net/features/correlation We do not have a configuration value to specify the location of the operation parent ID in the Service Bus message. This should be able to configure on the Line 50 in 12dba57
Added an issue for this: arcus-azure/arcus.messaging#269 |
Creating the 'next' dependency ID is probably a good thing to be included in Arcus, otherwise the service-to-service functionality is not at all user-friendly. arcus-service-to-service-correlation-poc/src/Arcus.API.Market/Repositories/OrderRepository.cs Line 46 in dad9989
We could provide an easier way to come up with this stuff, as it's not only obscure of new people, it's hard to get right. |
Something like this or so? var orderRequest = new EatBaconRequestMessage
{
Amount = amount
};
using (var serviceBusDependencyMeasurement = DurationMeasurement.Start())
{
bool isSuccessful = false;
CorrelationInfo currentCorrelation = _correlationInfoAccessor.GetCorrelationInfo();
CorrelationInfo newDependencyCorrelation = currentCorrelation.CreateForNextDependency();
try
{
var serviceBusMessage = ServiceBusMessageBuilder.CreateForBody(orderRequest)
.WithCorrelationInfo(newDependencyCorrelation)
.Build();
await _serviceBusOrderSender.SendMessageAsync(serviceBusMessage);
isSuccessful = true;
}
finally
{
var serviceBusEndpoint = _serviceBusOrderSender.FullyQualifiedNamespace;
_logger.LogServiceBusQueueDependency(_serviceBusOrderSender.EntityPath, isSuccessful, serviceBusDependencyMeasurement, dependencyId: newDependencyCorrelation.OperationParentId);
}
} We could also hide the entire measurement/dependency tracking behind an extension on the var orderRequest = new EatBaconRequestMessage
{
Amount = amount
};
var correlationInfo = _correlationInfoAccessor.GetCorrelation();
await _serviceBusOrderSender.SendMessageAsync(serviceBusMessage, correlationInfo); We'll have to check, maybe if the new Azure SDK supports back extensions, we can even hide it in the creation of the |
I think it is mandatory to not put a burden on the developer to define / generate those Id's. If possible, I'd like to make sure that the Arcus user doesn't even need to think about generating a dependencyId, even if it just means that a certain function needs to be called. |
Yes, isn't then the second example the thing that you want? Where the tracking is completely hidden?
Well, no, bc the measurement of the call to the dependency should come before that, so then it's already too late. |
You can only call the LogDependency method when the dependency call is finished no ? Because you need to know whether the call was succesfull and you also need to know how long the dependency call took. |
Yes, exactly, so that's why the dependency ID can't be generated by the |
So, to come back: we can opt for a way to hide the dependency ID completely in a separated overload (2th code sample) or via simpler methods on something else (1th code sample). |
Yes, true. I might have been confused as I was focusing on 'parent Ids' yesterday. |
I like the 1st sample best, where the correlation information is specified when creating the message. |
Is it the responsability of Arcus to provide functionality for developers to easy set 'dependencyIds' when calling dependencies ?
For instance:
HttpClient
which easily allows developers to set the correlation-info ?I would say: no, this is not the responsability of Arcus. (At least, not in a first phase).
I think we should focusing on the 'accepting' end.
That is, we should be able to log requests, and correlate incoming requests with the dependency call that triggered that request.
To do that, we would need methods that would allow developers to specify a delegate on how to retrieve the correlation-information from the incoming request (http request, servicebus message, .... )
That is, when configuring the Correlation Middelware in API / ASP.NET projects, developers must be able to specify how the correlation information must be retrieved
Same is true when registering a message-pump that processes servicebus messages
The text was updated successfully, but these errors were encountered: