Source File
pool.go
Belonging Package
go.opentelemetry.io/otel/semconv/internal/metricpool
// Copyright The OpenTelemetry Authors// SPDX-License-Identifier: Apache-2.0// Package metricpool provides shared pools for semantic convention metric// measurement options.package metricpoolimport ()var (addOptionsPool = sync.Pool{New: func() any {:= make([]metric.AddOption, 0, 1)return &}}recOptionsPool = sync.Pool{New: func() any {:= make([]metric.RecordOption, 0, 1)return &}})// AddOptions returns a pooled AddOption slice.func () *[]metric.AddOption {return addOptionsPool.Get().(*[]metric.AddOption)}// PutAddOptions clears, resets, and returns o to the shared AddOption pool.func ( *[]metric.AddOption) {clear(*)* = (*)[:0]addOptionsPool.Put()}// RecordOptions returns a pooled RecordOption slice.func () *[]metric.RecordOption {return recOptionsPool.Get().(*[]metric.RecordOption)}// PutRecordOptions clears, resets, and returns o to the shared RecordOption// pool.func ( *[]metric.RecordOption) {clear(*)* = (*)[:0]recOptionsPool.Put()}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |