tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
15.16k stars 890 forks source link

Prometheus not compatible with tinygo? #3879

Open f0o opened 1 year ago

f0o commented 1 year ago

Possibly related to https://github.com/tinygo-org/tinygo/issues/3705 ?

# github.com/prometheus/client_golang/prometheus/internal
../../../../go/pkg/mod/github.com/prometheus/client_golang@v1.16.0/prometheus/internal/go_runtime_metrics.go:42:27: d.Name undefined (type *metrics.Description has no field or method Name)
../../../../go/pkg/mod/github.com/prometheus/client_golang@v1.16.0/prometheus/internal/go_runtime_metrics.go:65:7: d.Cumulative undefined (type *metrics.Description has no field or method Cumulative)
../../../../go/pkg/mod/github.com/prometheus/client_golang@v1.16.0/prometheus/internal/go_runtime_metrics.go:65:23: d.Kind undefined (type *metrics.Description has no field or method Kind)
../../../../go/pkg/mod/github.com/prometheus/client_golang@v1.16.0/prometheus/internal/go_runtime_metrics.go:65:39: undefined: metrics.KindFloat64Histogram
../../../../go/pkg/mod/github.com/prometheus/client_golang@v1.16.0/prometheus/internal/go_runtime_metrics.go:70:11: d.Kind undefined (type *metrics.Description has no field or method Kind)
../../../../go/pkg/mod/github.com/prometheus/client_golang@v1.16.0/prometheus/internal/go_runtime_metrics.go:71:15: undefined: metrics.KindUint64
../../../../go/pkg/mod/github.com/prometheus/client_golang@v1.16.0/prometheus/internal/go_runtime_metrics.go:72:15: undefined: metrics.KindFloat64
../../../../go/pkg/mod/github.com/prometheus/client_golang@v1.16.0/prometheus/internal/go_runtime_metrics.go:73:15: undefined: metrics.KindFloat64Histogram

I'm not even sure where to start looking on this one; I cleared the modcache and let tinygo download the modules fresh but the error is a bit generic.

It works fine on Go 1.19+

cpanato commented 6 months ago

go the same issue, and not sure how to fix it :/

aykevl commented 6 months ago

The best way to get this working would be to extend the stub runtime/metrics package that got added in this PR: https://github.com/tinygo-org/tinygo/pull/3709