Skip to content

[metrics] Add metrics to record principal-level byteIn and byteOut #2059

@zcoo

Description

@zcoo

Search before asking

  • I searched in the issues and found nothing similar.

Motivation

For Fluss cluster for multi-tenant and users, it is necessary to record "byteIn" and "byteOut" or related metrics not only at table granularity but also at user granularity.

Assuming such a scenario: a producer write to Fluss log table and many consumers scan the table to get data from their partition respectively. If we only observe the "byteOut" at table granularity, we don't know the proportion "byteOut" of each consumer. Thus hard to locate where a large scan flow from or to calculate respective resource costs of each consumer.

Solution

Currently We have a "FlussPrincipal" in "Session" like :

public class Session implements Serializable {
    private final short apiVersion;
    private final String listenerName;
    private final boolean isInternal;
    private final InetAddress inetAddress;
    **private final FlussPrincipal principal;**
...
}

We can add the param "FlussPrincipal" to TabletService::produceLog and TabletService::fetchLog to locate the user who is writing or reading data from fluss. Then we can easily add 2 metrics "bytesInPerUser","bytesOutPerUser" and other metrics if needed.

Anything else?

No response

Willingness to contribute

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions