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: solve optimize command issue when sending data to New Relic #13

Merged

Conversation

peter-rr
Copy link
Collaborator

Description
Solving issue from optimize command when sending data to New Relic servers.
Basically, action.finished metric is not sent to NR servers probably because of the format accepted by New Relic API.

@peter-rr
Copy link
Collaborator Author

peter-rr commented Jan 31, 2024

The optimizations array is now displayed as an object when testing the command locally, i.e. the sink used is StdOut. However, the metric action.finished is not sent to New Relic servers yet.
cc @smoya

@peter-rr
Copy link
Collaborator Author

peter-rr commented Feb 5, 2024

The metric action.finished is now sent to New Relic servers. This is how optimizations property looks like after being converted to JSON format:

image

cc @smoya

@smoya
Copy link
Owner

smoya commented Feb 5, 2024

The metric action.finished is now sent to New Relic servers. This is how optimizations property looks like after being converted to JSON format:

image

cc @smoya

The value in optimizations you are sending is a plain string instead of an array. As per NR docs, attributes can only contain numbers, strings or booleans.

In order to allow filtering/querying/grouping/etc by those attributes, you will need to send them separated in different attributes. For example:

{
  "optimization_remove-components":  true,
  "optimization_reuse-components": true,
  "optimization_move-to-components": true,
  "success": true,
  "asyncapi_blablabla": "etc etc etc"
}

@peter-rr
Copy link
Collaborator Author

peter-rr commented Feb 5, 2024

Metadata attributes already adapted to NR requirements 👍
Now working on reducing the cognitive complexity introduced with this last commit.

src/commands/optimize.ts Outdated Show resolved Hide resolved
src/commands/optimize.ts Outdated Show resolved Hide resolved
src/commands/optimize.ts Outdated Show resolved Hide resolved
src/commands/optimize.ts Outdated Show resolved Hide resolved
src/commands/optimize.ts Outdated Show resolved Hide resolved
src/commands/optimize.ts Outdated Show resolved Hide resolved
src/commands/optimize.ts Outdated Show resolved Hide resolved
src/commands/optimize.ts Outdated Show resolved Hide resolved
@peter-rr
Copy link
Collaborator Author

peter-rr commented Feb 7, 2024

@peter-rr
Copy link
Collaborator Author

peter-rr commented Feb 8, 2024

Cognitive complexity issue solved and failing test fixed with this commit: 737f3ee

@peter-rr
Copy link
Collaborator Author

peter-rr commented Feb 8, 2024

@smoya
Ready for review 💪

Copy link
Collaborator Author

@peter-rr peter-rr left a comment

Choose a reason for hiding this comment

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

Refactor applied and --optimization flag working correctly now. Ready to merge 🚀

@peter-rr peter-rr merged commit 18059c9 into smoya:feat/adoptionMetrics Feb 19, 2024
5 of 8 checks passed
@peter-rr peter-rr deleted the fix/adoptMetrics-optimize-issue branch February 19, 2024 11:21
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.

2 participants