Skip to content

Commit

Permalink
float for head request as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Oct 24, 2023
1 parent 4e9f106 commit 508f996
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions p2p/exchange_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (
)

type exchangeMetrics struct {
headRequestTimeInst metric.Int64Histogram
headRequestTimeInst metric.Float64Histogram
responseSizeInst metric.Int64Histogram
responseTimeInst metric.Float64Histogram
blockedPeersNum metric.Int64Counter
Expand All @@ -43,9 +43,9 @@ type exchangeMetrics struct {

func newExchangeMetrics() (m *exchangeMetrics, err error) {
m = new(exchangeMetrics)
m.headRequestTimeInst, err = meter.Int64Histogram(
m.headRequestTimeInst, err = meter.Float64Histogram(
"hdr_p2p_exch_clnt_head_time_hist",
metric.WithDescription("exchange client head request time in milliseconds"),
metric.WithDescription("exchange client head request time in seconds"),
)
if err != nil {
return nil, err
Expand All @@ -59,7 +59,7 @@ func newExchangeMetrics() (m *exchangeMetrics, err error) {
}
m.responseTimeInst, err = meter.Float64Histogram(
"hdr_p2p_exch_clnt_resp_time_hist",
metric.WithDescription("exchange client response time in milliseconds"),
metric.WithDescription("exchange client response time in seconds"),
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -92,7 +92,7 @@ func newExchangeMetrics() (m *exchangeMetrics, err error) {
func (m *exchangeMetrics) head(ctx context.Context, duration time.Duration, headersReceived int, tp, status string) {
m.observe(ctx, func(ctx context.Context) {
m.headRequestTimeInst.Record(ctx,
duration.Milliseconds(),
duration.Seconds(),
metric.WithAttributes(
attribute.Int(headerReceivedKey, headersReceived),
attribute.String(headTypeKey, tp),
Expand Down

0 comments on commit 508f996

Please sign in to comment.