Skip to content

Commit

Permalink
Merge pull request #561 from grafana/krajo/merge-upstream
Browse files Browse the repository at this point in the history
Sync with upstream main at 79f4e45
  • Loading branch information
krajorama authored Nov 3, 2023
2 parents 5f9db04 + 1149f7e commit 790cede
Show file tree
Hide file tree
Showing 74 changed files with 954 additions and 313 deletions.
7 changes: 4 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ linters:
- depguard
- errorlint
- gocritic
- godot
- gofumpt
- goimports
- misspell
Expand All @@ -33,9 +34,6 @@ issues:
- path: _test.go
linters:
- errcheck
- path: scrape/
linters:
- errorlint
- path: tsdb/
linters:
- errorlint
Expand All @@ -45,6 +43,9 @@ issues:
- path: web/
linters:
- errorlint
- linters:
- godot
source: "^// ==="

linters-settings:
depguard:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2.48.0-rc.2 / 2023-11-02

* [ENHANCEMENT] Scraping: Add configuration option for tracking staleness of scraped timestamps. #13060
* [BUGFIX] Storage: Fix crash caused by incorrect mixed samples handling. #13055
* [BUGFIX] TSDB: Fix compactor failures by adding min time to histogram chunks. #13062

## 2.48.0-rc.1 / 2023-10-24

* [BUGFIX] PromQL: Reduce inefficiency introduced by warnings/annotations and temporarily remove possible non-counter warnings. #13012
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.48.0-rc.1
2.48.0-rc.2
2 changes: 1 addition & 1 deletion cmd/prometheus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ func startsOrEndsWithQuote(s string) bool {
strings.HasSuffix(s, "\"") || strings.HasSuffix(s, "'")
}

