You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Igal Shilman (Jira)" <ji...@apache.org> on 2021/10/11 14:39:00 UTC

[jira] [Comment Edited] (FLINK-22533) Allow creating custom metrics

    [ https://issues.apache.org/jira/browse/FLINK-22533?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17427168#comment-17427168 ] 

Igal Shilman edited comment on FLINK-22533 at 10/11/21, 2:38 PM:
-----------------------------------------------------------------

[~nferrario] check out the branch again,

you can rewrite your example in the following way:
{code:java}
binder.bindIngressRouter(myIngress) { message, downstream ->
    if (message.isValid && message.auctionId > 0) {
        downstream.forward(Identifiers.storageType, message.auctionId.toString(), message)
    } else {
        downstream.metrics().counter("invalid-events").inc();
    }
}
 {code}
 You may want to cache the counter tho, to avoid the look ups for every event.


was (Author: igal):
[~nferrario] check out the branch again,

you can rewrite your example in the following way:
{code:java}
binder.bindIngressRouter(myIngress) { message, downstream ->
    if (message.isValid && message.auctionId > 0) {
        downstream.forward(Identifiers.storageType, message.auctionId.toString(), message)
    } else {
        downstream.metrics().counter("invalid-events").inc();
    }
}
 {code}
 

> Allow creating custom metrics
> -----------------------------
>
>                 Key: FLINK-22533
>                 URL: https://issues.apache.org/jira/browse/FLINK-22533
>             Project: Flink
>          Issue Type: Improvement
>          Components: Stateful Functions
>            Reporter: Igal Shilman
>            Assignee: Igal Shilman
>            Priority: Minor
>              Labels: auto-deprioritized-major
>
> Currently it is not possible to create custom metrics in StateFun.
> Let us consider supporting these. 
>  
> Mailing list thread: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Custom-metrics-in-Stateful-Functions-td43282.html



--
This message was sent by Atlassian Jira
(v8.3.4#803005)