logon: deprecate collector. Use terminal_services instead (#1957)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2025-04-04 20:20:08 +02:00
committed by GitHub
parent fa8af098c8
commit 0846c2805f
6 changed files with 15 additions and 87 deletions

View File

@@ -34,6 +34,7 @@ type Config struct{}
var ConfigDefaults = Config{}
// A Collector is a Prometheus Collector for WMI metrics.
// Deprecated: Use windows_terminal_services_session_info instead.
type Collector struct {
config Config
@@ -64,10 +65,16 @@ func (c *Collector) Close() error {
return nil
}
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
logger.Warn("The logon collector will be removed mid 2025. "+
"See https://github.com/prometheus-community/windows_exporter/pull/1957 for more information. If you see values in this collector"+
" that you need, please open an issue to discuss how to get them into the new collector.",
slog.String("collector", Name),
)
c.sessionInfo = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "session_logon_timestamp_seconds"),
"timestamp of the logon session in seconds.",
"Deprecated. Use windows_terminal_services_session_info instead.",
[]string{"id", "username", "domain", "type"},
nil,
)

View File

@@ -53,7 +53,7 @@ type Collector struct {
processesLimit *prometheus.Desc
// users
// Deprecated: Use count(windows_logon_logon_type) instead.
// Deprecated: Use `sum(windows_terminal_services_session_info{state="active"})` instead.
users *prometheus.Desc
// physicalMemoryFreeBytes
@@ -106,7 +106,7 @@ func (c *Collector) Close() error {
}
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
logger.Warn("The os collect holds a number of deprecated metrics and will be removed mid 2025. "+
logger.Warn("The os collector holds a number of deprecated metrics and will be removed mid 2025. "+
"See https://github.com/prometheus-community/windows_exporter/pull/1596 for more information.",
slog.String("collector", Name),
)
@@ -180,7 +180,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
)
c.users = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "users"),
"Deprecated: Use `count(windows_logon_logon_type)` instead.",
"Deprecated: Use `sum(windows_terminal_services_session_info{state=\"active\"})` instead.",
nil,
nil,
)

View File

@@ -439,7 +439,7 @@ func (c *Collector) collectWTSSessions(ch chan<- prometheus.Metric) error {
for _, session := range sessions {
// only connect metrics for remote named sessions
n := strings.ReplaceAll(session.SessionName, "#", " ")
if n == "" || n == "Services" || n == "Console" {
if n == "" || n == "Services" {
continue
}