[SERVER-28554] appname not avaible, while named client connected via mongos Created: 30/Mar/17  Updated: 27/Oct/23  Resolved: 04/Apr/17

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Aleksander Melnikov Assignee: Andy Schwerin
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux RHEL 6.8
gcc 5.4.0


Participants:

 Description   

Very important for us feature, to identify client processes, appname is not avaible while connecting over sharded cluster environment (e.g over mongos). appname only appear in log file, prodused by mongos.
If we connect named client to mongod directly - then currentOp show appname of the client:

2017-03-29T15:16:54.381+0700 I NETWORK  [conn1] received client metadata from 127.0.0.1:38611 conn1: { application: { *name: "MongoDB Shell"* }, driver: { name: "MongoDB Internal Client", version: ...

via client_metadata.cpp

   log() << "received client metadata from " << client->getRemote().toString() << " "
          << client->desc() << ": " << getDocument();

My question is how to patch mongo (mongos) sources, so this information be avaible in currentOp output - while caller of currentOp - connects over mongos. (I'm will be propose this behaviour avaible in general release, but now its important for us).



 Comments   
Comment by Andy Schwerin [ 04/Apr/17 ]

alm, I believe this information is included in the result of the mongos currentOp operation. Below is sample output I got from running currentOp from one shell while another shell was running a long-running find operation. I've elided everything except the relevant returned entry. Note the presence of the "appName" field in the currentOp output.

If this is not the behavior you are requesting, please re-open this ticket, but AFAICT, this works as designed.

MongoDB Enterprise mongos> db.currentOp().inprog[1]
{
	"desc" : "conn10",
	"threadId" : "139725075818240",
	"connectionId" : 10,
	"client_s" : "127.0.0.1:47666",
	"appName" : "MongoDB Shell",
	"active" : true,
	"opid" : "shard0000:1467",
	"secs_running" : 18,
	"microsecs_running" : NumberLong(18105219),
	"op" : "query",
	"ns" : "test.foo",
	"query" : {
		"find" : "foo",
		"filter" : {
			"$where" : "sleep(100000)"
		},
		"shardVersion" : [
			Timestamp(0, 0),
			ObjectId("000000000000000000000000")
		]
	},
	"planSummary" : "COLLSCAN",
	"numYields" : 0,
	"locks" : {
		"Global" : "r",
		"Database" : "r",
		"Collection" : "r"
	},
	"waitingForLock" : false,
	"lockStats" : {
		"Global" : {
			"acquireCount" : {
				"r" : NumberLong(2)
			}
		},
		"Database" : {
			"acquireCount" : {
				"r" : NumberLong(1)
			}
		},
		"Collection" : {
			"acquireCount" : {
				"r" : NumberLong(1)
			}
		}
	}
}

Comment by Aleksander Melnikov [ 04/Apr/17 ]

Hello @Andy Schwerin!

  1. The log output proves the transfer of the appname to mongos
  2. Appname not shown in currentOp while client is connected via mongos
  3. possible bug - appname was not add to metainfo in mongos (or not readed by currentOp from mongos metainfo)
  4. currentOp calls from same mongos instance from another client
Comment by Andy Schwerin [ 03/Apr/17 ]

I'm confused, alm, are you looking for output in the mongos log or in the result of currentOp? You say currentOp in your description, but you describe log output there, also.

Generated at Thu Feb 08 04:18:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.