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

[Q]How to build local version in order to investigate? #582

Open
interfan7 opened this issue Mar 27, 2024 · 2 comments
Open

[Q]How to build local version in order to investigate? #582

interfan7 opened this issue Mar 27, 2024 · 2 comments
Labels

Comments

@interfan7
Copy link

I need the ability to build locally in order to debug and investigate a query which takes very long.

I'm not too familiar with Go and have zero experience with building it.
Preferably I want to build in Mac and the target shall be a Linux Ubuntu machine.
Are there instructions to start?

What to investigate?
I've a case of a query which doesn't complete even in 2 minutes, even though CPU usage and IO disks counters don't seem to reach the limits.
That query shall return almost 80K metrics (Whisper files).
I want to start by inserting my own log lines to track down and pin-point what takes so long, is it really about reading datapoints from Whisper files?

@deniszh
Copy link
Member

deniszh commented Mar 27, 2024

  1. Install make and golang on mac, e.g. with manual on https://go.dev/doc/install
  2. cd to project directory and run
make clean && make

It will print you a build command, like

go build -mod vendor --ldflags '-X main.BuildVersion=v0.17.3-7-g1159' github.com/go-graphite/go-carbon

and produce go-carbon binary in current directory.

$ file go-carbon
go-carbon: Mach-O 64-bit executable arm64
  1. Remove go-carbon binary and prepend go command above with flags to build linux binary (GOOS=linux GOARCH=amd64) instead:
GOOS=linux GOARCH=amd64 go build -mod vendor --ldflags '-X main.BuildVersion=v0.17.3-7-g1159' github.com/go-graphite/go-carbon

Now you have linux binary instead:

$ file go-carbon
go-carbon: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=... with debug_info, not stripped

@interfan7
Copy link
Author

@deniszh
I think the explenation just couldn't be any better!! 👏🏻🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants