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

sql: expose metrics in internal tables for monitoring #29396

Open
tim-o opened this issue Aug 30, 2018 · 8 comments
Open

sql: expose metrics in internal tables for monitoring #29396

tim-o opened this issue Aug 30, 2018 · 8 comments
Labels
A-security A-sql-pgcompat Semantic compatibility with PostgreSQL C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-observability

Comments

@tim-o
Copy link
Contributor

tim-o commented Aug 30, 2018

Request from user @ikzelf on the forum

Currently, CRDB only allows root access to crdb_internal. Root cannot grant permissions to other users. Ronald can comment further, but this is currently preventing him from implementing a monitoring solution using SQL, which he's implemented for Postgres, Mysql, and other databases.

Jira issue: CRDB-4870

@tim-o tim-o added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-sql-pgcompat Semantic compatibility with PostgreSQL labels Aug 30, 2018
@tim-o
Copy link
Contributor Author

tim-o commented Aug 30, 2018

Tagging as pgcompat for now, since that's a relevant fit - feel free to retag if there's a better home.

@awoods187 awoods187 added this to Triage in (DEPRECATED) SQL Front-end, Lang & Semantics via automation Sep 4, 2018
@ikzelf
Copy link

ikzelf commented Sep 4, 2018

Ab other option would be to add a specific user for monitoring purposes. That user should be able to connect and read the tables/views required to be able to figure out the database structure, sizes, performance metrics and parameters. Maybe it should be able to describe tables, perform explain plans but it should not be able to read user data.

@knz knz changed the title Allow grants on crdb_internal tables for monitoring sql: allow grants on crdb_internal tables for monitoring Sep 20, 2018
@knz knz moved this from Triage to Backlog in (DEPRECATED) SQL Front-end, Lang & Semantics Sep 20, 2018
@ikzelf
Copy link

ikzelf commented Mar 12, 2019

Any news on this? In our current world, where privacy concerns are getting more attention, it would be a smart move to allow for definition of users that can perform their tasks without automatically having access to user data. For monitoring we don't need to read the user tables, as long as we can explain the plans. For backup/recovery we don't need to read the user tables, as long as we can recover the database...

@knz
Copy link
Contributor

knz commented Mar 12, 2019

@ikzelf there are two separate issues:

  1. user grants on virtual tables -- today this infrastructure does not exist in CockroachDB and would need to be added. This will not happen in 19.1 and will be considered for 19.2

  2. all of crdb_internal is considered as experimental and subject to change without notice and is thus unsuitable to build external tools upon (unless you're OK with your tools breaking between crdb minor versions!).

Regarding point 2 - this is the main reason why we are not willing to support you on this issue. However, what we can do is the following:

  1. you tell us what you are monitoring and why
  2. we build a public interface that exposes the information you need and that's not experimental
  3. we ensure that the data is available for non-root users.

How does this sound?

@ikzelf
Copy link

ikzelf commented Mar 12, 2019

That sounds good, great.

Things I would like to be able to monitor is

  1. sizing of the various files for all databases on all nodes
  2. size limits for all those files on all nodes (probably filesystem sizes)
  3. actual used bytes in all those files on all nodes
  4. memory usage and limits on all nodes
  5. number of sessions per dbuser per node
  6. parameters in use per node
  7. age and volume of last backup (if possible at all)
  8. node status/availability
  9. sort/tempdb usage

This all is mostly aiming on resource and availability monitoring/alerting

@knz
Copy link
Contributor

knz commented Mar 12, 2019

@piyush-singh @awoods187 @rolandcrosby can you capture the above requirements in the telemetry roadmap and cross-check what we already have in prometheus. I think the following should happen:

  • for all the things we already have in prometheus exports, ensure the metrics are documented/discoverable
  • for all the new things, plan adding metrics accordingly.

I think all of these can be put in metrics (i.e. not sql telemetry).

@github-actions
Copy link

github-actions bot commented Jun 6, 2021

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
5 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@knz knz added this to Triage in SQL Sessions - Deprecated via automation Jun 7, 2021
@jlinder jlinder added the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label Jun 16, 2021
@rafiss rafiss moved this from Triage to Longer term backlog in SQL Sessions - Deprecated Jul 27, 2021
@rafiss rafiss changed the title sql: allow grants on crdb_internal tables for monitoring sql: expose metrics in internal tables for monitoring Nov 8, 2022
@rafiss
Copy link
Collaborator

rafiss commented Nov 8, 2022

v22.2 will support grants on virtual tables. I've renamed the issue to capture the request for being able to do monitoring by referencing internal tables, and moving this to the SQL Observability team.

@rafiss rafiss removed the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label Nov 8, 2022
@rafiss rafiss added this to Triage in Cluster Observability via automation Nov 8, 2022
@rafiss rafiss removed this from Longer term backlog in SQL Sessions - Deprecated Nov 8, 2022
@kevin-v-ngo kevin-v-ngo moved this from Triage to Backlog in Cluster Observability Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-security A-sql-pgcompat Semantic compatibility with PostgreSQL C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-observability
Projects
No open projects
Development

No branches or pull requests

6 participants