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

Error is raised: AttributeError: 'RequestStats' object has no attribute 'log_request' #865

Closed
DuoyueBa opened this issue Aug 16, 2018 · 3 comments

Comments

@DuoyueBa
Copy link

Description of issue / feature request

In my test, I need to create a RequestStats and invoke RequestStats.log_request(). But sometimes the following error is thrown. Could you please tell me how to get locust version RequestStats.log_request() is available in test case script? Thank you!

AttributeError: 'RequestStats' object has no attribute 'log_request'

Expected behavior

RequestStats.log_request() is available in test case.

Actual behavior

RequestStats.log_request() is not available.

Environment settings (for bug reports)

  • OS:
  • Python version: 2.7.15
  • Locust version: 0.8

Steps to reproduce (for bug reports)

TBD - example code appreciated

@aldenpeterson-wf
Copy link
Contributor

Can you include example code?

It's not clear what "sometimes" means or how you are seeing this error.

@heyman
Copy link
Member

heyman commented Aug 17, 2018

If you're trying to log a request manually you should do that by firing the request_success event:

from locust import events

events.request_success.fire(
    request_type="GET", 
    name="/some_path", 
    response_time=42, 
    response_length=1337,
)

@DuoyueBa
Copy link
Author

Thank you! I know how to use it now.

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

No branches or pull requests

3 participants