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

Enhancement: Capture and report back the log statements from journey script. #676

Open
ZaidMomin1 opened this issue Dec 8, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@ZaidMomin1
Copy link

Hi Team,

In recent past we were trying to check if there's a way to capture and report back the log statements from journey script to observability uptime monitor and there's was discussion about the same here.

Basis the discussion it was concluded to open up an enhancement request for the same.

Thanks,
Zaid

@vigneshshanmugam
Copy link
Member

vigneshshanmugam commented Dec 21, 2022

@ZaidMomin1 Thanks for opening the Enhancement request. Just for myself to clarify, Do you want

  1. Log statements from the Journey script to be associated with the Monitor OR
  2. Log statements from the Browser window which is the URL under test. If this was the case, we do collect those log statements, but will be reported only for failed journeys to save on storage.

For no 1, we would need to implement something like this #188

@ZaidMomin1
Copy link
Author

ZaidMomin1 commented Aug 22, 2023

Hi @vigneshshanmugam

Apologies for the extremely delayed response.

Consider I have a below step which calls the wrapper methods like navigateTo, waitForElementToBeVisible etc and displays the message App successfully launched once everything is done (this is a simple example)

step('Launch app', async () => {
        let joinNowButton = '#joinNow'
        await navigateTo(page, url)
        if (!(await isElementVisible(page, joinNowButton)))
            await reloadPage(page)
        await waitForElementToBeVisible(page, joinNowButton)
        let joinNowButtonText = await getElementInnerText(page, joinNowButton)
        expect(joinNowButtonText).toBe("JOIN NOW")
       console.log(`App successfully launched`)
    });

Once this step is executed on the monitor, the way script executed is captured it would be great if the console logs are displayed on the monitor as well.

I'm assuming issue-188 that you mentioned would solve this problem.

@paulb-elastic
Copy link
Contributor

@vigneshshanmugam would #817 help with this (looks like we're including console.log in those too, assuming there aren't too many messages in total)?

@vigneshshanmugam
Copy link
Member

vigneshshanmugam commented Aug 25, 2023

would #817 help with this (looks like we're including console.log in those too, assuming there aren't too many messages in total)?

#817 only captures the browser log messages, we don't associate all the console logs from the Journey scripts itself.

Once this step is executed on the monitor, the way script executed is captured it would be great if the console logs are displayed on the monitor as well.

We don't have this capability right now, but we capture raw logs from the STDOUT and STERR, but don't use show them on the UI under the monitor. Yeah #188 is the way to go to get this associated with the step level information, We will update this issue once we start working on this. Thanks!

@vigneshshanmugam vigneshshanmugam added the enhancement New feature or request label Oct 17, 2023
@shahzad31
Copy link
Contributor

@ZaidMomin1 @vigneshshanmugam wouldn't using page.evaluate solve this use?

i mean using it

    await page.evaluate(() => {
      console.log('test lgog');
    });

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

No branches or pull requests

4 participants