Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metrics and additional logging for Data Sources #5404

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

teodor-yanev
Copy link
Contributor

@teodor-yanev teodor-yanev commented Feb 4, 2025

Summary

Provide a brief overview of the changes and the issue being addressed.
Explain the rationale and any background necessary for understanding the changes.
List dependencies required by this change, if any.

Fixes mindersec/minder-rules-and-profiles#304

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

@teodor-yanev teodor-yanev requested a review from a team as a code owner February 4, 2025 12:55
@teodor-yanev teodor-yanev self-assigned this Feb 4, 2025
@coveralls
Copy link

coveralls commented Feb 4, 2025

Coverage Status

coverage: 57.492% (+0.02%) from 57.472%
when pulling 4762f89 on issue-304-dara-sources-metrics
into f770400 on main.

Copy link
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

Two minor comments, but I'm okay submitting this as-is.

Comment on lines +74 to +76
dataSourceLatencyHistogram, err = meter.Int64Histogram(
"datasource.rest.latency",
metric.WithDescription("Latency of data source requests in milliseconds"),
Copy link
Member

Choose a reason for hiding this comment

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

Record the unit with the metric:

Suggested change
dataSourceLatencyHistogram, err = meter.Int64Histogram(
"datasource.rest.latency",
metric.WithDescription("Latency of data source requests in milliseconds"),
dataSourceLatencyHistogram, err = meter.Int64Histogram(
"datasource.rest.latency",
metric.WithDescription("Latency of data source requests in milliseconds"),
metric.WithUnit("ms"),

Comment on lines +67 to +70
dataSourceRequestCounter, err = meter.Int64Counter(
"datasource.rest.request",
metric.WithDescription("Total number of data source requests issued"),
)
Copy link
Member

Choose a reason for hiding this comment

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

If we're keeping a histogram, we don't need a separate counter -- the top bin of the histogram will give us the total counts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

Data Sources - Ensure appropriate monitoring mechanisms are in place (metrics)
3 participants