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

Replace batch with copyFrom #18

Merged
merged 2 commits into from
Jan 17, 2023
Merged

Conversation

micsjo
Copy link
Contributor

@micsjo micsjo commented Jan 11, 2023

Remove batch for metrics. Keep for thresholds (it's just a few inserts at the beginning, no need to change)
Use copyFrom for metrics.
Update pgx from v4 to v5 and subsequent use of pgx according to docs.
Additional debug logging to know how many data containers were collected.

Fixes this issue: Issue 17

@CLAassistant
Copy link

CLAassistant commented Jan 11, 2023

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Michael Sjölin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@javaducky javaducky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @micsjo! Thank you for your contribution. Please be sure to sign the CLA. Also, since you're updating the client library, you'll need to run a go mod tidy to update the modules.

@micsjo
Copy link
Contributor Author

micsjo commented Jan 12, 2023

Tidied and updated.
Had some problems signing the CLA. It says "You have agreed to the CLA for grafana/xk6-output-timescaledb" but for some reason it seems not to be accepted - and accepted at the same time. I hope it is sorted.

@@ -146,6 +146,11 @@ func (o *Output) flushMetrics() {
sampleContainers := o.GetBufferedSamples()
start := time.Now()

o.logger.Debug("flushMetrics: Collecting...")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: remove the redundant logging. The following entry provides additional context with the count, so this log is superfluous.

Extra credit: a few lines down, we have the same situation from a previous contributor. Removal of the o.logger.Debug("flushMetrics: Committing...") would be appreciated.

o.logger.WithField("sample-containers", len(sampleContainers)).Debug("flushMetrics: Collecting...")

rows := [][]interface{}{}

var batch pgx.Batch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: With the metrics samples no longer using the Batch, I'd prefer to see the original variable declaration moved just prior to the loop responsible for populating the batch (~line 166).

@javaducky javaducky merged commit 21ee2b5 into grafana:main Jan 17, 2023
javaducky added a commit that referenced this pull request Jan 17, 2023
Signed-off-by: Paul Balogh <javaducky@gmail.com>
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.

None yet

3 participants