Skip to content

Conversation

@fitbeard
Copy link
Contributor

@fitbeard fitbeard commented Nov 5, 2025

No description provided.

Signed-off-by: Tadas Sutkaitis <[email protected]>
@fitbeard fitbeard changed the title Feat/add metrics keystone feat: add Keystone metrics Nov 5, 2025
@fitbeard fitbeard requested a review from mnaser November 5, 2025 16:54
Copy link
Member

@mnaser mnaser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test data matches the upstream openstack-exporter fixtures and the file structure is well organized. A couple of changes needed for consistency:

  • ❌ Logger pattern needs to match the established namespace/subsystem/collector pattern in all sub-collectors
  • ❌ The _up metric handling should reflect actual success/failure of queries (currently always emits up=1)

func NewDomainsCollector(db *sql.DB, logger *slog.Logger) *DomainsCollector {
return &DomainsCollector{
db: db,
logger: logger,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logger should include structured context to match the established pattern in cinder/volumes.go:

logger: logger.With(
    "namespace", collector.Namespace,
    "subsystem", Subsystem,
    "collector", "domains",
),

func NewProjectsCollector(db *sql.DB, logger *slog.Logger) *ProjectsCollector {
return &ProjectsCollector{
db: db,
logger: logger,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - please add structured logger context:

logger: logger.With(
    "namespace", collector.Namespace,
    "subsystem", Subsystem,
    "collector", "projects",
),

db: db,
logger: logger,
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - please add structured logger context:

logger: logger.With(
    "namespace", collector.Namespace,
    "subsystem", Subsystem,
    "collector", "groups",
),

db: db,
logger: logger,
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - please add structured logger context:

logger: logger.With(
    "namespace", collector.Namespace,
    "subsystem", Subsystem,
    "collector", "regions",
),

db: db,
logger: logger,
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - please add structured logger context:

logger: logger.With(
    "namespace", collector.Namespace,
    "subsystem", Subsystem,
    "collector", "users",
),

c.groupsCollector.Collect(ch)
c.regionsCollector.Collect(ch)
c.usersCollector.Collect(ch)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _up metric is always set to 1 here, but it should reflect whether the sub-collectors succeeded. Looking at cinder/volumes.go, the pattern is:

  • Emit up=0 immediately when a query fails and return early
  • Emit up=1 only at the end after all metrics are successfully collected

Consider having sub-collectors return an error, or track success state, so the umbrella collector can emit up=0 when any sub-collector fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants