Skip to content

Commit

Permalink
Fix G114 sec issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Cellebyte committed Sep 27, 2023
1 parent 942d750 commit 7318947
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions cmd/frr-monitoring/main.go
Original file line number Diff line number Diff line change
@@ -1,40 +1,27 @@
// Copyright 2022 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build go1.17
// +build go1.17

// A minimal example of how to include Prometheus instrumentation.
package main

import (
"flag"
"fmt"
"log"
"net/http"
"time"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/telekom/das-schiff-network-operator/pkg/monitoring"
)

const (
twenty = 20
)

var (
addr = flag.String("listen-address", ":7082", "The address to listen on for HTTP requests.")
)

func main() {

flag.Parse()

// Create a new registry.
Expand All @@ -59,7 +46,13 @@ func main() {
promhttp.HandlerOpts{
// Opt into OpenMetrics to support exemplars.
EnableOpenMetrics: true,
Timeout: time.Minute,
},
))
log.Fatal(http.ListenAndServe(*addr, nil))
server := http.Server{
Addr: *addr,
ReadHeaderTimeout: twenty * time.Second,
ReadTimeout: time.Minute,
}
log.Fatal(server.ListenAndServe())
}

0 comments on commit 7318947

Please sign in to comment.