Skip to content

Commit

Permalink
fix metrics compute method name
Browse files Browse the repository at this point in the history
  • Loading branch information
gernest committed Feb 11, 2024
1 parent a77e5d2 commit d5cf4c9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions stats/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (c *Compute) Metric(ctx context.Context, m v1.Metric) (float64, error) {
case v1.Metric_visitors:
return c.Visitors(ctx)
case v1.Metric_visits:
return c.Visit(), nil
return c.Visits(), nil
case v1.Metric_bounce_rate:
return c.BounceRate(), nil
case v1.Metric_visit_duration:
Expand All @@ -61,7 +61,7 @@ func (c *Compute) Events() float64 {
}
func (c *Compute) ViewsPerVisits() float64 {
views := c.PageView()
visits := c.Visit()
visits := c.Visits()
if visits != 0 {
return views / visits
}
Expand All @@ -70,7 +70,7 @@ func (c *Compute) ViewsPerVisits() float64 {

func (c *Compute) VisitDuration() float64 {
duration := c.Duration()
visits := c.Visit()
visits := c.Visits()
if visits != 0 {
return duration / visits
}
Expand All @@ -79,7 +79,7 @@ func (c *Compute) VisitDuration() float64 {

func (c *Compute) BounceRate() float64 {
bounce := c.Bounce()
visits := c.Visit()
visits := c.Visits()
if visits != 0 {
return bounce / visits
}
Expand All @@ -105,7 +105,7 @@ func (c *Compute) Visitors(ctx context.Context) (float64, error) {
return float64(a.Len()), nil
}

func (c *Compute) Visit() float64 {
func (c *Compute) Visits() float64 {
if c.visit != nil {
return *c.visit
}
Expand Down

0 comments on commit d5cf4c9

Please sign in to comment.