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

metrics: Sink contructor from metric type #3068

Merged
merged 1 commit into from
May 15, 2023
Merged

metrics: Sink contructor from metric type #3068

merged 1 commit into from
May 15, 2023

Conversation

codebien
Copy link
Contributor

@codebien codebien commented May 15, 2023

I did this multiple times across different outputs, maybe we can have a central function.

@codebien codebien added this to the v0.45.0 milestone May 15, 2023
@codebien codebien self-assigned this May 15, 2023
@github-actions github-actions bot requested review from mstoykov and oleiade May 15, 2023 07:47
@codecov-commenter
Copy link

Codecov Report

Merging #3068 (1c5c183) into master (c00bfbb) will increase coverage by 0.02%.
The diff coverage is 100.00%.

❗ Current head 1c5c183 differs from pull request most recent head 5458008. Consider uploading reports for the commit 5458008 to get more accurate results

@@            Coverage Diff             @@
##           master    #3068      +/-   ##
==========================================
+ Coverage   76.72%   76.74%   +0.02%     
==========================================
  Files         229      229              
  Lines       17110    17112       +2     
==========================================
+ Hits        13127    13133       +6     
+ Misses       3140     3135       -5     
- Partials      843      844       +1     
Flag Coverage Δ
ubuntu 76.74% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
metrics/registry.go 94.44% <100.00%> (+2.95%) ⬆️
metrics/sink.go 95.89% <100.00%> (+0.89%) ⬆️

... and 3 files with indirect coverage changes

Copy link
Contributor

@mstoykov mstoykov left a comment

Choose a reason for hiding this comment

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

I have no problems with the change. I am not so certain whether the usage of the internal Sink implementation is wise in outputs.

@codebien
Copy link
Contributor Author

codebien commented May 15, 2023

https://github.com/grafana/xk6-output-prometheus-remote/blob/092f73237a7e72bc93236c280982834682702ed8/pkg/remotewrite/remotewrite.go#L374-L406

It could be now something simpler like:

newSeriesWithMeasure() {
if mt == metrics.Trend {
return CustomSinkForTrend 
}

return metrics.NewSink(mt)
}

Another case:

sink: metrics.NewSinkByType(m.Type),

And I'm doing a new one for #1700

Copy link
Member

@oleiade oleiade left a comment

Choose a reason for hiding this comment

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

👍🏻

@codebien codebien merged commit 189a8fe into master May 15, 2023
@codebien codebien deleted the new-sink branch May 15, 2023 12:46
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.

4 participants