Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status

Current state["Under Discussion"]

Discussion thread:  http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/DISCUSS-FLIP-112-Support-User-Defined-Metrics-for-Python-UDF-td38609.html

JIRA

...

Page properties


Discussion thread
Vote thread
JIRA

Jira
serverASF JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-16670

Release1.11



Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

...


class MetricGroup(abc.ABC):

    def counter(self, name: str) -> 'Counter':

        """

        Registers a new `Counter` with Flink.

        """

        pass

    def gauge(self, name: str, method: Callable[[], int]) -> None:

        """

        Registers a new `Gauge` with Flink.

        """

        pass

    def meter(self, name: str, time_span_in_seconds: int = 60) -> 'Meter':

        """

        Registers a new `Meter` with Flink.

        """

        pass

    def distribution(self, name: str) -> 'Distribution':

        """

        Registers a new `Distribution` with Flink.

        """

        pass

    def add_group(self, name: str, extra: str = None) -> 'MetricGroup':

        """

        if extra is not None, creates a new key-value MetricGroup pair. The key group

        is added to this groups sub-groups, while the value group is added to the key

        group's sub-groups. This method returns the value group.

        The only difference between calling this method and

        `group.add_group(key).add_group(value)` is that get_all_variables()

        of the value group return an additional `"<key>"="value"` pair.

        """

        pass

    def get_scope_components(self) -> []:

        """

        Gets the scope as an array of the scope components, for example

        `["host-7", "taskmanager-2", "window_word_count", "my-mapper"]`

        """

        pass

    def get_all_variables(self) -> map:

        """

        Returns a map of all variables and their associated value, for example

        `{"<host>"="host-7", "<tm_id>"="taskmanager-2"}`

        """

        pass

    def get_metric_identifier(self, metric_name: str) -> str:

        """

        Returns the fully qualified metric name, for example

        `host-7.taskmanager-2.window_word_count.my-mapper.metricName`

        """

        pass

FunctionContext

A `get_metric_group` will be added to the FunctionContext class.

class FunctionContext(object):

    """

    Used to obtain global runtime information about the context in which the

    user-defined function is executed. The information includes the metric group,

    and global job parameters, etc.

    """


    def get_metric_group(self) -> MetricGroup:

        pass

Implementation Plan

...