Debug

class Tribler.Core.Modules.restapi.debug_endpoint.DebugCPUEndpoint(session)[source]

This class handles request for information about CPU.

class Tribler.Core.Modules.restapi.debug_endpoint.DebugCPUHistoryEndpoint(session)[source]

This class handles request for information about CPU usage history.

render_GET(request)[source]
GET /debug/cpu/history

A GET request to this endpoint returns information about CPU usage history in the form of a list.

Example request:

curl -X GET http://localhost:8085/debug/cpu/history

Example response:

{
    "cpu_history": [{
        "time": 1504015291214,
        "cpu": 3.4,
    }, ...]
}
class Tribler.Core.Modules.restapi.debug_endpoint.DebugCircuitSlotsEndpoint(session)[source]

This class handles requests for information about slots in the tunnel overlay.

render_GET(request)[source]
GET /debug/circuits/slots

A GET request to this endpoint returns information about the slots in the tunnel overlay.

Example request:

curl -X GET http://localhost:8085/debug/circuits/slots

Example response:

{
    "open_files": [{
        "path": "path/to/open/file.txt",
        "fd": 33,
    }, ...]
}
class Tribler.Core.Modules.restapi.debug_endpoint.DebugCircuitsEndpoint(session)[source]

This class handles requests regarding the tunnel community debug information.

render_GET(request)[source]
GET /debug/circuits

A GET request to this endpoint returns information about the built circuits in the tunnel community.

Example request:

curl -X GET http://localhost:8085/debug/circuits

Example response:

{
    "circuits": [{
        "id": 1234,
        "state": "EXTENDING",
        "goal_hops": 4,
        "bytes_up": 45,
        "bytes_down": 49,
        "created": 1468176257,
        "hops": [{
            "host": "unknown"
        }, {
            "host": "39.95.147.20:8965"
        }],
        ...
    }, ...]
}
class Tribler.Core.Modules.restapi.debug_endpoint.DebugEndpoint(session)[source]

This endpoint is responsible for handing requests regarding debug information in Tribler.

class Tribler.Core.Modules.restapi.debug_endpoint.DebugLogEndpoint(session)[source]

This class handles the request for displaying the logs.

render_GET(request)[source]
GET /debug/log?process=<core|gui>&max_lines=<max_lines>

A GET request to this endpoint returns a json with content of core or gui log file & max_lines requested

Example request:

curl -X GET http://localhost:8085/debug/log?process=core&max_lines=5

Example response:

A JSON with content of the log file & max_lines requested, for eg. {

“max_lines” : 5, “content” :”INFO 1506675301.76 sqlitecachedb:181 Reading database version…

INFO 1506675301.76 sqlitecachedb:185 Current database version is 29 INFO 1506675301.76 sqlitecachedb:203 Beginning the first transaction… INFO 1506675301.76 upgrade:93 tribler is in the latest version,… INFO 1506675302.08 LaunchManyCore:254 lmc: Starting Dispersy…”

}

tail(file_handler, lines=1)[source]

Tail a file and get X lines from the end

class Tribler.Core.Modules.restapi.debug_endpoint.DebugMemoryDumpEndpoint(session)[source]

This class handles request for dumping memory contents.

render_GET(request)[source]
GET /debug/memory/dump

A GET request to this endpoint returns a Meliae-compatible dump of the memory contents.

Example request:

curl -X GET http://localhost:8085/debug/memory/dump

Example response:

The content of the memory dump file.

class Tribler.Core.Modules.restapi.debug_endpoint.DebugMemoryEndpoint(session)[source]

This class handles request for information about memory.

class Tribler.Core.Modules.restapi.debug_endpoint.DebugMemoryHistoryEndpoint(session)[source]

This class handles request for information about memory usage history.

render_GET(request)[source]
GET /debug/memory/history

A GET request to this endpoint returns information about memory usage history in the form of a list.

Example request:

curl -X GET http://localhost:8085/debug/memory/history

Example response:

{
    "memory_history": [{
        "time": 1504015291214,
        "mem": 324324,
    }, ...]
}
class Tribler.Core.Modules.restapi.debug_endpoint.DebugOpenFilesEndpoint(session)[source]

This class handles request for information about open files.

render_GET(request)[source]
GET /debug/open_files

A GET request to this endpoint returns information about files opened by Tribler.

Example request:

curl -X GET http://localhost:8085/debug/open_files

Example response:

{
    "open_files": [{
        "path": "path/to/open/file.txt",
        "fd": 33,
    }, ...]
}
class Tribler.Core.Modules.restapi.debug_endpoint.DebugOpenSocketsEndpoint(session)[source]

This class handles request for information about open sockets.

render_GET(request)[source]
GET /debug/open_sockets

A GET request to this endpoint returns information about open sockets.

Example request:

curl -X GET http://localhost:8085/debug/openfiles

Example response:

{
    "open_sockets": [{
        "family": 2,
        "status": "ESTABLISHED",
        "laddr": "0.0.0.0:0",
        "raddr": "0.0.0.0:0",
        "type": 30
    }, ...]
}
class Tribler.Core.Modules.restapi.debug_endpoint.DebugProfilerEndpoint(session)[source]

This class handles requests for the profiler.

render_DELETE(request)[source]
DELETE /debug/profiler

A PUT request to this endpoint stops the profiler.

Example request:

curl -X DELETE http://localhost:8085/debug/profiler

Example response:

{
    "success": "true"
}
render_GET(request)[source]
GET /debug/profiler

A GET request to this endpoint returns information about the state of the profiler. This state is either STARTED or STOPPED.

Example request:

curl -X GET http://localhost:8085/debug/profiler

Example response:

{
    "state": "STARTED"
}
render_PUT(request)[source]
PUT /debug/profiler

A PUT request to this endpoint starts the profiler.

Example request:

curl -X PUT http://localhost:8085/debug/profiler

Example response:

{
    "success": "true"
}
class Tribler.Core.Modules.restapi.debug_endpoint.DebugThreadsEndpoint(session)[source]

This class handles request for information about threads.

render_GET(request)[source]
GET /debug/threads

A GET request to this endpoint returns information about running threads.

Example request:

curl -X GET http://localhost:8085/debug/threads

Example response:

{
    "threads": [{
        "thread_id": 123456,
        "thread_name": "my_thread",
        "frames": ["my_frame", ...]
    }, ...]
}
class Tribler.Core.Modules.restapi.debug_endpoint.MemoryDumpBuffer(buf='')[source]

Meliae expects its file handle to support write(), flush() and __call__(). The StringIO class does not support __call__(), therefore we provide this subclass.