Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

handle ignore_status_codes defined as strings #109

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

This should solve the problem with NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERROR_CODES not working as expected.

For example, if you want to ignore in your 401 errors, and 404 errors, you can set:

NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERROR_CODES=404,401

and it should work with that change.

@pierrevalade pierrevalade commented on the diff Jan 24, 2014

test/urltils.test.js
@@ -123,6 +123,16 @@ describe("NR URL utilities", function () {
it("should mark a request for enhanced calm (brah) as an error", function () {
return expect(urltils.isError(config, 420)).true;
});
+
+ it("should handle ignore_status_codes defined as strings", function () {
+ var config = {error_collector : {ignore_status_codes : ['404', '401']}};
+ return expect(urltils.isError(config, 401)).false;
+ });
+
+ it("should handle ignore_status_codes defined as integers", function () {
@pierrevalade

pierrevalade Jan 24, 2014

this was working before, just added one more test to make sure

@pierrevalade pierrevalade commented on the diff Jan 24, 2014

test/urltils.test.js
@@ -123,6 +123,16 @@ describe("NR URL utilities", function () {
it("should mark a request for enhanced calm (brah) as an error", function () {
return expect(urltils.isError(config, 420)).true;
});
+
+ it("should handle ignore_status_codes defined as strings", function () {
@pierrevalade

pierrevalade Jan 24, 2014

this is where the previous code was not working as expected

Contributor

othiym23 commented Jan 24, 2014

Ah, this would explain a bug people have been seeing intermittently since the launch of the module. Good find! Thanks for passing this on!

Because isError is called at least once for each request, I think I want a solution that doesn't require the codes list to be reconverted on every single call. I'll play around with this and tell you what I come up with.

Good point.

Contributor

othiym23 commented Feb 1, 2014

Hi, Pierre! Sorry for the delay, but this is now fixed in 7d3b835, which is part of v1.3.1 of the module, now on npm. Thanks for the report!

@othiym23 othiym23 closed this Feb 1, 2014

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment