GithubHelp home page GithubHelp logo

Does add_listener work? about invokust HOT 3 OPEN

futuresharks avatar futuresharks commented on June 10, 2024
Does add_listener work?

from invokust.

Comments (3)

FutureSharks avatar FutureSharks commented on June 10, 2024

I'm not sure what you mean @komikoni. Can you write your give your full locustfile and what you are trying to achieve?

from invokust.

komikoni avatar komikoni commented on June 10, 2024

Thank you for your reply. (I'm sorry. It was a strange English sentence.)

I want to save the performance measurement results in a database And I want to see the results graphically at any time.
And I want to run them serverless.

As a result of searching, with invokest locust-influxdb-listener was found.
Later, I also found the Amazon Managed Service for Grafana (Preview).

However, influxdb has a Cloud service, but the version is different and it does not work, so I rewrote it for Amazon Timestream
I made a locust-timestream-listener.

But it didn't work with invokest.(It worked with normal locust)
I thought that the reason was that add_listener did not work in invokest, so I asked the question.

sample locustfile

from locust import between, events, tag, task, HttpUser

import sys,os
sys.path.append('##localpath##/locust-timestream-listener/') #TODO pip regist
from locust_timestream_listener import TimestreamListener, TimestreamSettings


@events.init.add_listener
def on_locust_init(environment, **_kwargs):
    print('on_locust_init')
    """
    Hook event that enables starting an timestream connection
    """
    # this settings matches the given docker-compose file
    timestreamSettings = TimestreamSettings(
        database = 'locust-result-1'
    )
    # start listerner with the given configuration
    TimestreamListener(env=environment, timestreamSettings=timestreamSettings)

class TestWebUser(HttpUser):

    wait_time = between(1,5)
         
    @tag('home_page')
    @task(1)
    def home_page(self):
        with self.client.get("/", catch_response=True) as response:
            if response.status_code != 200:
                response.failure("Got wrong response")
    
    @tag('connectors')
    @task(1)
    def workfront_connector(self):
        with self.client.get("/connectors/workfront", catch_response=True) as response:
            if 'Do More Work, Faster' not in response.text:
                response.failure("Expected test was not displayed")
            
    
    def on_start(self):
        print('New user was spawned')

from invokust.

FutureSharks avatar FutureSharks commented on June 10, 2024

I made a locust-timestream-listener.

Nice 👍

2 things to try:

  1. If you replace everything in on_locust_init with a print statement, do you see it in the logs?
  2. Does it work when you run this locally in python, like shown in the readme?

from invokust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.