open-nomad/.semgrep/rpc_metrics.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
558 B
YAML
Raw Permalink Normal View History

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
rules:
# Check for server RPC endpoints without metrics
- id: "rpc-missing-metrics"
patterns:
- pattern: |
authErr := $A.$B.Authenticate($A.ctx, args)
- pattern-not-inside: |
authErr := $A.$B.Authenticate($A.ctx, args)
...
$T.srv.MeasureRPCRate(...)
...
message: "RPC method appears to be missing metrics"
languages:
- "go"
severity: "WARNING"
paths:
include:
- "nomad/*_endpoint.go"