You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2020/07/26 03:51:35 UTC
[skywalking-nodejs] 10/23: Report hostname as service instance
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-nodejs.git
commit 863434b7ba12e542171c3090804dc248b1780599
Author: kezhenxu94 <ke...@163.com>
AuthorDate: Tue Jun 23 23:27:25 2020 +0800
Report hostname as service instance
---
src/config/AgentConfig.ts | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/config/AgentConfig.ts b/src/config/AgentConfig.ts
index 56f010b..f50a7bc 100644
--- a/src/config/AgentConfig.ts
+++ b/src/config/AgentConfig.ts
@@ -17,17 +17,23 @@
*
*/
+import * as os from 'os';
+
export type AgentConfig = {
serviceName?: string;
serviceInstance?: string;
collectorAddress?: string;
authorization?: string;
maxBufferSize?: number;
-}
+};
export default {
serviceName: process.env.SERVICE_NAME || 'your-nodejs-service',
- serviceInstance: process.env.SERVICE_INSTANCE || 'your-node-js-instance',
+ serviceInstance:
+ process.env.SERVICE_INSTANCE ||
+ ((): string => {
+ return os.hostname();
+ })(),
collectorAddress: process.env.COLLECTOR_ADDRESS || '127.0.0.1:11800',
authorization: process.env.AUTHORIZATION,
maxBufferSize: process.env.MAX_BUFFER_SIZE || '1000',