mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | [mvdan.cc/gofumpt](https://redirect.github.com/mvdan/gofumpt) | `v0.8.0` -> `v0.9.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>mvdan/gofumpt (mvdan.cc/gofumpt)</summary> ### [`v0.9.0`](https://redirect.github.com/mvdan/gofumpt/blob/HEAD/CHANGELOG.md#v090---2025-09-02) [Compare Source](https://redirect.github.com/mvdan/gofumpt/compare/v0.8.0...v0.9.0) This release is based on Go 1.25's gofmt, and requires Go 1.24 or later. A new rule is introduced to "clothe" naked returns for the sake of clarity. While there is nothing wrong with naming results in function signatures, using lone `return` statements can be confusing to the reader. Go 1.25's `ignore` directives in `go.mod` files are now obeyed; any directories within the module matching any of the patterns are now omitted when walking directories, such as with `gofumpt -w .`. Module information is now loaded via Go's [`x/mod/modfile` package](https://pkg.go.dev/golang.org/x/mod/modfile) rather than executing `go mod edit -json`, which is way faster. This should result in moderate speed-ups when formatting many directories. </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45MS4xIiwidXBkYXRlZEluVmVyIjoiNDEuOTEuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicmVub3ZhdGVib3QiXX0=--> --------- Signed-off-by: Bogdan Drutu <[email protected]> Co-authored-by: Hanzo Dev <[email protected]> Co-authored-by: otelbot <[email protected]> Co-authored-by: Bogdan Drutu <[email protected]>
59 lines
1.6 KiB
Go
59 lines
1.6 KiB
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package pmetric // import "go.opentelemetry.io/collector/pdata/pmetric"
|
|
|
|
// MarkReadOnly marks the Metrics as shared so that no further modifications can be done on it.
|
|
func (ms Metrics) MarkReadOnly() {
|
|
ms.getState().MarkReadOnly()
|
|
}
|
|
|
|
// IsReadOnly returns true if this Metrics instance is read-only.
|
|
func (ms Metrics) IsReadOnly() bool {
|
|
return ms.getState().IsReadOnly()
|
|
}
|
|
|
|
// MetricCount calculates the total number of metrics.
|
|
func (ms Metrics) MetricCount() int {
|
|
metricCount := 0
|
|
rms := ms.ResourceMetrics()
|
|
for i := 0; i < rms.Len(); i++ {
|
|
rm := rms.At(i)
|
|
ilms := rm.ScopeMetrics()
|
|
for j := 0; j < ilms.Len(); j++ {
|
|
ilm := ilms.At(j)
|
|
metricCount += ilm.Metrics().Len()
|
|
}
|
|
}
|
|
return metricCount
|
|
}
|
|
|
|
// DataPointCount calculates the total number of data points.
|
|
func (ms Metrics) DataPointCount() (dataPointCount int) {
|
|
rms := ms.ResourceMetrics()
|
|
for i := 0; i < rms.Len(); i++ {
|
|
rm := rms.At(i)
|
|
ilms := rm.ScopeMetrics()
|
|
for j := 0; j < ilms.Len(); j++ {
|
|
ilm := ilms.At(j)
|
|
ms := ilm.Metrics()
|
|
for k := 0; k < ms.Len(); k++ {
|
|
m := ms.At(k)
|
|
switch m.Type() {
|
|
case MetricTypeGauge:
|
|
dataPointCount += m.Gauge().DataPoints().Len()
|
|
case MetricTypeSum:
|
|
dataPointCount += m.Sum().DataPoints().Len()
|
|
case MetricTypeHistogram:
|
|
dataPointCount += m.Histogram().DataPoints().Len()
|
|
case MetricTypeExponentialHistogram:
|
|
dataPointCount += m.ExponentialHistogram().DataPoints().Len()
|
|
case MetricTypeSummary:
|
|
dataPointCount += m.Summary().DataPoints().Len()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return dataPointCount
|
|
}
|