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

fix(log): set info log level by default for the entire application #4451

Merged
merged 3 commits into from
Jan 15, 2024

Conversation

bnjjj
Copy link
Contributor

@bnjjj bnjjj commented Jan 9, 2024

By default the log level of the application if RUST_LOG is not set is info and if you provide --log or APOLLO_RUST_LOG value then it overrides the default info log level with apollo_router=... because it only impacts the apollo_router crate, not external custom plugin and so one.

By doing this fix, by default if you have a custom plugin with info logs or metrics you won't have to enforce RUST_LOG=info everytime, it will work as expected.

Note: it doesn't impact the behavior of RUST_LOG if you set it.

Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Tests added and passing3
    • Unit Tests
    • Integration Tests
    • Manual Tests

Exceptions

Note any exceptions here

Notes

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
@bnjjj bnjjj self-assigned this Jan 9, 2024

This comment has been minimized.

@router-perf
Copy link

router-perf bot commented Jan 9, 2024

CI performance tests

  • events_big_cap_high_rate - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity
  • events_without_dedup - Stress test for events with a lot of users and deduplication DISABLED
  • events - Stress test for events with a lot of users and deduplication ENABLED
  • large-request - Stress test with a 1 MB request payload
  • step - Basic stress test that steps up the number of users over time
  • xlarge-request - Stress test with 10 MB request payload
  • reload - Reload test over a long period of time at a constant rate of users
  • no-graphos - Basic stress test, no GraphOS.
  • events_callback - Stress test for events with a lot of users and deduplication ENABLED in callback mode
  • xxlarge-request - Stress test with 100 MB request payload
  • step-jemalloc-tuning - Clone of the basic stress test for jemalloc tuning
  • events_without_dedup_callback - Stress test for events with a lot of users and deduplication DISABLED using callback mode
  • const - Basic stress test that runs with a constant number of users
  • events_big_cap_high_rate_callback - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity using callback mode

bnjjj added 2 commits January 9, 2024 16:29
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Copy link
Contributor

@BrynCooke BrynCooke left a comment

Choose a reason for hiding this comment

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

@bnjjj
Copy link
Contributor Author

bnjjj commented Jan 10, 2024

@BrynCooke I think the documentation is still accurate, I didn't change the behavior. I just fixed it

@garypen
Copy link
Contributor

garypen commented Jan 11, 2024

The docs need to updated: https://www.apollographql.com/docs/router/configuration/telemetry/exporters/logging/overview/#log-level

Also @garypen do you agree with the overall change?

The motivation of the last adjustment to APOLLO_ROUTER_LOG was to limit its scope to "just router stuff". We restored RUST_LOG functionality to what a rust developer would expect (i.e.: you can do whatever is supported by the RUST_LOG filtering). I think there was an oversight in that fix which mean that APOLLO_ROUTER_LOG didn't apply to plugins, so if you wanted to see logs from plugins you had to use RUST_LOG.

If this fix is addressing that shortcoming, i.e.: plugins observe the same logging behaviour as the main router, then that is correct.

It looks to me like it might also change the value for non-plugin crates, e.g.: hyper, and, if it does, then I don't think that would be desirable.

@bnjjj
Copy link
Contributor Author

bnjjj commented Jan 11, 2024

@garypen

If this fix is addressing that shortcoming, i.e.: plugins observe the same logging behaviour as the main router, then that is correct.

That's the goal yes.

It looks to me like it might also change the value for non-plugin crates, e.g.: hyper, and, if it does, then I don't think that would be desirable.

I don't think it will change the value for non plugin crate like hyper because by default it's set to info. That's what I'm doing basically, making sure the default is still info even if we set a specific log level for apollo router and plugins.

@bnjjj bnjjj requested a review from BrynCooke January 11, 2024 09:23
@bnjjj bnjjj merged commit 81fe06f into dev Jan 15, 2024
12 checks passed
@bnjjj bnjjj deleted the bnjjj/fix_log_level branch January 15, 2024 15:17
@abernix abernix mentioned this pull request Jan 19, 2024
smihica pushed a commit to smihica/router that referenced this pull request Feb 17, 2024
…pollographql#4451)

By default the log level of the application if `RUST_LOG` is not set is
`info` and if you provide `--log` or `APOLLO_RUST_LOG` value then it
overrides the default `info` log level with `apollo_router=...` because
it only impacts the `apollo_router` crate, not external custom plugin
and so one.

By doing this fix, by default if you have a custom plugin with info logs
or metrics you won't have to enforce `RUST_LOG=info` everytime, it will
work as expected.

> Note: it doesn't impact the behavior of `RUST_LOG` if you set it.

---------

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
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.

5 participants