Skip to content

Instantly share code, notes, and snippets.

@bsiegel
Created May 23, 2019 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsiegel/b4613b2788e78304cd4b966d7706201f to your computer and use it in GitHub Desktop.
Save bsiegel/b4613b2788e78304cd4b966d7706201f to your computer and use it in GitHub Desktop.
diff --git a/sdk/servicebus/service-bus/src/connectionContext.ts b/sdk/servicebus/service-bus/src/connectionContext.ts
index 968a3e85..f81ebb12 100644
--- a/sdk/servicebus/service-bus/src/connectionContext.ts
+++ b/sdk/servicebus/service-bus/src/connectionContext.ts
@@ -11,7 +11,8 @@ import {
CreateConnectionContextBaseParameters,
Dictionary,
delay,
- TokenProvider
+ TokenProvider,
+ isNode
} from "@azure/amqp-common";
import { ServiceBusClientOptions } from "./serviceBusClient";
import { ClientEntityContext } from "./clientEntityContext";
@@ -39,9 +40,15 @@ export namespace ConnectionContext {
* @property {string} userAgent The user agent string for the ServiceBus client.
* See guideline at https://github.com/Azure/azure-sdk/blob/master/docs/design/Telemetry.mdk
*/
- export const userAgent: string = `azsdk-js-azureservicebus/${
- packageJsonInfo.version
- } (NODE-VERSION ${process.version}; ${os.type()} ${os.release()})`;
+ function getUAString(): string {
+ let uaString = `azsdk-js-azureservicebus/${packageJsonInfo.version}`;
+ if (isNode) {
+ uaString += ` (NODE - VERSION ${process.version}; ${os.type()} ${os.release()})`;
+ }
+ return uaString;
+ }
+
+ export const userAgent: string = getUAString();
export function create(
config: ConnectionConfig,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment