Skip to content

fix: fix dropReason metrics labels - #12288

Merged
bradfitz merged 1 commit into
tailscale:mainfrom
coder:spike/fix-drop-reason-stats-upstream
May 31, 2024
Merged

bradfitz merged 1 commit into
tailscale:mainfrom
coder:spike/fix-drop-reason-stats-upstream

Conversation

@spikecurtis

@spikecurtis spikecurtis commented May 30, 2024 •

Copy link
Copy Markdown
Contributor

the counter_packets_dropped_reason metric is using incorrect labels

#2745 added dropReasonDupClient without the corresponding metric label
#7552 added the label "gone_not_here" without the corresponding dropReason

The actual reasons are

const (
	dropReasonUnknownDest      dropReason = iota // unknown destination pubkey
	dropReasonUnknownDestOnFwd                   // unknown destination pubkey on a derp-forwarded packet
	dropReasonGoneDisconnected                   // destination tailscaled disconnected before we could send
	dropReasonQueueHead                          // destination queue is full, dropped packet at queue head
	dropReasonQueueTail                          // destination queue is full, dropped packet at queue tail
	dropReasonWriteError                         // OS write() failed
	dropReasonDupClient                          // the public key is connected 2+ times (active/active, fighting)
)

I noticed this while looking into DERP performance, since I was seeing a bunch of drops for gone_not_here which is not a valid reason in present version.

@spikecurtis

spikecurtis commented May 30, 2024 •

Copy link
Copy Markdown
Contributor Author

@andrew-d cheers!

Do you need me to open an issue to appease issuebot, or does this count as "trivial"?

@bradfitz

Copy link
Copy Markdown
Member

Thanks for the fix! An issue would be nice, or you can instead just include some metadata in the commit message like when it regressed.

Comment thread derp/derp_server.go Resolved
Comment thread derp/derp_server.go Outdated
s.packetsDroppedReasonCounters[dropReasonQueueHead] = s.packetsDroppedReason.Get("queue_head")
s.packetsDroppedReasonCounters[dropReasonQueueTail] = s.packetsDroppedReason.Get("queue_tail")
s.packetsDroppedReasonCounters[dropReasonWriteError] = s.packetsDroppedReason.Get("write_error")
s.packetsDroppedReasonCounters[dropReasonDupClient] = s.packetsDroppedReason.Get("dup_client")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like dup_client was the only missing one and all the others were fine? One was just renamed, but doesn't look like anything was reordered or off-by-one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, queue_head, queue_tail and write_error were off by one, and dup_client was not included in the stats. E.g. I saw in stats:

"counter_packets_dropped_reason": {
  "gone_disconnected": 0,
  "gone_not_here": 20615, 
  "queue_head": 0, 
  "queue_tail": 0, 
  "unknown_dest": 26, 
  "unknown_dest_on_fwd": 0, 
  "write_error": 0
}

...that is, dropReasonQueueHead was getting tracked as gone_not_here in the stats.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks. Looks like a regression from 74eb99a.

@spikecurtis
spikecurtis force-pushed the spike/fix-drop-reason-stats-upstream branch from 1cc7fc3 to 82b1396 Compare May 31, 2024 09:08
@spikecurtis
spikecurtis requested a review from bradfitz May 31, 2024 09:10
@bradfitz
bradfitz merged commit 0380cbc into tailscale:main May 31, 2024
bradfitz added a commit that referenced this pull request May 31, 2024
The derp metrics got out of sync in 74eb99a (2023-03).

They were fixed in 0380cbc (2024-05).

This adds some further guardrails (atop the previous fix) to make sure
they don't get out of sync again.

Updates #12288

Change-Id: I809061a81f8ff92f45054d0253bc13871fc71634
Signed-off-by: Brad Fitzpatrick <[email protected]>
bradfitz added a commit that referenced this pull request May 31, 2024
The derp metrics got out of sync in 74eb99a (2023-03).

They were fixed in 0380cbc (2024-05).

This adds some further guardrails (atop the previous fix) to make sure
they don't get out of sync again.

Updates #12288

Change-Id: I809061a81f8ff92f45054d0253bc13871fc71634
Signed-off-by: Brad Fitzpatrick <[email protected]>
bradfitz added a commit that referenced this pull request May 31, 2024
The derp metrics got out of sync in 74eb99a (2023-03).

They were fixed in 0380cbc (2024-05).

This adds some further guardrails (atop the previous fix) to make sure
they don't get out of sync again.

Updates #12288

Change-Id: I809061a81f8ff92f45054d0253bc13871fc71634
Signed-off-by: Brad Fitzpatrick <[email protected]>
chen8945 pushed a commit to Ckid-Home/tailscale that referenced this pull request Jul 31, 2024
chen8945 pushed a commit to Ckid-Home/tailscale that referenced this pull request Jul 31, 2024
The derp metrics got out of sync in 74eb99a (2023-03).

They were fixed in 0380cbc (2024-05).

This adds some further guardrails (atop the previous fix) to make sure
they don't get out of sync again.

Updates tailscale#12288

Change-Id: I809061a81f8ff92f45054d0253bc13871fc71634
Signed-off-by: Brad Fitzpatrick <[email protected]>
Asutorufa pushed a commit to Asutorufa/tailscale that referenced this pull request Aug 23, 2024
Asutorufa pushed a commit to Asutorufa/tailscale that referenced this pull request Aug 23, 2024
The derp metrics got out of sync in 74eb99a (2023-03).

They were fixed in 0380cbc (2024-05).

This adds some further guardrails (atop the previous fix) to make sure
they don't get out of sync again.

Updates tailscale#12288

Change-Id: I809061a81f8ff92f45054d0253bc13871fc71634
Signed-off-by: Brad Fitzpatrick <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants