Commit Graph

12 Commits

Author SHA1 Message Date
Dave Protasowski 57da52bf75 Include labeler attributes in the span 2025-07-05 21:22:44 -04:00
Dave Protasowski 5c1338c7ed instrument span status 2025-07-05 21:13:21 -04:00
Dave Protasowski f4787640a1
[webhook] OTel changes (#3189)
* webhook changes for observability

* go mod

* vendor

* Allow the webhook to accept a MetricsProvider. This makes it easier to unit test

Digging into OTel implementation it looks like instruments are cached.
Thus when different webhooks request the same instrument a cache lookup
for the instrument will occur.

* passthrough additional OTel interfaces

* linter fixes

* drop global meter in tests

* PR feedback

* PR feedback

* when recording the admission/conversion duration use the attributes from the labeler

* add a comment that otelhttp middleware creates the labeler

* simply code for readability

* change metric names to allow reuse across different webhook types

* fix linter

* tweak attribute names
2025-07-04 14:53:57 +00:00
Dave Protasowski 8535fcc248
gofumpt the repo (#3067)
* gofumpt the repo

* don't prefix numbers with 0 - otherwise they're octal
2024-06-25 07:27:07 +00:00
Kenny Leung 93b66e6a87
Update: report stats for request (#2584)
* report stats for request

Signed-off-by: Kenny Leung <kleung@chainguard.dev>

* fix ref

Signed-off-by: Kenny Leung <kleung@chainguard.dev>

* fix import

Signed-off-by: Kenny Leung <kleung@chainguard.dev>

* update

Signed-off-by: Kenny Leung <kleung@chainguard.dev>

* gofmt

Signed-off-by: Kenny Leung <kleung@chainguard.dev>

* fix test

Signed-off-by: Kenny Leung <kleung@chainguard.dev>

* fix boiler

Signed-off-by: Kenny Leung <kleung@chainguard.dev>

Signed-off-by: Kenny Leung <kleung@chainguard.dev>
2022-08-26 16:29:20 +00:00
Matt Moore 11a3414ec3
Provide the webhook infrastructure with the raw request context. (#2305)
Today, we can use `Path()` of `/foo/` (trailing slash) to support prefix-matched webhooks, but unfortunately the request context is lost when `Admit()` or `Convert()` is called.

This ensures that information flows through associated with context for anyone who would like this metadata for additional processing.
2021-10-05 13:22:44 -07:00
Victor Agababov 1e373a9e5d
take 2 (#1755) 2020-09-29 14:10:29 -07:00
Markus Thömmes 754da4653a
Enable unparam linter to catch unused parameters (#1731) 2020-09-22 09:13:40 -07:00
Dave Protasowski 02c28cd5ff
Return TypeMeta as part of the conversion response (#1433)
This is a requirement when adopting CRD v1 APIs
2020-06-22 08:29:27 -07:00
Dave Protasowski caa444033b
use crd & webhook v1 APIs (#1391) 2020-06-19 08:43:25 -07:00
Victor Agababov 507b519649
Fix some nits in the webhook code (#1150) 2020-03-10 10:36:29 -07:00
Dave Protasowski 88d4536182
Conversion Webhook Framework (#993)
* ConversionController implementation

This controller will reconcile target CRDs with the correct
conversion webhook configuration. Specifically, the HTTP path and
CA bundle will be updated.

Additionally, the conversion controller will perform the given
conversions through a hub and spoke model utilizing the
apis.Convertible interface.

* Webhook now can host ConversionControllers

* injection/sharedmain now supports webhook.ConversionControllers

These conversion controllers will be hosted by the webhook that
the sharedmain will start

* support defaulting & include godoc
2020-02-03 08:59:29 -08:00