mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-10 23:49:09 +02:00
components network map for deploy - comparison with legacy
This commit is contained in:
@@ -14,6 +14,10 @@ type AccountManagerMetrics struct {
|
||||
getPeerNetworkMapDurationMs metric.Float64Histogram
|
||||
networkMapObjectCount metric.Int64Histogram
|
||||
peerMetaUpdateCount metric.Int64Counter
|
||||
|
||||
shadowLegacySizeBytes metric.Int64Histogram
|
||||
shadowComponentsSizeBytes metric.Int64Histogram
|
||||
shadowSavingsPercent metric.Int64Histogram
|
||||
}
|
||||
|
||||
// NewAccountManagerMetrics creates an instance of AccountManagerMetrics
|
||||
@@ -55,12 +59,46 @@ func NewAccountManagerMetrics(ctx context.Context, meter metric.Meter) (*Account
|
||||
return nil, err
|
||||
}
|
||||
|
||||
shadowLegacySizeBytes, err := meter.Int64Histogram("management.account.shadow.legacy.size.bytes",
|
||||
metric.WithUnit("bytes"),
|
||||
metric.WithExplicitBucketBoundaries(
|
||||
1024, 5120, 10240, 51200, 102400, 512000, 1048576, 5242880, 10485760,
|
||||
),
|
||||
metric.WithDescription("Size of legacy network map in bytes"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
shadowComponentsSizeBytes, err := meter.Int64Histogram("management.account.shadow.components.size.bytes",
|
||||
metric.WithUnit("bytes"),
|
||||
metric.WithExplicitBucketBoundaries(
|
||||
1024, 5120, 10240, 51200, 102400, 512000, 1048576, 5242880, 10485760,
|
||||
),
|
||||
metric.WithDescription("Size of components-based network map in bytes"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
shadowSavingsPercent, err := meter.Int64Histogram("management.account.shadow.savings.percent",
|
||||
metric.WithUnit("percent"),
|
||||
metric.WithExplicitBucketBoundaries(
|
||||
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
|
||||
),
|
||||
metric.WithDescription("Percentage of bandwidth savings with components-based network map"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &AccountManagerMetrics{
|
||||
ctx: ctx,
|
||||
getPeerNetworkMapDurationMs: getPeerNetworkMapDurationMs,
|
||||
updateAccountPeersDurationMs: updateAccountPeersDurationMs,
|
||||
networkMapObjectCount: networkMapObjectCount,
|
||||
peerMetaUpdateCount: peerMetaUpdateCount,
|
||||
|
||||
shadowLegacySizeBytes: shadowLegacySizeBytes,
|
||||
shadowComponentsSizeBytes: shadowComponentsSizeBytes,
|
||||
shadowSavingsPercent: shadowSavingsPercent,
|
||||
}, nil
|
||||
|
||||
}
|
||||
@@ -84,3 +122,18 @@ func (metrics *AccountManagerMetrics) CountNetworkMapObjects(count int64) {
|
||||
func (metrics *AccountManagerMetrics) CountPeerMetUpdate() {
|
||||
metrics.peerMetaUpdateCount.Add(metrics.ctx, 1)
|
||||
}
|
||||
|
||||
// CountShadowLegacySize records the size of legacy network map in bytes
|
||||
func (metrics *AccountManagerMetrics) CountShadowLegacySize(bytes int64) {
|
||||
metrics.shadowLegacySizeBytes.Record(metrics.ctx, bytes)
|
||||
}
|
||||
|
||||
// CountShadowComponentsSize records the size of components-based network map in bytes
|
||||
func (metrics *AccountManagerMetrics) CountShadowComponentsSize(bytes int64) {
|
||||
metrics.shadowComponentsSizeBytes.Record(metrics.ctx, bytes)
|
||||
}
|
||||
|
||||
// CountShadowSavingsPercent records the percentage of bandwidth savings
|
||||
func (metrics *AccountManagerMetrics) CountShadowSavingsPercent(percent int64) {
|
||||
metrics.shadowSavingsPercent.Record(metrics.ctx, percent)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user