forked from PavinStrickland/python-sensor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrpcserver.py
More file actions
23 lines (15 loc) · 733 Bytes
/
Copy pathrpcserver.py
File metadata and controls
23 lines (15 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2019
from xmlrpc.server import SimpleXMLRPCServer
import opentracing
def dance(payload, carrier):
ctx = opentracing.tracer.extract(opentracing.Format.HTTP_HEADERS, carrier)
with opentracing.tracer.start_active_span('RPCServer', child_of=ctx) as scope:
scope.span.set_tag("span.kind", "entry")
scope.span.set_tag("rpc.call", "dance")
scope.span.set_tag("rpc.host", "rpc-api.instana.com:8261")
return "♪┏(°.°)┛┗(°.°)┓%s┗(°.°)┛┏(°.°)┓ ♪" % str(payload)
server = SimpleXMLRPCServer(("localhost", 8261))
print("Listening on port 8261...")
server.register_function(dance, "dance")
server.serve_forever()