// compileCORSRegexString compiles given string and adds anchors
// compileCORSRegexString compiles given string and adds anchors.
func compileCORSRegexString(s string) (*regexp.Regexp, error) {
r, err := relabel.NewRegexp(s)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion discovery/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func newCredential(cfg SDConfig, policyClientOptions policy.ClientOptions) (azco
return credential, nil
}

// virtualMachine represents an Azure virtual machine (which can also be created by a VMSS)
// virtualMachine represents an Azure virtual machine (which can also be created by a VMSS).
type virtualMachine struct {
ID string
Name string
Expand Down
2 changes: 1 addition & 1 deletion discovery/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const (
tagsLabel = model.MetaLabelPrefix + "consul_tags"
// serviceLabel is the name of the label containing the service name.
serviceLabel = model.MetaLabelPrefix + "consul_service"
// healthLabel is the name of the label containing the health of the service instance
// healthLabel is the name of the label containing the health of the service instance.
healthLabel = model.MetaLabelPrefix + "consul_health"
// serviceAddressLabel is the name of the label containing the (optional) service address.
serviceAddressLabel = model.MetaLabelPrefix + "consul_service_address"
Expand Down
8 changes: 4 additions & 4 deletions discovery/digitalocean/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"testing"
)

// SDMock is the interface for the DigitalOcean mock
// SDMock is the interface for the DigitalOcean mock.
type SDMock struct {
t *testing.T
Server *httptest.Server
Expand All @@ -35,18 +35,18 @@ func NewSDMock(t *testing.T) *SDMock {
}
}

// Endpoint returns the URI to the mock server
// Endpoint returns the URI to the mock server.
func (m *SDMock) Endpoint() string {
return m.Server.URL + "/"
}

// Setup creates the mock server
// Setup creates the mock server.
func (m *SDMock) Setup() {
m.Mux = http.NewServeMux()
m.Server = httptest.NewServer(m.Mux)
}

// ShutdownServer creates the mock server
// ShutdownServer creates the mock server.
func (m *SDMock) ShutdownServer() {
m.Server.Close()
}
Expand Down
8 changes: 4 additions & 4 deletions discovery/hetzner/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"
)

// SDMock is the interface for the Hetzner Cloud mock
// SDMock is the interface for the Hetzner Cloud mock.
type SDMock struct {
t *testing.T
Server *httptest.Server
Expand All @@ -34,19 +34,19 @@ func NewSDMock(t *testing.T) *SDMock {
}
}

// Endpoint returns the URI to the mock server
// Endpoint returns the URI to the mock server.
func (m *SDMock) Endpoint() string {
return m.Server.URL + "/"
}

// Setup creates the mock server
// Setup creates the mock server.
func (m *SDMock) Setup() {
m.Mux = http.NewServeMux()
m.Server = httptest.NewServer(m.Mux)
m.t.Cleanup(m.Server.Close)
}

// ShutdownServer creates the mock server
// ShutdownServer creates the mock server.
func (m *SDMock) ShutdownServer() {
m.Server.Close()
}
Expand Down
6 changes: 3 additions & 3 deletions discovery/kubernetes/client_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var (
[]string{"endpoint"},
)

// Definition of metrics for client-go workflow metrics provider
// Definition of metrics for client-go workflow metrics provider.
clientGoWorkqueueDepthMetricVec = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: workqueueMetricsNamespace,
Expand Down Expand Up @@ -106,7 +106,7 @@ func (noopMetric) Dec() {}
func (noopMetric) Observe(float64) {}
func (noopMetric) Set(float64) {}

// Definition of client-go metrics adapters for HTTP requests observation
// Definition of client-go metrics adapters for HTTP requests observation.
type clientGoRequestMetricAdapter struct{}

func (f *clientGoRequestMetricAdapter) Register(registerer prometheus.Registerer) {
Expand All @@ -130,7 +130,7 @@ func (clientGoRequestMetricAdapter) Observe(_ context.Context, _ string, u url.U
clientGoRequestLatencyMetricVec.WithLabelValues(u.EscapedPath()).Observe(latency.Seconds())
}

// Definition of client-go workqueue metrics provider definition
// Definition of client-go workqueue metrics provider definition.
type clientGoWorkqueueMetricsProvider struct{}

func (f *clientGoWorkqueueMetricsProvider) Register(registerer prometheus.Registerer) {
Expand Down
6 changes: 3 additions & 3 deletions discovery/kubernetes/endpointslice_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// endpointSliceAdaptor is an adaptor for the different EndpointSlice versions
// endpointSliceAdaptor is an adaptor for the different EndpointSlice versions.
type endpointSliceAdaptor interface {
get() interface{}
getObjectMeta() metav1.ObjectMeta
Expand Down Expand Up @@ -55,7 +55,7 @@ type endpointSliceEndpointConditionsAdaptor interface {
terminating() *bool
}

// Adaptor for k8s.io/api/discovery/v1
// Adaptor for k8s.io/api/discovery/v1.
type endpointSliceAdaptorV1 struct {
endpointSlice *v1.EndpointSlice
}
Expand Down Expand Up @@ -108,7 +108,7 @@ func (e *endpointSliceAdaptorV1) labelServiceName() string {
return v1.LabelServiceName
}

// Adaptor for k8s.io/api/discovery/v1beta1
// Adaptor for k8s.io/api/discovery/v1beta1.
type endpointSliceAdaptorV1Beta1 struct {
endpointSlice *v1beta1.EndpointSlice
}
Expand Down
6 changes: 3 additions & 3 deletions discovery/kubernetes/ingress_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ingressAdaptor is an adaptor for the different Ingress versions
// ingressAdaptor is an adaptor for the different Ingress versions.
type ingressAdaptor interface {
getObjectMeta() metav1.ObjectMeta
name() string
Expand All @@ -36,7 +36,7 @@ type ingressRuleAdaptor interface {
host() string
}

// Adaptor for networking.k8s.io/v1
// Adaptor for networking.k8s.io/v1.
type ingressAdaptorV1 struct {
ingress *v1.Ingress
}
Expand Down Expand Up @@ -90,7 +90,7 @@ func (i *ingressRuleAdaptorV1) paths() []string {

func (i *ingressRuleAdaptorV1) host() string { return i.rule.Host }

// Adaptor for networking.k8s.io/v1beta1
// Adaptor for networking.k8s.io/v1beta1.
type ingressAdaptorV1Beta1 struct {
ingress *v1beta1.Ingress
}
Expand Down
6 changes: 3 additions & 3 deletions discovery/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ const (
)

var (
// Http header
// Http header.
userAgent = fmt.Sprintf("Prometheus/%s", version.Version)
// Custom events metric
// Custom events metric.
eventCount = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: metricsNamespace,
Expand All @@ -76,7 +76,7 @@ var (
},
[]string{"role", "event"},
)
// DefaultSDConfig is the default Kubernetes SD configuration
// DefaultSDConfig is the default Kubernetes SD configuration.
DefaultSDConfig = SDConfig{
HTTPClientConfig: config.DefaultHTTPClientConfig,
}
Expand Down
2 changes: 1 addition & 1 deletion discovery/kubernetes/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (n *Node) buildNode(node *apiv1.Node) *targetgroup.Group {
// 5. NodeLegacyHostIP
// 6. NodeHostName
//
// Derived from k8s.io/kubernetes/pkg/util/node/node.go
// Derived from k8s.io/kubernetes/pkg/util/node/node.go.
func nodeAddress(node *apiv1.Node) (string, map[apiv1.NodeAddressType][]string, error) {
m := map[apiv1.NodeAddressType][]string{}
for _, a := range node.Status.Addresses {
Expand Down
2 changes: 1 addition & 1 deletion discovery/legacymanager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ type Manager struct {
triggerSend chan struct{}
}

// Run starts the background processing
// Run starts the background processing.
func (m *Manager) Run() error {
go m.sender()
<-m.ctx.Done()
Expand Down
8 changes: 4 additions & 4 deletions discovery/linode/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"
)

// SDMock is the interface for the Linode mock
// SDMock is the interface for the Linode mock.
type SDMock struct {
t *testing.T
Server *httptest.Server
Expand All @@ -34,18 +34,18 @@ func NewSDMock(t *testing.T) *SDMock {
}
}

// Endpoint returns the URI to the mock server
// Endpoint returns the URI to the mock server.
func (m *SDMock) Endpoint() string {
return m.Server.URL + "/"
}

// Setup creates the mock server
// Setup creates the mock server.
func (m *SDMock) Setup() {
m.Mux = http.NewServeMux()
m.Server = httptest.NewServer(m.Mux)
}

// ShutdownServer creates the mock server
// ShutdownServer creates the mock server.
func (m *SDMock) ShutdownServer() {
m.Server.Close()
}
Expand Down
2 changes: 1 addition & 1 deletion discovery/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type Provider struct {
newSubs map[string]struct{}
}

// Discoverer return the Discoverer of the provider
// Discoverer return the Discoverer of the provider.
func (p *Provider) Discoverer() Discoverer {
return p.d
}
Expand Down
2 changes: 1 addition & 1 deletion discovery/marathon/marathon.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const (
// imageLabel is the label that is used for the docker image running the service.
imageLabel model.LabelName = metaLabelPrefix + "image"
// portIndexLabel is the integer port index when multiple ports are defined;
// e.g. PORT1 would have a value of '1'
// e.g. PORT1 would have a value of '1'.
portIndexLabel model.LabelName = metaLabelPrefix + "port_index"
// taskLabel contains the mesos task name of the app instance.
taskLabel model.LabelName = metaLabelPrefix + "task"
Expand Down
6 changes: 3 additions & 3 deletions discovery/moby/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/prometheus/prometheus/util/strutil"
)

// SDMock is the interface for the DigitalOcean mock
// SDMock is the interface for the DigitalOcean mock.
type SDMock struct {
t *testing.T
Server *httptest.Server
Expand All @@ -47,12 +47,12 @@ func NewSDMock(t *testing.T, directory string) *SDMock {
}
}

// Endpoint returns the URI to the mock server
// Endpoint returns the URI to the mock server.
func (m *SDMock) Endpoint() string {
return m.Server.URL + "/"
}

// Setup creates the mock server
// Setup creates the mock server.
func (m *SDMock) Setup() {
m.Mux = http.NewServeMux()
m.Server = httptest.NewServer(m.Mux)
Expand Down
2 changes: 1 addition & 1 deletion discovery/nomad/nomad_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type NomadSDTestSuite struct {
Mock *SDMock
}

// SDMock is the interface for the nomad mock
// SDMock is the interface for the nomad mock.
type SDMock struct {
t *testing.T
Server *httptest.Server
Expand Down
Loading

0 comments on commit 790cede

Please sign in to comment.