question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for custom clients

See original GitHub issue

Support for custom clients

This is a proposal for how we could implement official support for custom request/response based clients.

Reasoning

The reason we would like to do this is both to officially support testing of other request/response based systems than HTTP, but also to provide the ability to swap out the current requests based (http://docs.python-requests.org/) HTTP client, in favor for some other HTTP client. For example, if you’re running extremely large load tests where you’re doing tenths of thousands of requests per second, the overhead python-requests comes with can actually have a quite large impact.

Proposal

I’ve given this some thought, but it’s most likely not optimal. However it’s good to start somewhere, so you can see it as a starting point for a discussion on how to best implement this 😃.

One would specify the client class on the locust class(es) like this:

class User(Locust):
    client_class = ThriftClient
    ...

We would modify the Locust base class to something like this (which will allow one to either just set client_class on the Locust class, or override the get_client() method):

class Locust(...):
    ...
    def init(self, ...):
        self.client = self.get_client()

    def get_client(self):
        return self.client_class(self)
    ...

The client classes should then expect to get an instance of a Locust subclass to their init method (which can be used to read Locust.host etc.), and the client is also responsible for fire:ing request_success and request_failure events when it does requests (which of course should be clearly documented).

Finally, we should also change the HTTP specific labels that we have in the UI (I think it might only be “Method”, which we could rename to “Type”).

So, what do you think? ping @cgbystrom @Jahaja

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

7reactions
irshad-qbcommented, Nov 23, 2015

@heyman / @cgbystrom :Could you please give me an example or explanation on how to write locust load test with custom client ( WebSocket Server in my case ). I saw the explanation given in locust documentation but I dint get how exactly the functions__getattr__ and def wrapper(*args, **kwargs): which hooks locust events are getting triggered via locust.

0reactions
heymancommented, Feb 3, 2014

Fixed!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure Your Custom Client - AnyDesk
Build up your client's trust by configuring the set of permissions. Display your own logo to create trust. For Remote Support, you can...
Read more >
Custom Clients
Custom clients can be registered in IAM for different authentication needs given in authentication for integration. The navigation details for accessing custom ......
Read more >
Custom fields on the Client Info screen - MINDBODY Support
To get to the custom fields screen,. Go to your Manager Tools screen, click on Settings, and then click Client Profile Custom Fields....
Read more >
Custom Field Settings for Clients and Contacts
Client and Contact Custom Field Settings. ClientSuccess Admins or Managers can edit custom fields under Global Settings > Field Settings.
Read more >
Allow or deny custom clients in Office 365 sign on policy
Filter specific clients in an Office 365 app sign on rule to allow or deny them access to Office 365. Allow only trusted...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found