Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show all table level metrics for colocated tables attributed to the colocation parent table #16748

Closed
yugabyte-ci opened this issue Apr 6, 2023 · 0 comments
Assignees
Labels
jira-originated kind/bug This issue is a bug priority/medium Medium priority issue

Comments

@yugabyte-ci
Copy link
Contributor

yugabyte-ci commented Apr 6, 2023

Jira Link: DB-6112

@yugabyte-ci yugabyte-ci added jira-originated kind/bug This issue is a bug priority/low Low priority labels Apr 6, 2023
@yugabyte-ci yugabyte-ci added priority/medium Medium priority issue and removed priority/low Low priority labels Apr 6, 2023
@yugabyte-ci yugabyte-ci assigned tverona1 and unassigned anmalysh-yb Apr 7, 2023
@yugabyte-ci yugabyte-ci assigned fizaaluthra and unassigned tverona1 Apr 20, 2023
fizaaluthra added a commit that referenced this issue Apr 21, 2023
…olocated table is altered

Summary:
Currently, when we perform a DDL on a colocated table, the colocation parent table's metrics' `table_name` and `namespace_name` are incorrectly updated. `table_name` is set to the //colocated table's// name.

```
yugabyte=# CREATE DATABASE db WITH colocation = true;
yugabyte=# \c db;
You are now connected to database "db" as user "yugabyte".
db=# CREATE TABLE test (t int);
db=# INSERT INTO test VALUES (generate_series(1, 100));

```
Prometheus metrics:

```
...
rocksdb_compaction_times_micros_count{metric_type="table",exported_instance="fi-mbp-wmd6n:9000",namespace_name="db",table_name="00004000000030008000000000004004.colocation.parent.tablename",table_id="00004000000030008000000000004004.colocation.parent.uuid"} 0 1682017739001
...

```
```
db=# ALTER TABLE test ADD COLUMN y int;
```

Prometheus metrics (parent table's metrics `table_name` is set to `"test"`, and `namespace_name` to `""`):
```
...
rocksdb_compaction_times_micros_count{metric_type="table",exported_instance="fi-mbp-wmd6n:9000",namespace_name="",table_name="test",table_id="00004000000030008000000000004004.colocation.parent.uuid"} 0 1682017739001
...

```

To fix this, we should skip the `table_metrics_entity_` and `tablet_metrics_entity_` update for the colocation parent table when the colocated table is altered.

Test Plan:
Manually tested:

1) Colocation parent table's metrics are correctly attributed to the colocation parent table after a DDL on a colocated table:

```
yugabyte=# CREATE DATABASE db WITH colocation = true;
yugabyte=# \c db;
You are now connected to database "db" as user "yugabyte".
db=# CREATE TABLE test (t int);
db=# INSERT INTO test VALUES (generate_series(1, 100));
db=# ALTER TABLE test ADD COLUMN y int;
```

Prometheus metrics:

```
...
rocksdb_compaction_times_micros_count{metric_type="table",exported_instance="fi-mbp-wmd6n:9000",namespace_name="db",table_name="00004000000030008000000000004004.colocation.parent.tablename",table_id="00004000000030008000000000004004.colocation.parent.uuid"} 0 1682019415603
...
```

2) Non-colocated table's metrics' behaviour remains unchanged:

```
db=# CREATE TABLE test2 (t int) WITH (colocation = false);
db=# INSERT INTO test2 VALUES (generate_series(1, 100));
db=# ALTER TABLE test2 ADD COLUMN y int;
```

Prometheus metrics:

```
...
rocksdb_compaction_times_micros_count{table_id="00004000000030008000000000004008",table_name="test2",namespace_name="db",exported_instance="fi-mbp-wmd6n:9000",metric_type="tablet"} 0 1682018993921
...
```

Reviewers: tverona, jhe

Reviewed By: tverona, jhe

Subscribers: yql

Differential Revision: https://phabricator.dev.yugabyte.com/D24650
fizaaluthra added a commit that referenced this issue Apr 25, 2023
…update when a colocated table is altered

Summary:
Currently, when we perform a DDL on a colocated table, the colocation parent table's metrics' `table_name` and `namespace_name` are incorrectly updated. `table_name` is set to the //colocated table's// name.

```
yugabyte=# CREATE DATABASE db WITH colocation = true;
yugabyte=# \c db;
You are now connected to database "db" as user "yugabyte".
db=# CREATE TABLE test (t int);
db=# INSERT INTO test VALUES (generate_series(1, 100));

```
Prometheus metrics:

```
...
rocksdb_compaction_times_micros_count{metric_type="table",exported_instance="fi-mbp-wmd6n:9000",namespace_name="db",table_name="00004000000030008000000000004004.colocation.parent.tablename",table_id="00004000000030008000000000004004.colocation.parent.uuid"} 0 1682017739001
...

```
```
db=# ALTER TABLE test ADD COLUMN y int;
```

Prometheus metrics (parent table's metrics `table_name` is set to `"test"`, and `namespace_name` to `""`):
```
...
rocksdb_compaction_times_micros_count{metric_type="table",exported_instance="fi-mbp-wmd6n:9000",namespace_name="",table_name="test",table_id="00004000000030008000000000004004.colocation.parent.uuid"} 0 1682017739001
...

```

To fix this, we should skip the `table_metrics_entity_` and `tablet_metrics_entity_` update for the colocation parent table when the colocated table is altered.

Original commit: 7a3da14 / D24650

Test Plan:
Manually tested:

1) Colocation parent table's metrics are correctly attributed to the colocation parent table after a DDL on a colocated table:

```
yugabyte=# CREATE DATABASE db WITH colocation = true;
yugabyte=# \c db;
You are now connected to database "db" as user "yugabyte".
db=# CREATE TABLE test (t int);
db=# INSERT INTO test VALUES (generate_series(1, 100));
db=# ALTER TABLE test ADD COLUMN y int;
```

Prometheus metrics:

```
...
rocksdb_compaction_times_micros_count{metric_type="table",exported_instance="fi-mbp-wmd6n:9000",namespace_name="db",table_name="00004000000030008000000000004004.colocation.parent.tablename",table_id="00004000000030008000000000004004.colocation.parent.uuid"} 0 1682019415603
...
```

2) Non-colocated table's metrics' behaviour remains unchanged:

```
db=# CREATE TABLE test2 (t int) WITH (colocation = false);
db=# INSERT INTO test2 VALUES (generate_series(1, 100));
db=# ALTER TABLE test2 ADD COLUMN y int;
```

Prometheus metrics:

```
...
rocksdb_compaction_times_micros_count{table_id="00004000000030008000000000004008",table_name="test2",namespace_name="db",exported_instance="fi-mbp-wmd6n:9000",metric_type="tablet"} 0 1682018993921
...
```

Reviewers: jhe, tverona

Reviewed By: tverona

Subscribers: yql

Differential Revision: https://phabricator.dev.yugabyte.com/D24762
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira-originated kind/bug This issue is a bug priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

4 participants