Skip to content

fix: Don't log start-and-finish of relational tables#459

Merged
shimonp21 merged 1 commit intocloudquery:mainfrom
shimonp21:fix_less_spammy_logs
Dec 3, 2022
Merged

fix: Don't log start-and-finish of relational tables#459
shimonp21 merged 1 commit intocloudquery:mainfrom
shimonp21:fix_less_spammy_logs

Conversation

@shimonp21
Copy link
Copy Markdown
Contributor

Related to: cloudquery/cloudquery#5273

Logging every start and finish of relational tables fetches, means that the number of logs depends on the number of [parent] resources.

for example, logs for fetching aws_rds_* (where there are many aws_rds_engine_versions resources, with aws_rds_cluster_parameters relations).

All the relational-fetch logs are identical:

2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters

This PR reduces the logs from 11700 lines (1.5MB) to 1300 lines (144 KB).

Summary


Use the following steps to ensure your PR is ready to be reviewed

  • Read the contribution guidelines 🧑‍🎓
  • Run go fmt to format your code 🖊
  • Lint your changes via golangci-lint run 🚨 (install golangci-lint here)
  • Update or add tests 🧪
  • Ensure the status checks below are successful ✅

Related to: cloudquery/cloudquery#5273

Logging every start and finish of relational tables fetches, means that the number of logs depends on the number of [parent] resources.

for example, logs for fetching `aws_rds_*` (where there are many `aws_rds_engine_versions` resources, with `aws_rds_cluster_parameters` relations).

All the relational-fetch logs are identical:
```
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF fetch table finished client=615713231484:eu-north-1 errors=0 module=aws-src resources=5576 table=aws_rds_cluster_parameters
2022-12-03T09:00:19Z INF table resolver started client=615713231484:eu-north-1 module=aws-src table=aws_rds_cluster_parameters
```

This PR reduces the logs from 11700 lines (1.5MB) to 1300 lines (144 KB).
@shimonp21 shimonp21 marked this pull request as ready for review December 3, 2022 09:21
@github-actions github-actions bot added the fix label Dec 3, 2022
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 3, 2022

⏱️ Benchmark results

Comparing with 538211c

  • DefaultConcurrency-2 resources/s: 12,156 ⬆️ 2.37% increase vs. 538211c
  • Glob-2 ns/op: 159.2 ⬆️ 7.66% increase vs. 538211c
  • TablesWithChildrenDefaultConcurrency-2 resources/s: 30,342 ⬇️ 5.12% decrease vs. 538211c
  • BufferedScanner-2 ns/op: 9.395 ⬆️ 1.19% increase vs. 538211c
  • LogReader-2 ns/op: 30.72 ⬆️ 0.55% increase vs. 538211c

@yevgenypats yevgenypats self-requested a review December 3, 2022 12:08
@yevgenypats
Copy link
Copy Markdown
Contributor

It looks ok but it does hide some information also Im curious why it logs the same line as every table can have different number of resources. Maybe we can sum up better the child tables or maybe those are not needed at all if we have metrics.

@shimonp21 shimonp21 merged commit 4d6eeca into cloudquery:main Dec 3, 2022
@erezrokah
Copy link
Copy Markdown
Member

Is there any other kind of progress shown in the logs when fetching relations? Otherwise users might think CloudQuery hangs. I think this change is good, but we might need to add another indicator when fetching relations (if we don't have one already)

kodiakhq bot pushed a commit that referenced this pull request Dec 6, 2022
🤖 I have created a release *beep* *boop*
---


## [1.11.0](v1.10.0...v1.11.0) (2022-12-05)


### Features

* Add Support for net.IP in Faker ([#445](#445)) ([2deced1](2deced1))


### Bug Fixes

* **deps:** Update golang.org/x/exp digest to 6ab00d0 ([#449](#449)) ([b981e33](b981e33))
* **deps:** Update module github.com/avast/retry-go/v4 to v4.3.1 ([#450](#450)) ([e4116f1](e4116f1))
* **deps:** Update module google.golang.org/grpc to v1.51.0 ([#451](#451)) ([538211c](538211c))
* Don't log start-and-finish of relational tables ([#459](#459)) ([4d6eeca](4d6eeca))
* Sync Metrics for Long running plugins ([#455](#455)) ([3fecc61](3fecc61))
* TablesForSpec should only return top-level tables ([#456](#456)) ([ab7ca97](ab7ca97))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants