Skip to content

Extension of Prometheus Metrics Endpoint #2792

Closed

Description

@gsailer

Hi @mrocklin,

Would you be willing to accept a contribution regarding the extension of the current metrics endpoints containing:

  • number of tasks in states
  • server tick duration

Looking forward to the contribution.

Activity

  1. mrocklin commented on Jun 21, 2019

    @mrocklin
    Member
  2. Fra-nk commented on Jun 25, 2019

    @Fra-nk

    Prometheus by default is built to handle a huge amount of metrics and since it's intended as a systems monitoring system, exposing verbose information is (imho) feasible.

    → I think the deciding factors if a metric should (not) be exposed should be

    • the cost of collecting the data (usually repeatedly)
    • high-level questions like "does exposing this value have security implications"
  3. mrocklin commented on Jun 25, 2019

    @mrocklin
    Member

    Under the criteria that @Fra-nk suggests:

    the cost of collecting the data (usually repeatedly)

    The number of tasks in states requires a full pass over the current tasks. There are possibly 1000 to 100000 tasks on a worker at any given time. Checking the status of each is probably fine to do every time prometheus checks in, assuming that happens every second or so. You might want to consider the cytoolz.frequencies function, which is fairly fast at counting things like this.

    d = frequencies(self.task_state.values())

    Tick duration seems fine. You might consider generalizing this to all current counters and digests. For background, we keep track of various metrics in code like this:

    if self.digests is not None:
    self.digests["transfer-bandwidth"].add(total_bytes / duration)
    self.digests["transfer-duration"].add(duration)
    self.counters["transfer-count"].add(len(response["data"]))
    self.incoming_count += 1

    This actually gets plotted in Dask's dashboard in the hidden /counters page. (mostly for internal development work). Exposing these same counters and digests through Prometheus seems natural. I would prefer a general solution here for all of them rather than one that focused on tick duration.

    high-level questions like "does exposing this value have security implications"

    From a security perspective I see nothing wrong with publishing this data.

  4. crepererum commented on Jun 25, 2019

    @crepererum
    Contributor

    Since I have worked on this, here are some details:

    At least number of tasks in states should not be a global metric but should rather be generated on demand in the metrics collector, similar to the implementation on the scheduler and the already existing template on the worker.

    For the tick duration, I'm not sure how this should be measured.

  5. crepererum commented on Jun 25, 2019

    @crepererum
    Contributor

    Ah, thanks @mrocklin for the insights. So the tick duration could be added in the similar fashion then. Just read it directly into the metric collector (see the linked scheduler implementation for an example).

  6. mrocklin commented on Jun 25, 2019

    @mrocklin
    Member

    Right, here is a minimal example:

    In [1]: from dask.distributed import Client
    
    In [2]: client = Client(processes=False)
    
    In [3]: worker = client.cluster.workers[0]
    
    In [4]: tdigest = worker.digests['tick-duration'].components[1]  # grab the middle-time component
    
    In [5]: tdigest.quantile(50)
    Out[5]: 0.0224759578704834
    

    Ideally we would do this for every digest and counter

  7. crepererum commented on Jun 25, 2019

    @crepererum
    Contributor

    Ideally we would do this for every digest and counter

    IMHO that would work. The mapped prometheus types are Counter and Summary.

  8. gsailer commented on Jul 11, 2019

    @gsailer
    ContributorAuthor

    Right, here is a minimal example:

    In [1]: from dask.distributed import Client
    
    In [2]: client = Client(processes=False)
    
    In [3]: worker = client.cluster.workers[0]
    
    In [4]: tdigest = worker.digests['tick-duration'].components[1]  # grab the middle-time component
    
    In [5]: tdigest.quantile(50)
    Out[5]: 0.0224759578704834
    

    Ideally we would do this for every digest and counter

    @mrocklin Thank you very much for the help!
    I cannot reproduce your minimal example using python3.7 with distributed version 2.1.0.
    For me the values of digests is None using the provided example.

    What environment were you using providing the example?

  9. mrocklin commented on Jul 11, 2019

    @mrocklin
    Member
  10. jcrist commented on Jul 15, 2019

    @jcrist
    Member

    Yes, crick is available on conda-forge and PyPI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions