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

Circular dependency with client_golang #58

Closed
NightTsarina opened this issue Sep 10, 2016 · 11 comments
Closed

Circular dependency with client_golang #58

NightTsarina opened this issue Sep 10, 2016 · 11 comments

Comments

@NightTsarina
Copy link

Hey,

I just got reported (I had not noticed), that there is a circular dependency between common and client_golang, which is pretty problematic for transitions, backports, etc.

In the file version/info.go, the client library is imported to create metrics with version information. Is there any sane way to break this cycle? Otherwise, I guess I should just merge the packages; they can't be used independently anyway.

@grobie
Copy link
Member

grobie commented Sep 10, 2016

In Golang dependencies are defined on a package level, and not on
repository level. Circular dependencies are forbidden and impossible in
golang, but with a catch-all common repository I think you'll continue to
run into such issues.

On Sat, Sep 10, 2016 at 3:19 PM Martín Ferrari notifications@github.com
wrote:

Hey,

I just got reported (I had not noticed), that there is a circular
dependency between common and client_golang, which is pretty problematic
for transitions, backports, etc.

In the file version/info.go, the client library is imported to create
metrics with version information. Is there any sane way to break this
cycle? Otherwise, I guess I should just merge the packages; they can't be
used independently anyway.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#58, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAANaEmM3F66e1l56H5kKpNZMoHllh5oks5qowKsgaJpZM4J5zWQ
.

@NightTsarina
Copy link
Author

Grobie,

Yes, this is circular only in the repository sense, which is the one I care about :-)

Now, this is not a critical bug, but it means more pain for users and release managers, with no real benefit, so I would like to fix it. Why do you say that after merging client_golang and common I will keep encountering these problems?

@NightTsarina
Copy link
Author

Please note that I would really like not to do this hack, as it is also a lot more trouble for me..

@beorn7
Copy link
Member

beorn7 commented Sep 26, 2016 via email

@grobie
Copy link
Member

grobie commented Sep 28, 2016

@TheTincho I meant that without mirroring the go package structure you'll continue to run into such problems with the current common repository. I'm not sure merging common into client_golang is something we want to do, the packages are also used without client_golang.

@beorn7
Copy link
Member

beorn7 commented Jan 5, 2017

I don't really see us addressing this issue and I'm tempted to close it as "not feasible". @TheTincho how are you dealing with this at the moment?

@NightTsarina
Copy link
Author

At the moment, I am able to work around this by excluding common/version from build and tests, and then adding it manually to the package. This way, at least I don't get a circular build dependency (which would give all kinds of headache for bootstrapping, backporting, etc), but the resulting packages still have the circular dep.

So, it is not ideal, but not as bad.

@beorn7
Copy link
Member

beorn7 commented Jan 16, 2017

OK, thanks. I'll close this then because realistically, I don't see us changing the repo structure, given that a workaround for Debian is in place.

@beorn7 beorn7 closed this as completed Jan 16, 2017
gouthamve pushed a commit to gouthamve/common that referenced this issue Jul 22, 2018
03cc598 Don't lint generated protobuf code.
2b55c2d Merge pull request prometheus#66 from weaveworks/reduce-test-timeout
d4e163c Make timeout a flag
49a8609 Reduce test timeout
8fa15cb Merge pull request prometheus#63 from weaveworks/test-defaults
b783528 Tweak test script so it can be run on a mca
a3b18bf Merge pull request prometheus#65 from weaveworks/fix-integration-tests
ecb5602 Fix integration tests
f9dcbf6 ... without tab (clearly not my day)
a6215c3 Add break I forgot
0e6832d Remove incorrectly added tab
eb26c68 Merge pull request prometheus#64 from weaveworks/remove-test-package-linting
f088e83 Review feedback
2c6e83e Remove test package linting
2b3a1bb Merge pull request prometheus#62 from weaveworks/revert-61-test-defaults
8c3883a Revert "Make no-go-get the default, and don't assume -tags netgo"
e75c226 Fix bug in GC of firewall rules.
e49754e Merge pull request prometheus#51 from weaveworks/gc-firewall-rules
191f487 Add flag to enale/disable firewall rules' GC.
567905c Add GC of firewall rules for weave-net-tests to scheduler.
03119e1 Fix typo in GC of firewall rules.
bbe3844 Fix regular expression for firewall rules.
c5c23ce Pre-change refactoring: splitted gc_project function into smaller methods for better readability.
ed5529f GC firewall rules
ed8e757 Merge pull request prometheus#61 from weaveworks/test-defaults
57856e6 Merge pull request prometheus#56 from weaveworks/remove-wcloud
dd5f3e6 Add -p flag to test, run test in parallel
62f6f94 Make no-go-get the default, and don't assume -tags netgo
8946588 Merge pull request prometheus#60 from weaveworks/2647-gc-weave-net-tests
4085df9 Scheduler now also garbage-collects VMs from weave-net-tests.
4b7d5c6 Merge pull request prometheus#59 from weaveworks/57-fix-lint-properly
b7f0e69 Merge pull request prometheus#58 from weaveworks/fix-lint
794702c Pin version of shfmt
ab1b11d Fix lint
d1a5e46 Remove wcloud cli tool
81d80f3 Merge pull request prometheus#55 from weaveworks/lint-tf
05ad5f2 Review feedback
4c0d046 Use hclfmt to lint terraform.

git-subtree-dir: tools
git-subtree-split: 03cc5989769d93aa03f8aed3784ddfdb1fffc1c6
gouthamve pushed a commit to gouthamve/common that referenced this issue Jul 22, 2018
* dep ensure

* Replace type with struct

* Add instantiation test for HistogramCollector
@cornfeedhobo
Copy link

I just want to be clear, the proposed workaround does not scale or even work for enterprise environments. Please reconsider looking into this.

SuperQ added a commit to prometheus/exporter-toolkit that referenced this issue Jan 1, 2024
Add the version package from `prometheus/common` to allow breaking the
circular dependency between `prometheus/client_golang` and
`prometheus/common`.

Related to: prometheus/common#58

Signed-off-by: SuperQ <superq@gmail.com>
SuperQ added a commit to prometheus/exporter-toolkit that referenced this issue Jan 1, 2024
Add the version package from `prometheus/common` to allow breaking the
circular dependency between `prometheus/client_golang` and
`prometheus/common`.
* Remove support for Go older than 1.18.

Related to: prometheus/common#58

Signed-off-by: SuperQ <superq@gmail.com>
@bwplotka bwplotka reopened this Jan 2, 2024
@bwplotka
Copy link
Member

bwplotka commented Jan 2, 2024

Relevant discussion is happening here: https://cloud-native.slack.com/archives/C01AUBA4PFE/p1704099677796159

SuperQ added a commit to prometheus/client_golang that referenced this issue Jan 3, 2024
Migrate the `versoin` package from `github.com/prometheus/common`
to `github.com/prometheus/client_golang` in order to break the ciricular
dependency.
* Make `version` a top level package because it uses `init()` to
  populate data.

Related to: prometheus/common#58

Signed-off-by: SuperQ <superq@gmail.com>
SuperQ added a commit to prometheus/client_golang that referenced this issue Jan 3, 2024
Migrate the `version` package from `github.com/prometheus/common`
to `github.com/prometheus/client_golang` in order to break the ciricular
dependency.
* Make `version` a top level package because it uses `init()` to
  populate data.

Related to: prometheus/common#58

Signed-off-by: SuperQ <superq@gmail.com>
SuperQ added a commit to prometheus/client_golang that referenced this issue Jan 3, 2024
Migrate the `version` package from `github.com/prometheus/common`
to `github.com/prometheus/client_golang` in order to break the circular
dependency.
* Make `version` a top level package because it uses `init()` to
  populate data.

Related to: prometheus/common#58

Signed-off-by: SuperQ <superq@gmail.com>
SuperQ added a commit to prometheus/client_golang that referenced this issue Jan 3, 2024
Migrate the `version` package from `github.com/prometheus/common`
to `github.com/prometheus/client_golang` in order to break the circular
dependency.
* Make `version` a top level package because it uses `init()` to
  populate data.

Related to: prometheus/common#58

Signed-off-by: SuperQ <superq@gmail.com>
@ArthurSens
Copy link
Member

Circular dependency has been solved after moving the version collector to client_golang!

#579
#591
prometheus/client_golang#1422

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

No branches or pull requests

6 participants