ibm-messaging / mq-metric-samples

IBM® MQ metric gathering client samples
Apache License 2.0
57 stars 70 forks source link

Error faced while compiling go programs (mq_otel) #296

Closed rvanam77 closed 2 months ago

rvanam77 commented 2 months ago

Hi Team,

I am looking for MQ monitoring and using mq_otel for it. I tried to compile the go files (config.go, reader.go, main.go) provided in mq_otel and facing below errors while compiling.

Version : go v1.22.2 Command : go build /cmd/mqotel *.go Linux Version : Oracle Linux Server 8.9 Errors: # cmd/vendor/go.opentelemetry.io/otel/sdk/resource ../vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go:13:2: "cmd/vendor/go.opentelemetry.io/otel/sdk" imported as opentelemetry and not used ../vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go:54:31: undefined: sdk_

So we commented the above lines in builtin.go file (lines no : 13 & 54) and compiled the code successfully. I am able to see the metrics gets generated when i run the file with mq_otel.sh script (metrics in /var/mqm/errors/mq_otel.out). But the metrics are unable to export to any endpoint (like default : localhost:4317).

Could you please answer below queries. Thanks in advance.

  1. How to resolve above compilation errors without commenting the lines?
  2. How to expose metrics to localhost:4317
  3. Due to commenting the above lines, do I facing the issue like metrics are unable to sent to any endpoint (any relation between compilation errors and metrics not exporting)?
ibmmqmet commented 2 months ago

That looks like you are not following the instructions in the README on how to build the programs. In particular, using go build -mod=vendor ... if you want to build directly into your filesystem. Or use one of the Docker-based approaches to build the programs in containers.

rvanam77 commented 2 months ago

Thanks a lot for the quick response. I will try to build mq_otel into own server using read me in https://github.com/ibm-messaging/mq-metric-samples/blob/master/README.md and will check it

rvanam77 commented 2 months ago

Hi, thanks a lot for your guidance. I am able to compile the code successfully using go build -mod=vendor. Able to collect mq metrics also. Thanks again!!