You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rearrange the packages to put CreateBlock in tsdbutil and avoid circular import #6136
changed the title [-]Rearrange the packages to put `CreateBlock` in tsdbutil and avoid circular import[/-][+]Rearrange the packages to put `CreateBlock` in `tsdbutil` and avoid circular import[/+]on Oct 14, 2019
nope this is only a temporary solution in that linked PR as it moves is in the main tsdb package to avoid the circular import cycle.
I think we should try to organize it better
It could then be imported as .../tsdb/head. I played around with this a bit and it would be quite the refactor as there are several dependent private methods within the tsdb package that would need to become public or change how their individual APIs are accessed.
Create a tsdbutil-broker package that would break the circular dependency between tsdb and tsdbutil. I think this could be a good solution.
Any other thoughts? Or do one of these approaches seem favorable?
Activity
[-]Rearrange the packages to put `CreateBlock` in tsdbutil and avoid circular import[/-][+]Rearrange the packages to put `CreateBlock` in `tsdbutil` and avoid circular import[/+]dipack95 commentedon Oct 14, 2019
createBlockreferred to, is here: https://github.com/prometheus/prometheus/pull/5887/files#diff-deb37515bb9a472285c2cd38d5649deeR346droidnoob commentedon Nov 3, 2019
Is this still open. I'd like to take this up @krasi-georgiev
codesome commentedon Nov 7, 2019
@droidnoob I see this issue is being addressed in #5887
krasi-georgiev commentedon Nov 7, 2019
nope this is only a temporary solution in that linked PR as it moves is in the main tsdb package to avoid the circular import cycle.
I think we should try to organize it better
jpmcb commentedon Feb 10, 2020
I've been looking at this issue today and I see a few paths forward:
NewHeadis called:instead, break out the
headfiles into their own packages:It could then be imported as
.../tsdb/head. I played around with this a bit and it would be quite the refactor as there are several dependent private methods within thetsdbpackage that would need to become public or change how their individual APIs are accessed.tsdbutil-brokerpackage that would break the circular dependency between tsdb and tsdbutil. I think this could be a good solution.Any other thoughts? Or do one of these approaches seem favorable?
krasi-georgiev commentedon Feb 11, 2020
@codesome mentioned that he found another way to create blocks without relying on the NewHead method so maybe he can also share his idea.
gouthamve commentedon May 25, 2020
@krasi-georgiev / @codesome What is the requirement/use-case here? Where is the circular import happening?
We went through this issue in our bug scrub and we didn't fully get the context around this.
krasi-georgiev commentedon May 26, 2020
was long time ago and can't remember either.