1
+ /*
2
+ Licensed under the Apache License, Version 2.0 (the "License");
3
+ you may not use this file except in compliance with the License.
4
+ You may obtain a copy of the License at
5
+
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ Unless required by applicable law or agreed to in writing, software
9
+ distributed under the License is distributed on an "AS IS" BASIS,
10
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ See the License for the specific language governing permissions and
12
+ limitations under the License.
13
+ */
14
+
1
15
package main
2
16
3
17
import (
@@ -16,10 +30,11 @@ import (
16
30
ekstypes "github.com/aws/aws-sdk-go-v2/service/eks/types"
17
31
"github.com/aws/aws-sdk-go-v2/service/s3"
18
32
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
19
- "github.com/bwagner5/aws-sdk-go-metrics/pkg/awsmetricsv2"
20
33
"github.com/prometheus/client_golang/prometheus"
21
34
"github.com/prometheus/client_golang/prometheus/promhttp"
22
35
"github.com/samber/lo"
36
+
37
+ "github.com/bwagner5/aws-sdk-go-metrics/pkg/awsmetricsv2"
23
38
)
24
39
25
40
type Options struct {
@@ -49,8 +64,15 @@ func main() {
49
64
registry ,
50
65
promhttp.HandlerOpts {EnableOpenMetrics : false },
51
66
))
67
+ srv := & http.Server {
68
+ ReadTimeout : 1 * time .Second ,
69
+ WriteTimeout : 1 * time .Second ,
70
+ IdleTimeout : 30 * time .Second ,
71
+ ReadHeaderTimeout : 2 * time .Second ,
72
+ Addr : fmt .Sprintf ("127.0.0.1:%d" , opts .Port ),
73
+ }
52
74
log .Printf ("Serving prometheus metrics at http://127.0.0.1:%d/metrics" , opts .Port )
53
- lo .Must0 (http .ListenAndServe (fmt . Sprintf ( "127.0.0.1:%d" , opts . Port ), nil ))
75
+ lo .Must0 (srv .ListenAndServe ())
54
76
}
55
77
56
78
func demo (cfg aws.Config ) {
0 commit comments