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

Print diagnose report from CLI #401

Merged
merged 20 commits into from
Jul 8, 2021
Merged

Print diagnose report from CLI #401

merged 20 commits into from
Jul 8, 2021

Conversation

jeffkreeftmeijer
Copy link
Member

@jeffkreeftmeijer jeffkreeftmeijer commented Jun 24, 2021

In order to get the CLI diagnose command up to speed with the output from the Ruby and Elixir integrations, we created https://github.com/appsignal/diagnose_tests, which is an specification that describes the desired output to use as a guide and check for the diagnose output. It's modeled after the diagnose command in Ruby, and will eventually be used to test and develop diagnose commands for all integrations.

This patch introduces diagnose_tests to the Node.js library, and implements a new diagnose command that matches the specification. Because of differences in the generated JSON reports, the diagnose output in the Node.js library is not an exact match with the Ruby integration. For those cases, the diagnose_tests specification has specific assertions for the Node.js. The goal is to eventually get rid of those, but we’re cutting this project here to be able to ship the new diagnose now, and have it checked on CI going forward.

Note: this patch depends on #402

@jeffkreeftmeijer jeffkreeftmeijer self-assigned this Jun 24, 2021
@jeffkreeftmeijer jeffkreeftmeijer force-pushed the diagnose branch 4 times, most recently from a3bd76b to 4fc72f5 Compare June 25, 2021 08:53
@jeffkreeftmeijer jeffkreeftmeijer marked this pull request as ready for review June 28, 2021 06:09
Copy link
Member

@thijsc thijsc left a comment

Choose a reason for hiding this comment

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

Nice!

@backlog-helper
Copy link

While performing the daily checks some issues were found with this Pull Request.


New issue guide | Backlog management | Rules | Feedback

Copy link
Member

@tombruijn tombruijn left a comment

Choose a reason for hiding this comment

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

Great on the human friendly output! Could you add a separate changeset for the updated output?

I notice some duplicate commits from #402 merged into main in this PR as well. Does it need a rebase?

Will the diagnose_tests repo also test the JSON payload in the future?

@@ -61,6 +61,7 @@ export const JS_TO_RUBY_MAPPING: { [key: string]: string } = {
debug: "debug",
log: "log",
logPath: "log_path",
logFilePath: "log_file_path",
Copy link
Member

@tombruijn tombruijn Jun 30, 2021

Choose a reason for hiding this comment

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

Is this line what adds it to the diagnose report as a config option? Because we shouldn't include it as a config option in the sent report, it's a config option users can directly set (only through the logPath config option). The path itself is already part of the paths section which that contains more details.

What I see in a sent report:

image

Copy link
Member Author

@jeffkreeftmeijer jeffkreeftmeijer Jul 5, 2021

Choose a reason for hiding this comment

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

This line was added because the diagnose command uses the JS_TO_RUBY_MAPPING object to fetch the names for each field. Because there was no name for the logFilePath field, it printed undefined: '/tmp/appsignal.log' before this change.

In Ruby, the log_path and log_file_path aren't printed in the configuration at all.I'll update the test in diagnose_tests to make sure this isn't the case in Node.js either, so we can remove this line again.

- cache restore packages-$SEMAPHORE_GIT_SHA-$SEMAPHORE_GIT_BRANCH-v$NODE_VERSION
- git submodule init
- git submodule update
- LANGUAGE=nodejs test/integration/diagnose/bin/test
Copy link
Member

Choose a reason for hiding this comment

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

Can we disable the debug mode in the diagnose tests now? I see a lot of debug output there.

@tombruijn
Copy link
Member

@jeffkreeftmeijer we'll need to rebase this on the build matrix. Let me know if you need help with that.

@jeffkreeftmeijer
Copy link
Member Author

@tombruijn I’m working on some support issues today, so it would be nice if you could pick this up. If you don’t have time, I’ll do it early next week.

diagnose:
- git submodule init
- git submodule update
- LANGUAGE=nodejs test/integration/diagnose/bin/test
Copy link
Member

Choose a reason for hiding this comment

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

@jeffkreeftmeijer I've rebased this branch on the build matrix. I've added the diagnose tests as an "extra test" for the node.js package so it gets run for every node.js version as well.

@jeffkreeftmeijer jeffkreeftmeijer force-pushed the diagnose branch 2 times, most recently from 6797c84 to 8d9b7bf Compare July 5, 2021 11:26
@jeffkreeftmeijer
Copy link
Member Author

I’ve updated this pull request to remove the logFilePath field and remove the debug output on CI.

console.log(`Validation`)
console.log(
` Validating Push API key: ${this.colorize(
data["validation"]["push_api_key"]
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if it's in scope but I noticed that this output isn't accurate.

Given this config output (with an undefined push_api_key, which I also don't know if we should print it as undefined):

Configuration
  ...
  push_api_key: undefined

I get this validation:

Validation
  Validating Push API key: valid

See also the admin view of this report: https://appsignal.com/admin/diagnose_reports/60e41eb35ac13f2d186f711f

Copy link
Member Author

Choose a reason for hiding this comment

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

That should be caused by #408, which causes the result to return “valid” for any input. I’ve created a separate issue to fix that to make sure this moves along.

Copy link
Member

@tombruijn tombruijn left a comment

Choose a reason for hiding this comment

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

See previous comments, GitHub still shows me I have approved it 🤷‍♂️

@tombruijn
Copy link
Member

Can you add a changeset for this PR? Something about diagnose report improvements.

@jeffkreeftmeijer jeffkreeftmeijer merged commit 87155be into main Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants