Skip to content

Commit

Permalink
Document public ifaces to remain stable
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed Jul 31, 2023
1 parent 2899fcf commit 41388ac
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sdk/metric/aggregation/aggregation.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ type Aggregation interface {

// Copy returns a deep copy of the Aggregation.
Copy() Aggregation
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.

// Err returns an error for any misconfigured Aggregation.
Err() error
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.
}

// Drop is an aggregation that drops all recorded data.
Expand Down
10 changes: 10 additions & 0 deletions sdk/metric/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ type Exporter interface {
// This method needs to be concurrent safe with itself and all the other
// Exporter methods.
Temporality(InstrumentKind) metricdata.Temporality
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.

// Aggregation returns the Aggregation to use for an instrument kind.
//
// This method needs to be concurrent safe with itself and all the other
// Exporter methods.
Aggregation(InstrumentKind) aggregation.Aggregation
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.

// Export serializes and transmits metric data to a receiver.
//
Expand All @@ -56,6 +60,8 @@ type Exporter interface {
// exporter needs to hold this data after it returns, it needs to make a
// copy.
Export(context.Context, *metricdata.ResourceMetrics) error
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.

// ForceFlush flushes any metric data held by an exporter.
//
Expand All @@ -64,6 +70,8 @@ type Exporter interface {
//
// This method needs to be concurrent safe.
ForceFlush(context.Context) error
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.

// Shutdown flushes all metric data held by an exporter and releases any
// held computational resources.
Expand All @@ -76,4 +84,6 @@ type Exporter interface {
//
// This method needs to be concurrent safe.
Shutdown(context.Context) error
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.
}
12 changes: 12 additions & 0 deletions sdk/metric/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,17 @@ type Reader interface {
// The producer argument allows the Reader to signal the sdk to collect
// and send aggregated metric measurements.
register(sdkProducer)
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.

// RegisterProducer registers a an external Producer with this Reader.
// The Producer is used as a source of aggregated metric data which is
// incorporated into metrics collected from the SDK.
//
// This method needs to be concurrent safe.
RegisterProducer(Producer)
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.

// temporality reports the Temporality for the instrument kind provided.
//
Expand All @@ -83,6 +87,8 @@ type Reader interface {
// This method needs to be concurrent safe, and the cancelation of the
// passed context is expected to be honored.
Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.

// ForceFlush flushes all metric measurements held in an export pipeline.
//
Expand All @@ -93,6 +99,8 @@ type Reader interface {
//
// This method needs to be concurrent safe.
ForceFlush(context.Context) error
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.

// Shutdown flushes all metric measurements held in an export pipeline and releases any
// held computational resources.
Expand All @@ -107,6 +115,8 @@ type Reader interface {
//
// This method needs to be concurrent safe.
Shutdown(context.Context) error
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.
}

// sdkProducer produces metrics for a Reader.
Expand All @@ -123,6 +133,8 @@ type Producer interface {
//
// This method should be safe to call concurrently.
Produce(context.Context) ([]metricdata.ScopeMetrics, error)
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.
}

// produceHolder is used as an atomic.Value to wrap the non-concrete producer
Expand Down

0 comments on commit 41388ac

Please sign in to comment.