|
10 | 10 | import instana.singletons
|
11 | 11 |
|
12 | 12 | from .json_span import (CassandraData, CouchbaseData, CustomData, Data, HttpData, JsonSpan, LogData,
|
13 |
| - MySQLData, PostgresData, RabbitmqData, RedisData, RenderData, |
| 13 | + MongoDBData, MySQLData, PostgresData, RabbitmqData, RedisData, RenderData, |
14 | 14 | RPCData, SDKData, SoapData, SQLAlchemyData)
|
15 | 15 |
|
16 | 16 | from .log import logger
|
|
25 | 25 | class InstanaRecorder(SpanRecorder):
|
26 | 26 | THREAD_NAME = "Instana Span Reporting"
|
27 | 27 | registered_spans = ("aiohttp-client", "aiohttp-server", "cassandra", "couchbase", "django", "log",
|
28 |
| - "memcache", "mysql", "postgres", "rabbitmq", "redis", "render", "rpc-client", |
| 28 | + "memcache", "mongo", "mysql", "postgres", "rabbitmq", "redis", "render", "rpc-client", |
29 | 29 | "rpc-server", "sqlalchemy", "soap", "tornado-client", "tornado-server",
|
30 | 30 | "urllib3", "wsgi")
|
31 | 31 |
|
32 | 32 | http_spans = ("aiohttp-client", "aiohttp-server", "django", "http", "soap", "tornado-client",
|
33 | 33 | "tornado-server", "urllib3", "wsgi")
|
34 | 34 |
|
35 |
| - exit_spans = ("aiohttp-client", "cassandra", "couchbase", "log", "memcache", "mysql", "postgres", |
36 |
| - "rabbitmq", "redis", "rpc-client", "sqlalchemy", "soap", "tornado-client", "urllib3") |
| 35 | + exit_spans = ("aiohttp-client", "cassandra", "couchbase", "log", "memcache", "mongo", "mysql", "postgres", |
| 36 | + "rabbitmq", "redis", "rpc-client", "sqlalchemy", "soap", "tornado-client", "urllib3", |
| 37 | + "pymongo") |
37 | 38 |
|
38 | 39 | entry_spans = ("aiohttp-server", "django", "wsgi", "rabbitmq", "rpc-server", "tornado-server")
|
39 | 40 |
|
@@ -237,6 +238,16 @@ def build_registered_span(self, span):
|
237 | 238 | tskey = list(data.custom.logs.keys())[0]
|
238 | 239 | data.pg.error = data.custom.logs[tskey]['message']
|
239 | 240 |
|
| 241 | + elif span.operation_name == "mongo": |
| 242 | + service = "%s:%s" % (span.tags.pop('host', None), span.tags.pop('port', None)) |
| 243 | + namespace = "%s.%s" % (span.tags.pop('db', "?"), span.tags.pop('collection', "?")) |
| 244 | + data.mongo = MongoDBData(service=service, |
| 245 | + namespace=namespace, |
| 246 | + command=span.tags.pop('command', None), |
| 247 | + filter=span.tags.pop('filter', None), |
| 248 | + json=span.tags.pop('json', None), |
| 249 | + error=span.tags.pop('command', None)) |
| 250 | + |
240 | 251 | elif span.operation_name == "log":
|
241 | 252 | data.log = {}
|
242 | 253 | # use last special key values
|
|
0 commit comments