[telemetry] cmd/gotelemetry: fix chart x-axis time interval display

2 views
Skip to first unread message

Hyang-Ah Hana Kim (Gerrit)

unread,
Jul 1, 2024, 11:38:28 PM (2 days ago) Jul 1
to goph...@pubsubhelper.golang.org, Hyang-Ah Hana Kim, golang-co...@googlegroups.com

Hyang-Ah Hana Kim has uploaded the change for review

Commit message

cmd/gotelemetry: fix chart x-axis time interval display

Align the x-axis interval to match the report interval,
by setting the observablehq plot library's interval option
to be the upload date's weekday.

https://observablehq.com/plot/features/intervals#timeInterval

And use the time format string that specifies the time
zone, to avoid misinterpretation in Javascript.

The Week field of telemetry.Report is meant to be
the start of the week period. But, uploader and
the gotelemetry view's active counter aggregation
had been using the field to store the end of
the week period.

Update the comment of telemetry.Report to match
how we use the field.

In chart drawing, it is easier to work with the
start day of each week. The report with week `w`
to the half-open `[w-7days, w)` period.
Presenting the data with the bin that corresponds
to [w-7days, w) is more compelling than mapping
it to [w, w+7days). So, use w-7days as the Week
field of the datum (the data entries for charts).

Fixes golang/go#68206
Change-Id: I0db06f44a06bd7017cf0e0febd3f555bd1e201d5

Change diff


Change information

Files:
  • M cmd/gotelemetry/internal/view/view.go
  • M cmd/gotelemetry/internal/view/view_test.go
  • M internal/content/gotelemetryview/index.ts
  • M internal/content/gotelemetryview/static/index.min.js
  • M internal/content/gotelemetryview/static/index.min.js.map
  • M internal/telemetry/types.go
  • M internal/upload/reports.go
Change size: M
Delta: 7 files changed, 127 insertions(+), 64 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: telemetry
Gerrit-Branch: master
Gerrit-Change-Id: I0db06f44a06bd7017cf0e0febd3f555bd1e201d5
Gerrit-Change-Number: 595962
Gerrit-PatchSet: 1
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Hyang-Ah Hana Kim (Gerrit)

unread,
Jul 2, 2024, 10:20:52 AM (yesterday) Jul 2
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, Robert Findley, Go LUCI, golang-co...@googlegroups.com
Attention needed from Robert Findley

Hyang-Ah Hana Kim added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Hyang-Ah Hana Kim . resolved

The test failure is go.dev/issues/67737, and unrelated to this change.

Open in Gerrit

Related details

Attention is currently required from:
  • Robert Findley
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: telemetry
Gerrit-Branch: master
Gerrit-Change-Id: I0db06f44a06bd7017cf0e0febd3f555bd1e201d5
Gerrit-Change-Number: 595962
Gerrit-PatchSet: 1
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Robert Findley <rfin...@google.com>
Gerrit-Attention: Robert Findley <rfin...@google.com>
Gerrit-Comment-Date: Tue, 02 Jul 2024 14:20:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

Robert Findley (Gerrit)

unread,
Jul 2, 2024, 3:51:39 PM (yesterday) Jul 2
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com
Attention needed from Hyang-Ah Hana Kim

Robert Findley added 4 comments

File cmd/gotelemetry/internal/view/view.go
Line 416, Patchset 1 (Latest): return t.Format("2006-01-02T15:04:05Z")
Robert Findley . unresolved

Can we use 2006-01-02? It looks like that was the format used previously, and since the field name is 'DateRange', it seems to make more sense that we do not format a time component.

EDIT: ah I see the comment below about JS using local time. Perhaps that comment belongs here (or at least a short comment redirecting to the larger explanation below).

Line 485, Patchset 1 (Latest): startTime, _ := parseReportDate(start)
endTime, _ := parseReportDate(end)
Robert Findley . unresolved

I don't understand the behavior of falling back to timeNow when there is an error parsing the date. It seems better to surface the parse error. Perhaps we could filter out reports that have a malformed start or end date (how would that happen), collecting errors and listing errors in the view UI.

Line 513, Patchset 1 (Latest): intervalEnd, err := parseReportDate(r.Week)
Robert Findley . unresolved

Call this weekEnd?

Line 515, Patchset 1 (Latest): log.Printf("ignoring report with invalid week date: %v", err)
continue
Robert Findley . unresolved

Ah, if we're ignoring the report here then we should probably also ignore it in the domain calculation. As mentioned above it might make sense to collect and surface these errors.

Open in Gerrit

Related details

Attention is currently required from:
  • Hyang-Ah Hana Kim
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: telemetry
    Gerrit-Branch: master
    Gerrit-Change-Id: I0db06f44a06bd7017cf0e0febd3f555bd1e201d5
    Gerrit-Change-Number: 595962
    Gerrit-PatchSet: 1
    Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Robert Findley <rfin...@google.com>
    Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Comment-Date: Tue, 02 Jul 2024 19:51:34 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Hyang-Ah Hana Kim (Gerrit)

    unread,
    12:42 PM (9 hours ago) 12:42 PM
    to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Hyang-Ah Hana Kim

    Hyang-Ah Hana Kim uploaded new patchset

    Hyang-Ah Hana Kim uploaded patch set #2 to this change.
    Following approvals got outdated and were removed:
    • TryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hyang-Ah Hana Kim
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: telemetry
    Gerrit-Branch: master
    Gerrit-Change-Id: I0db06f44a06bd7017cf0e0febd3f555bd1e201d5
    Gerrit-Change-Number: 595962
    Gerrit-PatchSet: 2
    unsatisfied_requirement
    open
    diffy

    Hyang-Ah Hana Kim (Gerrit)

    unread,
    12:59 PM (8 hours ago) 12:59 PM
    to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Hyang-Ah Hana Kim

    Hyang-Ah Hana Kim uploaded new patchset

    Hyang-Ah Hana Kim uploaded patch set #3 to this change.
    Following approvals got outdated and were removed:
    • TryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hyang-Ah Hana Kim
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: telemetry
    Gerrit-Branch: master
    Gerrit-Change-Id: I0db06f44a06bd7017cf0e0febd3f555bd1e201d5
    Gerrit-Change-Number: 595962
    Gerrit-PatchSet: 3
    unsatisfied_requirement
    open
    diffy

    Hyang-Ah Hana Kim (Gerrit)

    unread,
    1:08 PM (8 hours ago) 1:08 PM
    to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, Go LUCI, Robert Findley, golang-co...@googlegroups.com
    Attention needed from Robert Findley

    Hyang-Ah Hana Kim added 4 comments

    File cmd/gotelemetry/internal/view/view.go
    Line 416, Patchset 1: return t.Format("2006-01-02T15:04:05Z")
    Robert Findley . resolved

    Can we use 2006-01-02? It looks like that was the format used previously, and since the field name is 'DateRange', it seems to make more sense that we do not format a time component.

    EDIT: ah I see the comment below about JS using local time. Perhaps that comment belongs here (or at least a short comment redirecting to the larger explanation below).

    Hyang-Ah Hana Kim

    Added comments to explain why.

    Line 485, Patchset 1: startTime, _ := parseReportDate(start)
    endTime, _ := parseReportDate(end)
    Robert Findley . resolved

    I don't understand the behavior of falling back to timeNow when there is an error parsing the date. It seems better to surface the parse error. Perhaps we could filter out reports that have a malformed start or end date (how would that happen), collecting errors and listing errors in the view UI.

    Hyang-Ah Hana Kim

    The reasoning was that when this happens, there is no valid report/data to plot in `reports`, and I thought still showing an empty graph with x-axis may look better.

    Now change the code to parse/check the time early on when creating `telemetryReport`.

    Line 513, Patchset 1: intervalEnd, err := parseReportDate(r.Week)
    Robert Findley . resolved

    Call this weekEnd?

    Hyang-Ah Hana Kim

    Acknowledged

    Line 515, Patchset 1: log.Printf("ignoring report with invalid week date: %v", err)
    continue
    Robert Findley . resolved

    Ah, if we're ignoring the report here then we should probably also ignore it in the domain calculation. As mentioned above it might make sense to collect and surface these errors.

    Hyang-Ah Hana Kim

    now `pending` and `newTelemetryReport` are going to log and drop the reports with unexpected time string.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Robert Findley
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: telemetry
      Gerrit-Branch: master
      Gerrit-Change-Id: I0db06f44a06bd7017cf0e0febd3f555bd1e201d5
      Gerrit-Change-Number: 595962
      Gerrit-PatchSet: 3
      Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
      Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
      Gerrit-Reviewer: Robert Findley <rfin...@google.com>
      Gerrit-Attention: Robert Findley <rfin...@google.com>
      Gerrit-Comment-Date: Wed, 03 Jul 2024 17:08:34 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Robert Findley <rfin...@google.com>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages