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

feat: send metrics to NR only when installed as NPM binary #2

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

smoya
Copy link
Owner

@smoya smoya commented Nov 21, 2023

Description

This PR enables the New Relic sink only when the CLI runs as binary installed by NPM (npm install -g @asyncapi/cli). Otherwise, metrics are just printed to stdout (Through the StdOut sink).
In order to do that, I created a new file in bin directory called bin/run_bin which is the one the binary will call. It is not specified in the bin section of the package.json.

This PR also updates the @smoya/asyncapi-adoption-metrics dependency to latest and adapts the code to latest renamings in such library.

cc @peter-rr

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@smoya smoya force-pushed the feat/newRelicOnProd branch from 1994f4d to 981ed18 Compare November 21, 2023 21:20
@smoya smoya force-pushed the feat/adoptionMetrics branch from c9027b5 to e9e79f6 Compare November 22, 2023 21:36
@smoya smoya force-pushed the feat/newRelicOnProd branch from 981ed18 to 82960a1 Compare November 23, 2023 09:58
@@ -82,8 +82,7 @@ export default class Convert extends Command {
metadata['success'] = true;
metadata['from_version'] = document.version();
metadata['to_version'] = flags['target-version'];
console.log(metadata);
Copy link
Owner Author

Choose a reason for hiding this comment

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

Tests were failing due to this console.log printing things to stdout. Some of our integration tests are based on the stdout made by the cli and this was polluting it.

@smoya
Copy link
Owner Author

smoya commented Nov 23, 2023

I'm gonna merge this PR. CI fails because of linter complaining about complexity on some methods. This is due to a lot of boilerplate we are pasting into the commands for sending the metrics.

We should definitely simplify that code that is basically repeated all around. See https://github.com/smoya/cli/actions/runs/6968132068/job/18961404969?pr=2

cc @peter-rr

@smoya smoya merged commit 4c7839d into feat/adoptionMetrics Nov 23, 2023
4 of 9 checks passed
@smoya smoya deleted the feat/newRelicOnProd branch November 23, 2023 10:04
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.

1 participant