Skip to content
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

Saga View messes up saga data changes #601

Closed
timbussmann opened this issue Sep 5, 2016 · 8 comments
Closed

Saga View messes up saga data changes #601

timbussmann opened this issue Sep 5, 2016 · 8 comments

Comments

@timbussmann
Copy link
Contributor

Given the following Saga:

public class DemoSaga : Saga<MySagaData>, IAmStartedByMessages<StartSagaMessage>, IHandleMessages<MessageSentFromSaga>, IHandleTimeouts<SagaTimeout>
{
    protected override void ConfigureHowToFindSaga(SagaPropertyMapper<MySagaData> mapper)
    {
        mapper.ConfigureMapping<StartSagaMessage>(m => m.Id).ToSaga(d => d.SagaId);
        mapper.ConfigureMapping<MessageSentFromSaga>(m => m.Id).ToSaga(d => d.SagaId);
    }

    public async Task Handle(StartSagaMessage message, IMessageHandlerContext context)
    {
        Console.WriteLine("Started saga");

        await RequestTimeout<SagaTimeout>(context, TimeSpan.FromSeconds(10));

        SendOptions sendOptions1 = new SendOptions();
        sendOptions1.RouteToThisEndpoint();
        await context.Send(new MessageSentFromSaga() {Id = message.Id}, sendOptions1);
        SendOptions sendOptions2 = new SendOptions();
        sendOptions2.RouteToThisEndpoint();
        await context.Send(new MessageSentFromSaga() {Id = message.Id}, sendOptions2);
    }

    public async Task Handle(MessageSentFromSaga message, IMessageHandlerContext context)
    {
        this.Data.Counter++;
        Console.WriteLine("received " + nameof(MessageSentFromSaga) + ", counter = " + this.Data.Counter);
    }

    public async Task Timeout(SagaTimeout state, IMessageHandlerContext context)
    {
        Console.WriteLine("Saga timed out with counter = " + this.Data.Counter);
        this.MarkAsComplete();
    }
}

public class MySagaData : ContainSagaData
{
    public string SagaId { get; set; }
    public int Counter { get; set; }
}

(Saga sending two messages to itself, each of these increments the counter by one)

The latest available SI version (1.5.7) with SC 1.2.2 gives me the following Saga View:

image

There already seems to be an issue about the ordering (#598) but I noted some weird data on the saga data:

  • StartSagaMessage does not change the counter (especially not from 1 to 0)
  • Both MessageSentFromSaga increment the counter, the first one should be (0 -> 1) and the second (0 -> 2), but it only (2 -> 1) on the first message and no change on the second message.
  • What does the (new) mean on the timeout message's saga data? I assume this should be on the StartSagaMessage?
@timbussmann timbussmann added the Bug label Sep 5, 2016
@HEskandari
Copy link
Contributor

@timbussmann would it be possible to check if ServiceControl has captured the right data?

@timbussmann
Copy link
Contributor Author

@HEskandari I think the data in SC looks correctly as far as I can tell, see the gist

@HEskandari HEskandari self-assigned this Sep 7, 2016
@HEskandari
Copy link
Contributor

I'm investigating. My initial thoughts are that this is a ServiceInsight issue. Trying to verify if this scenario was working in v5 with latest stable version of the saga audit plugin.

@HEskandari
Copy link
Contributor

HEskandari commented Sep 7, 2016

After some testing, running the same sample on v5. I can see the right data is coming out of ServiceControl, which means the data is produced and processed correctly and this is only a presentation issue. On sample running in both v5 and v6 I can see the following data/state changes reported by ServiceControl (in reverse order I'm showing here, which might be causing the issue to begin with):

  • Status = new, Counter = 0, Initiating message=StartSagaMessage
  • Status = updated, Counter = 1, Initiating message=MessageSentFromSaga
  • Status = updated, Counter = 2, Initiating message=MessageSentFromSaga
  • Status = completed, Counter = 2, Initiating message=SagaTimeout

I can conclude with the following:

  • Regarding "StartSagaMessage does not change the counter (especially not from 1 to 0)" it seems the direction of the change is the issue and it is a presentation issue only. The data in fact changes from 0 to 1 but the direction of the arrow shows that the other way around.
  • Data is consistently incorrect (if that's even a word) in both v5 and v6.
  • The way that SI shows state 'changes' are based on the order, so the reason it does not show state changes between counter 1 -> 2 might be simply the wrong order of displaying the events.
  • The label 'new' is also used to indicate a state change. Again since this is based on ordering which is incorrect, the first time the state is reported, in this case Saga Timeout, it is reported as new.

Seeing this is mostly an ordering issue, this might be a duplicate of #598 or a close relative. I'm happy to leave it open until #598 is fixed.

@timbussmann
Copy link
Contributor Author

Data is consistently incorrect (if that's even a word) in both v5 and v6.

what part do you consider incorrect? (assuming we're talking about the data from the plugin?)

@HEskandari
Copy link
Contributor

@timbussmann sorry if I didn't communicate clearly...I meant "Data inconsistently shown incorrectly with the sample using both v5 and v6" meaning that it is a bug in ServiceInsight and due to no issue with v6 or the plugins.

@timbussmann
Copy link
Contributor Author

thanks for clarifying @HEskandari 👍 (assuming you meant "data consistently shown incorrectly")

@HEskandari
Copy link
Contributor

The @Particular/serviceinsight-maintainers decided to close this one, in favor of #598.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants