Skip to main content

A performance tracer application.

Project description

Read here for full documentation

Dolon

The name Dolon comes from a spy in Homer’s Iliad.

dolon is a library that interfaces with the mnemic service to trace real time data; requires Python 3.6 or later and talks to the mnemic service that must be running in an accessible host.

dolon’s recommended way to install it is to use pip:

pip install dolon

Mnemic

Mnemic refers to the ability to retain memory.

mnemic is the backend that dolon talks to and also exposes the related front end as a web page. The easiest way to install it is using docker.

docker run --name mnemic-db -e POSTGRES_PASSWORD=postgres123 -p 15432:5432 -d jpazarzis/mnemic-db
docker run --name mnemic-back-end --add-host host.docker.internal:host-gateway -p 12013:12013/udp  -e POSTGRES_CONN_STR='postgresql://postgres:postgres123@172.17.0.1:15432/mnemic' -e BACK_END_PORT='12013'  -d jpazarzis/mnemic-backend
docker run --name mnemic-front-end -e POSTGRES_CONN_STR='postgresql://postgres:postgres123@172.17.0.1:15432/mnemic'  -e FRONT_END_PORT='12111' -p 12111:12111  -d jpazarzis/mnemic-front-end

High level View

The following picture shows the components that are involved in mnemic:

high level view

The backend consists of a service that runs as a docker container. It receives messages from the application to profile and stores then in the database. It also exposes a UI client making the profiling data discoverable and visible by a browser session.

Quick Example

"""Mnemic hello_word program."""

import asyncio
import random

import tracemalloc

tracemalloc.start()

import dolon.trace_client as tc


async def tracer():
    """Plain vanilla tracer."""
    tracer_name = "hello-world"
    host = "localhost"
    port = 12013
    frequency = 1
    await tc.start_tracer(
        tracer_name,
        frequency,
        host,
        port,
        tc.mem_allocation,
        tc.active_tasks,
        tc.cpu_percent
    )


async def time_and_memory_consuming_func():
    """Allocates some memory for some time!"""
    _ = [i for i in range(10000)]
    await asyncio.sleep(random.uniform(0.1, 3))


async def main():
    """The main function to profile."""
    while 1:
        asyncio.ensure_future(time_and_memory_consuming_func())
        await asyncio.sleep(0.4)


if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    asyncio.ensure_future(tracer())
    loop.run_until_complete(main())

After running the above program for several minutes the screen that we will see when accessing the UI from the browser using localhost:12111 will be similar to the following:

https://user-images.githubusercontent.com/67707281/120404061-84847400-c313-11eb-8c7b-9b6c629d4c67.png

If we stop and restart the program then as we can see in the following picture we will see another key in the tree control under the same trace run name (hello-world in our example) which will acculate the new tracing info:

https://user-images.githubusercontent.com/67707281/120406727-88b39000-c319-11eb-93b7-875f1ee96f19.png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dolon-0.2.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

dolon-0.2.0-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file dolon-0.2.0.tar.gz.

File metadata

  • Download URL: dolon-0.2.0.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for dolon-0.2.0.tar.gz
Algorithm Hash digest
SHA256 32ac18a16db8f8ede22541659212c6e735dff3ecdf35dce468a8dd68967fe5a1
MD5 6498fcc0c639d722e367d3400994f733
BLAKE2b-256 42e40d4b9b991f38eb60c2971f4cd94c8e5d105eb8d2cf715367c0b7f8a08252

See more details on using hashes here.

File details

Details for the file dolon-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dolon-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for dolon-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a6d4ac951cd3f086d21e5608f8be12544ac62a281c5e2835c95e61eb0d5062f
MD5 8d53b0f4962771a22f57b193194f178b
BLAKE2b-256 9109cd1239a089a43a8ecd91194634ad1e447c08c787ae27ef0fc675c393f4d8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page