Skip to content

Commit

Permalink
Merge branch 'main' into first-seen-stream-name
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed Aug 10, 2023
2 parents 17359d6 + b44a2bb commit 118569c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 52 deletions.
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,30 @@ The tests should never leak goroutines.
Use the term `ConcurrentSafe` in the test name when it aims to verify the
absence of race conditions.

### Internal packages

The use of internal packages should be scoped to a single module. A sub-module
should never import from a parent internal package. This creates a coupling
between the two modules where a user can upgrade the parent without the child
and if the internal package API has changed it will fail to upgrade[^3].

There are two known exceptions to this rule:

- `go.opentelemetry.io/otel/internal/global`
- This package manages global state for all of opentelemetry-go. It needs to
be a single package in order to ensure the uniqueness of the global state.
- `go.opentelemetry.io/otel/internal/baggage`
- This package provides values in a `context.Context` that need to be
recognized by `go.opentelemetry.io/otel/baggage` and
`go.opentelemetry.io/otel/bridge/opentracing` but remain private.

If you have duplicate code in multiple modules, make that code into a Go
template stored in `go.opentelemetry.io/otel/internal/shared` and use [gotmpl]
to render the templates in the desired locations. See [#4404] for an example of
this.

[^3]: https://github.com/open-telemetry/opentelemetry-go/issues/3548

## Approvers and Maintainers

### Approvers
Expand Down Expand Up @@ -592,3 +616,5 @@ repo](https://github.com/open-telemetry/community/blob/main/community-membership

[Approver]: #approvers
[Maintainer]: #maintainers
[gotmpl]: https://pkg.go.dev/go.opentelemetry.io/build-tools/gotmpl
[#4404]: https://github.com/open-telemetry/opentelemetry-go/pull/4404
53 changes: 1 addition & 52 deletions sdk/metric/internal/aggregate/exponential_histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ func (e *expoHistogram[N]) delta(dest *metricdata.Aggregation) int {
*dest = h
return n
}

func (e *expoHistogram[N]) cumulative(dest *metricdata.Aggregation) int {
t := now()

Expand Down Expand Up @@ -443,55 +444,3 @@ func (e *expoHistogram[N]) cumulative(dest *metricdata.Aggregation) int {
*dest = h
return n
}

// Aggregate records the measurement, scoped by attr, and aggregates it
// into an aggregation.
// func (e *cumulativeExponentialHistogram[N]) Aggregation() metricdata.Aggregation {
// e.valuesMu.Lock()
// defer e.valuesMu.Unlock()

// if len(e.values) == 0 {
// return nil
// }
// t := now()
// h := metricdata.ExponentialHistogram[N]{
// Temporality: metricdata.CumulativeTemporality,
// DataPoints: make([]metricdata.ExponentialHistogramDataPoint[N], 0, len(e.values)),
// }
// for a, b := range e.values {
// ehdp := metricdata.ExponentialHistogramDataPoint[N]{
// Attributes: a,
// StartTime: e.start,
// Time: t,
// Count: b.count,
// Scale: int32(b.scale),
// ZeroCount: b.zeroCount,
// ZeroThreshold: 0.0,
// PositiveBucket: metricdata.ExponentialBucket{
// Offset: int32(b.posBuckets.startBin),
// Counts: make([]uint64, len(b.posBuckets.counts)),
// },
// NegativeBucket: metricdata.ExponentialBucket{
// Offset: int32(b.negBuckets.startBin),
// Counts: make([]uint64, len(b.negBuckets.counts)),
// },
// }
// copy(ehdp.PositiveBucket.Counts, b.posBuckets.counts)
// copy(ehdp.NegativeBucket.Counts, b.negBuckets.counts)

// if !e.noMinMax {
// ehdp.Min = metricdata.NewExtrema(b.min)
// ehdp.Max = metricdata.NewExtrema(b.max)
// }
// if !e.noSum {
// ehdp.Sum = b.sum
// }
// h.DataPoints = append(h.DataPoints, ehdp)
// // TODO (#3006): This will use an unbounded amount of memory if there
// // are unbounded number of attribute sets being aggregated. Attribute
// // sets that become "stale" need to be forgotten so this will not
// // overload the system.
// }

// return h
// }

0 comments on commit 118569c

Please sign in to comment.