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

Support for manual transaction logging #853

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

aliab
Copy link

@aliab aliab commented Jul 20, 2022

πŸ“„ Context

Add Support for manual transaction logging in the chucker. For example, developers can populate MQTT or FCM messages transactions into their chucker log; these are other types of network traffic, and showing them in chucker makes this library more generic for network transaction logging.

πŸ“ Changes

  • I've added added saveTransaction(transaction: ManualHttpTransaction) method to ChuckerCollector to save manual transaction data into DB.
  • I've added a new ManualHttpTransaction entity to the API package for the manual type of logging. It is wrapped over the internal HttpTransaction entity and ensures that previous visibility is not violated.

🚫 Breaking

No breaking changes introduced

πŸ› οΈ How to test

Just run the sample app. The new ManualTransactionTask is added to the sample app MainActivity httpTasks to test if this feature is working OK.

@aliab
Copy link
Author

aliab commented Jul 20, 2022

I've checked issues and found that issue #140 also wants this feature.

/**
* Represent Manual Http transaction that developer want to populate as an custom http transaction
*/
public data class ManualHttpTransaction(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need another class here?

Copy link
Author

@aliab aliab Aug 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to move the HttpTransaction class to the API package or expose it to the developer. I could use a builder pattern to build transaction objects or create a method with a bunch of args in the ChuckerCollector class.
But both of these mentioned approaches have their downsides regarding logging the data. In this implemented approach, to log a transaction's start and end information, the developer no longer needs to store the data in a separate data store and can create the model and fill it in during transactions. In the end, the developer can save the object in the chucker.

@cortinico
Copy link
Member

Thanks for sending this @aliab πŸ™ I think we can simplify this a bit

@aliab
Copy link
Author

aliab commented Aug 3, 2022

Thanks for sending this @aliab πŸ™ I think we can simplify this a bit

I tried to make as few changes as possible. btw, I want this feature in my app and if you give me a hint about your idea, maybe I could deliver it sooner.

@aliab
Copy link
Author

aliab commented Aug 13, 2022

@cortinico kindly reminder

@cortinico
Copy link
Member

@cortinico kindly reminder

Hey @aliab
I've took a closer look at this change and I think we can't merge it now. Specifically as I'd like to focus on:

Exposing the Manual class you suggested exposes us to having to maintain this in the long run. As we're planning on potentially separating requests and responses, having a class in the public API which doesn't follow this design would be harder to maintain the future.

Let's get back to this once we're done with the redesign.

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

Successfully merging this pull request may close these issues.

None yet

2 participants