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

Load Generator (locust) doesn't make the application emit traces #2051

Open
aloussase opened this issue Feb 19, 2025 · 11 comments
Open

Load Generator (locust) doesn't make the application emit traces #2051

aloussase opened this issue Feb 19, 2025 · 11 comments
Labels
bug Something isn't working python Pull requests that update Python code

Comments

@aloussase
Copy link

Hello,

I am using the Load Generator included with the demo.

I would expect it to cause the application to emit traces, but it doesn't.

I am inspecting the traces on WireShark with the following filter:

tcp.port == 8080 && http && http.request.uri contains "traces" && http.request

This works when I manually use the application, but not when using the Load Generator.

My guess is just hitting the API endpoints does not cause the app to emit trace data.

When exactly is trace data emitted?

@julianocosta89
Copy link
Member

Hello @aloussase, the load generator does generate traffic and emit traces.
Are you changing anything on your end?
If you run the Demo as is, you can navigate to Jaeger and visualise traces without navigating to any page from the Demo.

@aloussase
Copy link
Author

Hello @julianocosta89 thanks for your reply

2025-02-19.20-54-54.mp4

I have added a demo of the behaviour I am experiencing. As you can see, the load generator doesn't seem to produce traces.

Actually, before trying the load generator I wrote some scripts to simulate some scenarios, since I didn't know about the load generator. But these scripts did not cause the application to emit traces either.

This makes me think that traces are being emitted from somewhere else.

Do you see anything I might be doing wrong in this demo?

Thank you very much.

@julianocosta89
Copy link
Member

You are correct, I've just tested and it seems that playwright is not working properly.

Thanks for reporting it, we'll look into it

@julianocosta89 julianocosta89 added bug Something isn't working python Pull requests that update Python code labels Feb 20, 2025
@puckpuck
Copy link
Contributor

I wonder if the default Otel SDK batch 5000ms timeout is the cause here?

@aloussase
Copy link
Author

I am now using this code with Playwright to simulate the application:

from playwright.sync_api import sync_playwright, expect
import random
import logging

import config


logger = logging.getLogger(__name__)


def execute(n: int = 1):
    """This workflow adds some products to the cart and then checks out."""
    with sync_playwright() as p:
        browser = p.chromium.launch()

        context = browser.new_context()
        context.set_default_timeout(5000)

        iterations = 0

        while iterations < n:
            page = context.new_page()
            page.goto(config.get_app_url())

            product_list = page.locator('css=[data-cy="product-list"]')
            logging.debug("Got products list")

            product_card = product_list.locator("a").nth(random.randrange(0, 4))
            product_url = product_card.get_attribute("href")
            logging.debug("Selected a product card: %s", product_url)

            page.goto(f'{config.get_app_url()}{product_url}') 
            page.locator('css=[data-cy="product-add-to-cart"]').click()
            logging.debug(f"Added product to cart")

            page.locator('css=[data-cy="checkout-place-order"]').click()
            logging.debug('Checked out')

            iterations += 1

        browser.close()

With this code I do see the traces being emitted.

I don't know if this helps in any way.

@julianocosta89
Copy link
Member

@aloussase I've just merged a change on the loadgen, could you try to build it and validate if it is back to working?

I was able to get it up, running and producing load, just want to double check ✅ ✅

@julianocosta89
Copy link
Member

I've created this issue on the open-feature repo: open-feature/python-sdk-contrib#198

@aloussase
Copy link
Author

Hi @julianocosta89 , I just pulled from main but the problem seems to persist on my side.
I did the same as in the first demo I sent here.

@puckpuck
Copy link
Contributor

When running from main, I see traces that originate from frontend-web with operations of documentLoad and documentFetch, which would indicate they are coming from Playwright within the load generator.

These same traces are not present in Demo 2.0.0, released earlier in the week.

@julianocosta89
Copy link
Member

@puckpuck perfect, I'll cut a 2.0.1 release later

@julianocosta89
Copy link
Member

@aloussase just running some tests here and I can confirm that loadgen is working:

This is a span that has the attribute app.synthetic_request=true:
Image

The only thing that I don't see is a trace that starts on the loadgen and goes through frontend-web, did you have that in Jaeger when you changed the Playwright script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python Pull requests that update Python code
Projects
None yet
Development

No branches or pull requests

3 participants