From 05acb13921cbaf7ea09492113aeeba29408ee5c9 Mon Sep 17 00:00:00 2001 From: Brooks Patton Date: Tue, 16 Oct 2018 10:23:01 -0600 Subject: [PATCH] NewRelic functions addCustomAttribute and addCustomAttributes takes strings and numbers (#29767) * AddCustomAttribute takes a string or a number * Added Brooks Patton to contributors for New Relic * Bumped minor version --- types/newrelic/index.d.ts | 7 ++++--- types/newrelic/newrelic-tests.ts | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/newrelic/index.d.ts b/types/newrelic/index.d.ts index 0c674e4646..a5fd434d99 100644 --- a/types/newrelic/index.d.ts +++ b/types/newrelic/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for newrelic 3.3 +// Type definitions for newrelic 3.4 // Project: http://github.com/newrelic/node-newrelic // Definitions by: Matt R. Wilson +// Brooks Patton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // https://docs.newrelic.com/docs/agents/nodejs-agent/api-guides/nodejs-agent-api @@ -64,14 +65,14 @@ export function setControllerName(name: string, action: string): void; * * Most recently set value wins. */ -export function addCustomAttribute(key: string, value: string): void; +export function addCustomAttribute(key: string, value: string|number): void; /** * Adds all custom attributes in an object to the current transaction. * * See documentation for `addCustomAttribute` for more information on setting custom attributes. */ -export function addCustomAttributes(atts: { [key: string]: string }): void; +export function addCustomAttributes(atts: { [key: string]: string|number }): void; /** * Tell the tracer whether to ignore the current transaction. diff --git a/types/newrelic/newrelic-tests.ts b/types/newrelic/newrelic-tests.ts index 3f99152c66..29eabfeb21 100644 --- a/types/newrelic/newrelic-tests.ts +++ b/types/newrelic/newrelic-tests.ts @@ -14,7 +14,9 @@ newrelic.setDispatcher("foo", "42"); // $ExpectType void newrelic.setControllerName("foo", "GET"); // $ExpectType void newrelic.addCustomAttribute("foo", "bar"); // $ExpectType void +newrelic.addCustomAttribute("foo", 42); // $ExpectType void newrelic.addCustomAttributes({ foo: "bar", baz: "bang" }); // $ExpectType void +newrelic.addCustomAttributes({ foo: "bar", baz: 42 }); // $ExpectType void newrelic.setIgnoreTransaction(true); // $ExpectType void