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

Improve IF logging protocols #753

Merged
merged 30 commits into from
Jun 11, 2024
Merged

Improve IF logging protocols #753

merged 30 commits into from
Jun 11, 2024

Conversation

manushak
Copy link
Contributor

Types of changes

  • Enhancement (project structure, spelling, grammar, formatting)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

A description of the changes proposed in the Pull Request

  • add --debug command functionality
  • add debug log messages into the codebase accordingly

@manushak manushak self-assigned this May 31, 2024
@manushak manushak linked an issue May 31, 2024 that may be closed by this pull request
5 tasks
Copy link
Contributor

@jmcook1186 jmcook1186 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like something is not right here, see these logs for example:

DEBUG: 2024-05-31T12:29:04.237Z: teads-curve: Computing pipeline for `sum`
DEBUG: 2024-05-31T12:29:04.238Z: sum: Computing pipeline for `coefficient`
DEBUG: 2024-05-31T12:29:04.238Z: coefficient: Computing pipeline for `multiply`

the plugin names do not match (e.g. teads-curve: Computing pipeline for sum)

Also I don't see the console.x rerouting working. Can you confirm?

@manushak manushak requested a review from jmcook1186 May 31, 2024 13:09
Copy link
Contributor

@jmcook1186 jmcook1186 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - tested with two manifests from our examples folder and saw the logs I exected when running using --debug. Also tried injecting some dummy log statements into the builtins and saw their messages get emitted via the IF logger during the execution, which is great.

Thanks

@narekhovhannisyan
Copy link
Member

Screenshot 2024-06-03 at 17 48 01

this log appear whenever if is executed without adding --debug flag.

src/index.ts Outdated
import {parseIEProcessArgs} from './util/args';
import {andHandle} from './util/helpers';
import {logger} from './util/logger';
import {validateManifest} from './util/validations';

import {STRINGS} from './config';

const {DISCLAIMER_MESSAGE} = STRINGS;
const {DISCLAIMER_MESSAGE, STARTING_IMPACT_FRAMEWORK, EXITING_IF} = STRINGS;
Copy link
Member

@narekhovhannisyan narekhovhannisyan Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if exiting if, then starting if

Copy link
Member

@narekhovhannisyan narekhovhannisyan Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manushak you got this wrong. in starting you have written impact framework, however in exiting just if. So for fixing this inconsistency please use if key in both places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, I've got it now. The variable names are consistent with the message itself.
@jmcook1186, maybe we need to rename 'Starting Impact framework' to 'Starting IF' to be consistent with 'Exiting IF'. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmcook1186
Copy link
Contributor

jmcook1186 commented Jun 3, 2024

hi @manushak I found a problem wit this PR - it doesn't output to --stdout unless --debug is raised.

e.g. npm run ie -- -m manifests/plugins/sci/success.yml --stdout

prints nothing unless you add --debug, in which case you get the output in the console.

Copy link
Contributor

@MariamKhalatova MariamKhalatova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manushak
Syncing prameters is shown at the beginning of the log and without DEBUG label. So no matter running with --debug or without it. The console.debug(SYNCING_PARAMETERS); was called at wrong place

Screenshot 2024-06-07 at 12 11 38 AM

@manushak manushak requested a review from MariamKhalatova June 7, 2024 14:19
@MariamKhalatova
Copy link
Contributor

MariamKhalatova commented Jun 8, 2024

@manushak we are getting ton of checking aggregation method logs. Each field should appear once.
mock-obs-time-sync.yml was used to reproduce.

Screenshot 2024-06-08 at 12 42 50 PM Screenshot 2024-06-08 at 12 43 31 PM

@MariamKhalatova
Copy link
Contributor

@manushak when running if with debug flag, exhaust's logs are gone under INFO: .

Screenshot 2024-06-08 at 1 42 54 PM Screenshot 2024-06-08 at 1 44 52 PM

@manushak
Copy link
Contributor Author

@manushak we are getting ton of checking aggregation method logs. Each field should appear once. mock-obs-time-sync.yml was used to reproduce.

Screenshot 2024-06-08 at 12 42 50 PM Screenshot 2024-06-08 at 12 43 31 PM

@MariamKhalatova we get these huge logs because it traverses every input field.
@jmcook1186 Wdyt is this the right behavior?

@MariamKhalatova
Copy link
Contributor

MariamKhalatova commented Jun 10, 2024

@manushak It's aggregation log and it's called repetitively for each input member (imagine what would happen with complex pipelines of 1000 nodes). There was memoize log function in code base, you can use that to log each one once.

@jmcook1186
Copy link
Contributor

@manushak @MariamKhalatova I think the aggregation check only needs to be displayed one time for each parameter (i.e. for each element in inputs[0]), as the operation is entirely idempotent - nothing can change between inputs[i] and inputs[i+1]...inputs[N] (or at least the probability is so low that it is not worth having the additional logs).

@manushak
Copy link
Contributor Author

@MariamKhalatova, I've fixed. Please test

/**
* Creates a handler for managing unique unit names.
*/
const setUniqueUnitName = (() => {
Copy link
Member

@narekhovhannisyan narekhovhannisyan Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have something like this in our codebase memoizedLog

you can reuse that with minor modifications for avoiding code duplication

@jmcook1186
Copy link
Contributor

what's the status of this @manushak @MariamKhalatova ? have @MariamKhalatova 's requested changes been addressed?

@manushak
Copy link
Contributor Author

what's the status of this @manushak @MariamKhalatova ? have @MariamKhalatova 's requested changes been addressed?

the requested changes have been fixed, and are waiting for testing

@MariamKhalatova MariamKhalatova merged commit 95e9526 into main Jun 11, 2024
2 checks passed
@MariamKhalatova MariamKhalatova deleted the debug-logger branch June 11, 2024 16:56
This was referenced Jun 11, 2024
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

Successfully merging this pull request may close these issues.

Improve IF logging protocols
5 participants