Skip to content

Commit 6e7ed0d

Browse files
authored
Merge pull request #36734 from github/repo-sync
Repo sync
2 parents 39e6f6a + 1cda3ed commit 6e7ed0d

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

.github/workflows/codespace-review-up.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on:
2727
# - auto_merge_enabled
2828
- auto_merge_disabled
2929
# - enqueued
30-
- dequeued
30+
# - dequeued -- When merge queue completes, it triggers this event
3131
workflow_dispatch:
3232

3333
permissions:
@@ -51,7 +51,6 @@ jobs:
5151
echo "github.event_name: ${{ github.event_name }}"
5252
echo "github.event.action: ${{ github.event.action }}"
5353
echo "github.actor: ${{ github.actor }}"
54-
echo "github.event.pull_request.auto_merge: ${{ github.event.pull_request.auto_merge }}"
5554
echo "github.triggering_actor: ${{ github.triggering_actor }}"
5655
5756
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

data/reusables/dependabot/dependabot-alerts-filters.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ You can sort and filter {% data variables.product.prodname_dependabot_alerts %}
22

33
| Option | Description | Example |
44
|:---|:---|:---|
5+
| `CVE-ID`| Displays alerts associated with this `CVE-ID` | `CVE-2020-28482` will show any alerts whose underlying advisory has this CVE ID number. |
56
| `ecosystem` | Displays alerts for the selected ecosystem | Use `ecosystem:npm` to show {% data variables.product.prodname_dependabot_alerts %} for npm |
7+
| `GHSA-ID`| Displays alerts associated with this `GHSA-ID` | `GHSA-49wp-qq6x-g2rf` will show any alerts whose underlying advisory has this {% data variables.product.prodname_advisory_database %} ID. |
68
| `has` | Displays alerts meeting the selected filter criteria | Use `has:patch` to show alerts related to advisories that have a patch |
79
| `is` | Displays alerts based on their state | Use `is:open` to show open alerts |
810
| `manifest` | Displays alerts for the selected manifest | Use `manifest:webwolf/pom.xml` to show alerts on the pom.xml file of the webwolf application |

src/article-api/middleware/article.ts

+26
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import catchMiddlewareError from '@/observability/middleware/catch-middleware-er
77
import { ExtendedRequestWithPageInfo } from '../types'
88
import { pageValidationMiddleware, pathValidationMiddleware } from './validation'
99
import contextualize from '#src/frame/middleware/context/context.js'
10+
import statsd from '#src/observability/lib/statsd.js'
1011

1112
/** START helper functions */
1213

@@ -59,6 +60,23 @@ async function getArticleBody(req: ExtendedRequestWithPageInfo) {
5960
return await page.render(renderingReq.context)
6061
}
6162

63+
function incrementArticleLookup(
64+
pathname: string,
65+
language: string,
66+
type: 'full' | 'body' | 'meta',
67+
) {
68+
const tags = [
69+
// According to https://docs.datadoghq.com/getting_started/tagging/#define-tags
70+
// the max length of a tag is 200 characters. Most of ours are less than
71+
// that but we truncate just to be safe.
72+
`pathname:${pathname}`.slice(0, 200),
73+
`language:${language}`,
74+
`type:${type}`,
75+
]
76+
77+
statsd.increment('api.article.lookup', 1, tags)
78+
}
79+
6280
/** END helper functions */
6381

6482
/** START routes */
@@ -82,6 +100,8 @@ router.get(
82100
return res.status(403).json({ error: (error as Error).message })
83101
}
84102

103+
incrementArticleLookup(req.pageinfo.pathname, req.pageinfo.page.languageCode, 'full')
104+
85105
defaultCacheControl(res)
86106
return res.json({
87107
meta: metaData,
@@ -101,6 +121,9 @@ router.get(
101121
} catch (error) {
102122
return res.status(403).json({ error: (error as Error).message })
103123
}
124+
125+
incrementArticleLookup(req.pageinfo.pathname, req.pageinfo.page.languageCode, 'body')
126+
104127
defaultCacheControl(res)
105128
return res.type('text/markdown').send(bodyContent)
106129
}),
@@ -112,6 +135,9 @@ router.get(
112135
pageValidationMiddleware as RequestHandler,
113136
catchMiddlewareError(async function (req: ExtendedRequestWithPageInfo, res: Response) {
114137
const metaData = await getArticleMetadata(req)
138+
139+
incrementArticleLookup(req.pageinfo.pathname, req.pageinfo.page.languageCode, 'meta')
140+
115141
defaultCacheControl(res)
116142
return res.json(metaData)
117143
}),

src/article-api/middleware/pagelist.ts

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { getProductStringFromPath, getVersionStringFromPath } from '#src/frame/l
77
import { getLanguageCodeFromPath } from '#src/languages/middleware/detect-language.js'
88
import { pagelistValidationMiddleware } from './validation'
99
import catchMiddlewareError from '#src/observability/middleware/catch-middleware-error.js'
10+
import statsd from '#src/observability/lib/statsd.js'
1011

1112
const router = express.Router()
1213

@@ -78,6 +79,7 @@ router.get(
7879
return
7980
}
8081

82+
incrementPagelistLookup(req.context!.currentVersion!, req.context!.currentLanguage!)
8183
defaultCacheControl(res)
8284

8385
// new line added at the end so `wc` works as expected with `-l` and `-w`.
@@ -101,4 +103,10 @@ function versionMatcher(key: string, targetVersion: string, targetLang: string)
101103
if (versionFromPermalink === targetVersion && langFromPermalink === targetLang) return key
102104
}
103105

106+
function incrementPagelistLookup(version: string, language: string) {
107+
const tags = [`version:${version}`, `language:${language}`]
108+
109+
statsd.increment('api.pagelist.lookup', 1, tags)
110+
}
111+
104112
export default router

0 commit comments

Comments
 (0)