Skip to content

Commit

Permalink
docs(metering): add docs for metering
Browse files Browse the repository at this point in the history
  • Loading branch information
grandwizard28 committed Dec 28, 2024
1 parent bd3bb9d commit 9f3c623
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions pkg/metering/meter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,31 @@ import (
)

// Meter is an interface that receives telemetry data and
// calculates billable metrics
// calculates billable metrics.
type Meter[T ptrace.Traces | pmetric.Metrics | plog.Logs] interface {
// Calculates size of the telemetry data in bytes.
Size(T) int
// Calculates count of the telemetry data.
Count(T) int
}

// Sizer is an interface that calculates the size of different
// data structures
type Sizer interface {
SizeOfMapStringAny(map[string]any) int
}

// Calculates billable metrics for logs.
type Logs interface {
Meter[plog.Logs]
}

type Sizer interface {
SizeOfMapStringAny(map[string]any) int
// Calculates billable metrics for traces.
type Traces interface {
Meter[plog.Logs]
}

// Calculates billable metrics for metrics.
type Metrics interface {
Meter[plog.Logs]
}

0 comments on commit 9f3c623

Please sign in to comment.