Skip to content

Commit

Permalink
Use init to ensure otel meter is initialized (#224)
Browse files Browse the repository at this point in the history
Co-authored-by: Po-Yao Chen <[email protected]>
  • Loading branch information
py4chen and Po-Yao Chen authored Nov 20, 2024
1 parent 3fe0721 commit 4c0040f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion cmd/gensign/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func main() {
fileLogger.Warn().Err(err).Msg("failed to shut down oTel provider")
}
}()
gensign.InitOTelMeter()
}

ctx, cancel := context.WithTimeout(context.Background(), conf.RequestTimeout)
Expand Down
4 changes: 2 additions & 2 deletions gensign/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const (

var meter metric.Meter

// InitOTelMeter initializes the oTel meter for ysshra.
func InitOTelMeter() {
// init ensures the oTel meter for ysshra is initialized.
func init() {
meter = otel.GetMeterProvider().Meter(scopeName)
}

Expand Down

0 comments on commit 4c0040f

Please sign in to comment.