Skip to content

Commit

Permalink
[release/v1.4] Prepare for 1.4.3 (#1923)
Browse files Browse the repository at this point in the history
* Add v1.4.3 to the changelog

* [faro collector] add missing struct fields so that payload.meta.browser fields are not lost (#1824)

* Update payload.go

* Update CHANGELOG.md

* Update payload.go

* Update payload.go

* Update payload.json

* Update payload.json

* Update payload.json

* Update payload_test.go

* Update payload.json

* Remove Pyroscope scrape loops for no longer active targets (#1833)

* fix: increase timeout for informer on loki.source.podlogs (#1862)

* [prometheus.exporter.windows] Fix default values (#1878)

* Fix default values

* Wrap regexes

* Remove unnecessary comment

* Fix comment

* enabled_list in the smb block should be deprecated

* Fix docs and comments

* Apply suggestions from code review

Co-authored-by: Clayton Cornell <[email protected]>

* Replace "regex" with "regular expression"

* Update changelog

---------

Co-authored-by: Clayton Cornell <[email protected]>

* Fix changelog

* Change VERSION

---------

Co-authored-by: a <[email protected]>
Co-authored-by: Alex Burnett <[email protected]>
Co-authored-by: Clayton Cornell <[email protected]>
  • Loading branch information
4 people authored Oct 18, 2024
1 parent e7c37a1 commit 21d118c
Show file tree
Hide file tree
Showing 16 changed files with 306 additions and 186 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ This document contains a historical list of changes between releases. Only
changes that impact end-user behavior are listed; changes to documentation or
internal API changes are not present.

v1.4.3
-----------------

### Bugfixes

- Fix an issue where some `faro.receiver` would drop multiple fields defined in `payload.meta.browser`, as fields were defined in the struct.

- `pyroscope.scrape` no longer tries to scrape endpoints which are not active targets anymore. (@wildum @mattdurham @dehaansa @ptodev)

- Fixed a bug with `loki.source.podlogs` not starting in large clusters due to short informer sync timeout. (@elburnetto-intapp)

- `prometheus.exporter.windows`: Fixed bug with `exclude` regular expression config arguments which caused missing metrics. (@ptodev)

v1.4.2
-----------------

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
#
# Lines starting with "#" and blank lines are ignored.

v1.4.2
v1.4.3
1 change: 1 addition & 0 deletions docs/sources/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ weight: 350
cascade:
ALLOY_RELEASE: v1.4.2
OTEL_VERSION: v0.105.0
PROM_WIN_EXP_VERSION: v0.27.3
FULL_PRODUCT_NAME: Grafana Alloy
PRODUCT_NAME: Alloy
hero:
Expand Down
1 change: 1 addition & 0 deletions docs/sources/_index.md.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ weight: 350
cascade:
ALLOY_RELEASE: $ALLOY_VERSION
OTEL_VERSION: v0.105.0
PROM_WIN_EXP_VERSION: v0.27.3
FULL_PRODUCT_NAME: Grafana Alloy
PRODUCT_NAME: Alloy
hero:
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ require (
github.com/prometheus-community/elasticsearch_exporter v1.5.0
github.com/prometheus-community/postgres_exporter v0.11.1
github.com/prometheus-community/stackdriver_exporter v0.15.1
github.com/prometheus-community/windows_exporter v0.27.3
github.com/prometheus-community/windows_exporter v0.27.4-0.20241010144849-a0f6d3bcf9a4
github.com/prometheus-operator/prometheus-operator v0.66.0
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0
github.com/prometheus-operator/prometheus-operator/pkg/client v0.66.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2126,6 +2126,8 @@ github.com/prometheus-community/stackdriver_exporter v0.15.1 h1:+k26zeBy8BlG+eDK
github.com/prometheus-community/stackdriver_exporter v0.15.1/go.mod h1:UmmIgnrVQqDAeM8pSeYntBcUxPhp8oqb8W3nvRYzsSg=
github.com/prometheus-community/windows_exporter v0.27.3 h1:L5Dc4gqc3477Y6jaVHhkm25jysqbxg1ajMyPbmnqScw=
github.com/prometheus-community/windows_exporter v0.27.3/go.mod h1:8+T6hfv71nvgVIzguouXkIGoa15ni+uXHHULBOA2bZo=
github.com/prometheus-community/windows_exporter v0.27.4-0.20241010144849-a0f6d3bcf9a4 h1:e6RmefQvH1jXwo7JnN5UvcyZz8uyABMFScnkrrWNrf0=
github.com/prometheus-community/windows_exporter v0.27.4-0.20241010144849-a0f6d3bcf9a4/go.mod h1:8+T6hfv71nvgVIzguouXkIGoa15ni+uXHHULBOA2bZo=
github.com/prometheus-operator/prometheus-operator v0.66.0 h1:Jj4mbGAkfBbTih6ait03f2vUjEHB7Kb4gnlAmWu7AJ0=
github.com/prometheus-operator/prometheus-operator v0.66.0/go.mod h1:U7S3+u6YTxwCTMNIQxZWttEq70qBA4Qps7/c5mUZOpQ=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0 h1:PPW01FLVjJHMNcbAL1DDD9EZceSQKMOU/VpK0irrxrI=
Expand Down
18 changes: 14 additions & 4 deletions internal/component/faro/receiver/internal/payload/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,16 @@ func (a App) KeyVal() *KeyVal {

// Browser holds metadata about a client's browser
type Browser struct {
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
OS string `json:"os,omitempty"`
Mobile bool `json:"mobile,omitempty"`
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
OS string `json:"os,omitempty"`
Mobile bool `json:"mobile,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
Language string `json:"language,omitempty"`
// TODO: properly serialize brands
// Brands json.RawMessage `json:"brands,omitempty"`
ViewportWidth string `json:"viewportWidth,omitempty"`
ViewportHeight string `json:"viewportHeight,omitempty"`
}

// KeyVal produces key->value representation of the Browser metadata
Expand All @@ -409,6 +415,10 @@ func (b Browser) KeyVal() *KeyVal {
KeyValAdd(kv, "version", b.Version)
KeyValAdd(kv, "os", b.OS)
KeyValAdd(kv, "mobile", fmt.Sprintf("%v", b.Mobile))
KeyValAdd(kv, "userAgent", b.UserAgent)
KeyValAdd(kv, "language", b.Language)
KeyValAdd(kv, "viewportWidth", b.ViewportWidth)
KeyValAdd(kv, "viewportHeight", b.ViewportHeight)
return kv
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func TestUnmarshalPayloadJSON(t *testing.T) {
Version: "88.12.1",
OS: "linux",
Mobile: false,
UserAgent: "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0",
Language: "en-US",
ViewportWidth: "1920",
ViewportHeight: "1080",
},
View: View{
Name: "foobar",
Expand Down
6 changes: 5 additions & 1 deletion internal/component/faro/receiver/testdata/payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,11 @@
"name": "chrome",
"version": "88.12.1",
"os": "linux",
"mobile": false
"mobile": false,
"userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0",
"language": "en-US",
"viewportWidth": "1920",
"viewportHeight": "1080"
},
"view": {
"name": "foobar"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/loki/source/podlogs/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type controller struct {
}

// Generous timeout period for configuring all informers
const informerSyncTimeout = 10 * time.Second
const informerSyncTimeout = 10 * time.Minute

// newController creates a new, unstarted controller. The controller will
// request a reconcile when the state of Kubernetes changes.
Expand Down
75 changes: 45 additions & 30 deletions internal/component/prometheus/exporter/windows/config.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
package windows

import (
"fmt"
"strings"

windows_integration "github.com/grafana/alloy/internal/static/integrations/windows_exporter"
)

// Wrap some regex strings to prevent issues with user-supplied empty strings.
// Prior to v0.27, the upstream exporter used to wrap regexes like this.
// Alloy is now doing this instead, to maintain backwards compatibility.
//
// This is mostly to prevent issues with `exclude` arguments.
// If `exclude` is set to `""` and there is no wrapping, the regex will match everything.
// Therefore, all collectors will be excluded.
//
// See https://github.com/grafana/alloy/issues/1845
// TODO: Remove this in Alloy v2.
func wrapRegex(regex string) string {
return fmt.Sprintf("^(?:%s)$", regex)
}

// Arguments is used for controlling for this exporter.
type Arguments struct {
// Collectors to mark as enabled
Expand Down Expand Up @@ -92,14 +107,14 @@ type IISConfig struct {
// Convert converts the component's IISConfig to the integration's IISConfig.
func (t IISConfig) Convert() windows_integration.IISConfig {
return windows_integration.IISConfig{
AppBlackList: t.AppBlackList,
AppWhiteList: t.AppWhiteList,
SiteBlackList: t.SiteBlackList,
SiteWhiteList: t.SiteWhiteList,
AppExclude: t.AppExclude,
AppInclude: t.AppInclude,
SiteExclude: t.SiteExclude,
SiteInclude: t.SiteInclude,
AppBlackList: wrapRegex(t.AppBlackList),
AppWhiteList: wrapRegex(t.AppWhiteList),
SiteBlackList: wrapRegex(t.SiteBlackList),
SiteWhiteList: wrapRegex(t.SiteWhiteList),
AppExclude: wrapRegex(t.AppExclude),
AppInclude: wrapRegex(t.AppInclude),
SiteExclude: wrapRegex(t.SiteExclude),
SiteInclude: wrapRegex(t.SiteInclude),
}
}

Expand All @@ -126,10 +141,10 @@ type SMTPConfig struct {
// Convert converts the component's SMTPConfig to the integration's SMTPConfig.
func (t SMTPConfig) Convert() windows_integration.SMTPConfig {
return windows_integration.SMTPConfig{
BlackList: t.BlackList,
WhiteList: t.WhiteList,
Exclude: t.Exclude,
Include: t.Include,
BlackList: wrapRegex(t.BlackList),
WhiteList: wrapRegex(t.WhiteList),
Exclude: wrapRegex(t.Exclude),
Include: wrapRegex(t.Include),
}
}

Expand Down Expand Up @@ -160,10 +175,10 @@ type ProcessConfig struct {
// Convert converts the component's ProcessConfig to the integration's ProcessConfig.
func (t ProcessConfig) Convert() windows_integration.ProcessConfig {
return windows_integration.ProcessConfig{
BlackList: t.BlackList,
WhiteList: t.WhiteList,
Exclude: t.Exclude,
Include: t.Include,
BlackList: wrapRegex(t.BlackList),
WhiteList: wrapRegex(t.WhiteList),
Exclude: wrapRegex(t.Exclude),
Include: wrapRegex(t.Include),
}
}

Expand All @@ -176,8 +191,8 @@ type ScheduledTaskConfig struct {
// Convert converts the component's ScheduledTaskConfig to the integration's ScheduledTaskConfig.
func (t ScheduledTaskConfig) Convert() windows_integration.ScheduledTaskConfig {
return windows_integration.ScheduledTaskConfig{
Exclude: t.Exclude,
Include: t.Include,
Exclude: wrapRegex(t.Exclude),
Include: wrapRegex(t.Include),
}
}

Expand All @@ -192,10 +207,10 @@ type NetworkConfig struct {
// Convert converts the component's NetworkConfig to the integration's NetworkConfig.
func (t NetworkConfig) Convert() windows_integration.NetworkConfig {
return windows_integration.NetworkConfig{
BlackList: t.BlackList,
WhiteList: t.WhiteList,
Exclude: t.Exclude,
Include: t.Include,
BlackList: wrapRegex(t.BlackList),
WhiteList: wrapRegex(t.WhiteList),
Exclude: wrapRegex(t.Exclude),
Include: wrapRegex(t.Include),
}
}

Expand Down Expand Up @@ -234,10 +249,10 @@ type LogicalDiskConfig struct {
// Convert converts the component's LogicalDiskConfig to the integration's LogicalDiskConfig.
func (t LogicalDiskConfig) Convert() windows_integration.LogicalDiskConfig {
return windows_integration.LogicalDiskConfig{
BlackList: t.BlackList,
WhiteList: t.WhiteList,
Include: t.Include,
Exclude: t.Exclude,
BlackList: wrapRegex(t.BlackList),
WhiteList: wrapRegex(t.WhiteList),
Include: wrapRegex(t.Include),
Exclude: wrapRegex(t.Exclude),
}
}

Expand All @@ -250,8 +265,8 @@ type PhysicalDiskConfig struct {
// Convert converts the component's PhysicalDiskConfig to the integration's PhysicalDiskConfig.
func (t PhysicalDiskConfig) Convert() windows_integration.PhysicalDiskConfig {
return windows_integration.PhysicalDiskConfig{
Include: t.Include,
Exclude: t.Exclude,
Include: wrapRegex(t.Include),
Exclude: wrapRegex(t.Exclude),
}
}

Expand All @@ -264,8 +279,8 @@ type PrinterConfig struct {
// Convert converts the component's ProcessConfig to the integration's ProcessConfig.
func (t PrinterConfig) Convert() windows_integration.PrinterConfig {
return windows_integration.PrinterConfig{
Exclude: t.Exclude,
Include: t.Include,
Exclude: wrapRegex(t.Exclude),
Include: wrapRegex(t.Include),
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package windows

import (
"os"
"path/filepath"
"testing"

"github.com/grafana/alloy/syntax"
Expand Down Expand Up @@ -44,3 +46,43 @@ func TestAlloyUnmarshalWithDefaultConfig(t *testing.T) {
require.Equal(t, defaultArgs.SMTP.Include, args.SMTP.Include)
require.Equal(t, defaultArgs.TextFile.TextFileDirectory, args.TextFile.TextFileDirectory)
}

// This is a copy of the getDefaultPath() function in:
// [email protected]\pkg\collector\textfile\textfile.go
func getDefaultTextFilePath() string {
execPath, _ := os.Executable()
return filepath.Join(filepath.Dir(execPath), "textfile_inputs")
}

func TestDefaultConfig(t *testing.T) {
// TODO: The BlackList and WhiteList attributes should be removed in Alloy v2.
// They are not even documented in Alloy v1.
expected := Arguments{
EnabledCollectors: []string{"cpu", "cs", "logical_disk", "net", "os", "service", "system"},
Dfsr: DfsrConfig{SourcesEnabled: []string{"connection", "folder", "volume"}},
Exchange: ExchangeConfig{EnabledList: []string{"ADAccessProcesses", "TransportQueues", "HttpProxy", "ActiveSync", "AvailabilityService", "OutlookWebAccess", "Autodiscover", "WorkloadManagement", "RpcClientAccess", "MapiHttpEmsmdb"}},
IIS: IISConfig{AppBlackList: "^$", AppWhiteList: "^.+$", SiteBlackList: "^$", SiteWhiteList: "^.+$", AppExclude: "^$", AppInclude: "^.+$", SiteExclude: "^$", SiteInclude: "^.+$"},
LogicalDisk: LogicalDiskConfig{BlackList: "^$", WhiteList: "^.+$", Include: "^.+$", Exclude: "^$"},
MSMQ: MSMQConfig{Where: ""},
MSSQL: MSSQLConfig{EnabledClasses: []string{"accessmethods", "availreplica", "bufman", "databases", "dbreplica", "genstats", "locks", "memmgr", "sqlstats", "sqlerrors", "transactions", "waitstats"}},
Network: NetworkConfig{BlackList: "^$", WhiteList: "^.+$", Exclude: "^$", Include: "^.+$"},
PhysicalDisk: PhysicalDiskConfig{Include: "^.+$", Exclude: "^$"},
Printer: PrinterConfig{Exclude: "^$", Include: "^.+$"},
Process: ProcessConfig{BlackList: "^$", WhiteList: "^.+$", Exclude: "^$", Include: "^.+$"},
ScheduledTask: ScheduledTaskConfig{Exclude: "^$", Include: "^.+$"},
Service: ServiceConfig{UseApi: "false", Where: "", V2: "false"},
SMB: SMBConfig{EnabledList: []string{}},
SMBClient: SMBClientConfig{EnabledList: []string{}},
SMTP: SMTPConfig{BlackList: "^$", WhiteList: "^.+$", Exclude: "^$", Include: "^.+$"},
TextFile: TextFileConfig{TextFileDirectory: getDefaultTextFilePath()},
}

var args Arguments
err := syntax.Unmarshal([]byte(""), &args)
require.NoError(t, err)
require.Equal(t, expected, args)

var defaultArgs Arguments
defaultArgs.SetToDefault()
require.Equal(t, expected, defaultArgs)
}
32 changes: 16 additions & 16 deletions internal/component/prometheus/exporter/windows/windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,27 +119,27 @@ func TestConvert(t *testing.T) {

require.Equal(t, "textfile,cpu", conf.EnabledCollectors)
require.Equal(t, "example", conf.Exchange.EnabledList)
require.Equal(t, "", conf.IIS.SiteExclude)
require.Equal(t, ".+", conf.IIS.SiteInclude)
require.Equal(t, "", conf.IIS.AppExclude)
require.Equal(t, ".+", conf.IIS.AppInclude)
require.Equal(t, "^(?:)$", conf.IIS.SiteExclude)
require.Equal(t, "^(?:.+)$", conf.IIS.SiteInclude)
require.Equal(t, "^(?:)$", conf.IIS.AppExclude)
require.Equal(t, "^(?:.+)$", conf.IIS.AppInclude)
require.Equal(t, "C:", conf.TextFile.TextFileDirectory)
require.Equal(t, "", conf.SMTP.Exclude)
require.Equal(t, ".+", conf.SMTP.Include)
require.Equal(t, "^(?:)$", conf.SMTP.Exclude)
require.Equal(t, "^(?:.+)$", conf.SMTP.Include)
require.Equal(t, "where", conf.Service.Where)
require.Equal(t, "true", conf.Service.V2)
require.Equal(t, "", conf.PhysicalDisk.Exclude)
require.Equal(t, ".+", conf.PhysicalDisk.Include)
require.Equal(t, "", conf.Process.Exclude)
require.Equal(t, ".+", conf.Process.Include)
require.Equal(t, "", conf.Printer.Exclude)
require.Equal(t, ".+", conf.Printer.Include)
require.Equal(t, "^(?:)$", conf.PhysicalDisk.Exclude)
require.Equal(t, "^(?:.+)$", conf.PhysicalDisk.Include)
require.Equal(t, "^(?:)$", conf.Process.Exclude)
require.Equal(t, "^(?:.+)$", conf.Process.Include)
require.Equal(t, "^(?:)$", conf.Printer.Exclude)
require.Equal(t, "^(?:.+)$", conf.Printer.Include)
require.Equal(t, "example", conf.SMB.EnabledList)
require.Equal(t, "example", conf.SMBClient.EnabledList)
require.Equal(t, "", conf.Network.Exclude)
require.Equal(t, ".+", conf.Network.Include)
require.Equal(t, "^(?:)$", conf.Network.Exclude)
require.Equal(t, "^(?:.+)$", conf.Network.Include)
require.Equal(t, "accessmethods", conf.MSSQL.EnabledClasses)
require.Equal(t, "where", conf.MSMQ.Where)
require.Equal(t, "", conf.LogicalDisk.Exclude)
require.Equal(t, ".+", conf.LogicalDisk.Include)
require.Equal(t, "^(?:)$", conf.LogicalDisk.Exclude)
require.Equal(t, "^(?:.+)$", conf.LogicalDisk.Include)
}
8 changes: 8 additions & 0 deletions internal/component/pyroscope/scrape/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ func (m *Manager) reload() {
wg.Done()
}(m.targetsGroups[setName], groups)
}

for tgName, sp := range m.targetsGroups {
if _, ok := m.targetSets[tgName]; !ok {
sp.stop()
delete(m.targetsGroups, tgName)
}
}

wg.Wait()
}

Expand Down
Loading

0 comments on commit 21d118c

Please sign in to comment.