-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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]>
- Loading branch information
1 parent
b92ac52
commit bbcfa11
Showing
9 changed files
with
257 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
279 changes: 147 additions & 132 deletions
279
docs/sources/reference/components/prometheus/prometheus.exporter.windows.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters