|
| 1 | +/* |
| 2 | +Copyright 2023 TV 2 DANMARK A/S |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License") with the |
| 5 | +following modification to section 6. Trademarks: |
| 6 | +
|
| 7 | +Section 6. Trademarks is deleted and replaced by the following wording: |
| 8 | +
|
| 9 | +6. Trademarks. This License does not grant permission to use the trademarks and |
| 10 | +trade names of TV 2 DANMARK A/S, including but not limited to the TV 2® logo and |
| 11 | +word mark, except (a) as required for reasonable and customary use in describing |
| 12 | +the origin of the Work, e.g. as described in section 4(c) of the License, and |
| 13 | +(b) to reproduce the content of the NOTICE file. Any reference to the Licensor |
| 14 | +must be made by making a reference to "TV 2 DANMARK A/S", written in capitalized |
| 15 | +letters as in this example, unless the format in which the reference is made, |
| 16 | +requires lower case letters. |
| 17 | +
|
| 18 | +You may not use this software except in compliance with the License and the |
| 19 | +modifications set out above. |
| 20 | +
|
| 21 | +You may obtain a copy of the license at: |
| 22 | +
|
| 23 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 24 | +
|
| 25 | +Unless required by applicable law or agreed to in writing, software |
| 26 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 27 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 28 | +See the License for the specific language governing permissions and |
| 29 | +limitations under the License. |
| 30 | +*/ |
| 31 | + |
| 32 | +package controllers |
| 33 | + |
| 34 | +import ( |
| 35 | + "github.com/prometheus/client_golang/prometheus" |
| 36 | + "sigs.k8s.io/controller-runtime/pkg/metrics" |
| 37 | +) |
| 38 | + |
| 39 | +var ( |
| 40 | + metricPatchApply = prometheus.NewCounter( |
| 41 | + prometheus.CounterOpts{ |
| 42 | + Name: "bifrost_patchapply_total", |
| 43 | + Help: "Number of server-side patch operations", |
| 44 | + }, |
| 45 | + ) |
| 46 | + metricPatchApplyErrs = prometheus.NewCounter( |
| 47 | + prometheus.CounterOpts{ |
| 48 | + Name: "bifrost_patchapply_errors_total", |
| 49 | + Help: "Number of server-side patch errors", |
| 50 | + }, |
| 51 | + ) |
| 52 | + metricTemplateErrs = prometheus.NewCounter( |
| 53 | + prometheus.CounterOpts{ |
| 54 | + Name: "bifrost_template_errors_total", |
| 55 | + Help: "Number of template render errors", |
| 56 | + }, |
| 57 | + ) |
| 58 | + metricTemplateParseErrs = prometheus.NewCounter( |
| 59 | + prometheus.CounterOpts{ |
| 60 | + Name: "bifrost_template_parse_errors_total", |
| 61 | + Help: "Number of template parse errors", |
| 62 | + }, |
| 63 | + ) |
| 64 | + metricResourceGet = prometheus.NewCounter( |
| 65 | + prometheus.CounterOpts{ |
| 66 | + Name: "bifrost_resource_get_total", |
| 67 | + Help: "Number of resources fetched to use as dependency in templates", |
| 68 | + }, |
| 69 | + ) |
| 70 | +) |
| 71 | + |
| 72 | +func init() { |
| 73 | + metrics.Registry.MustRegister(metricPatchApply, metricPatchApplyErrs, metricTemplateErrs, metricResourceGet) |
| 74 | +} |
0 commit comments