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

feat: track event delivery stats #3974

Merged
merged 38 commits into from
Nov 9, 2023
Merged

Conversation

gane5hvarma
Copy link
Contributor

@gane5hvarma gane5hvarma commented Oct 12, 2023

Description

Completes OBS-148
The motivation for this pr is to have a single prom metrics the captures successful and aborted event delivery count across all stages. The metrics are used to calculate aborted percentage in mimir and send a notification to customers. This change is needed for the customer configurable alerts project

Linear Ticket

https://linear.app/rudderstack/project/%5Bp0p3%5D-health-customer-config-alerts-and-settings-phase-1-78dc57e675f8
https://linear.app/rudderstack/issue/OBS-148/single-metric-to-capture-failures-at-all-stages-of-the-pipeline-and

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (4e4adcf) 71.94% compared to head (51e5266) 71.98%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3974      +/-   ##
==========================================
+ Coverage   71.94%   71.98%   +0.03%     
==========================================
  Files         373      374       +1     
  Lines       54933    54966      +33     
==========================================
+ Hits        39522    39565      +43     
+ Misses      13095    13088       -7     
+ Partials     2316     2313       -3     
Files Coverage Δ
enterprise/reporting/event_stats.go 100.00% <100.00%> (ø)
enterprise/reporting/mediator.go 95.31% <100.00%> (+0.31%) ⬆️
enterprise/reporting/reporting.go 44.53% <15.38%> (+0.11%) ⬆️

... and 8 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if metric.StatusDetail.Status == "aborted" {
metricName = EventsAbortedMetricName
}
stats.Default.NewTaggedStat(metricName, stats.CountType, tags).Count(int(metric.StatusDetail.Count))
Copy link
Member

Choose a reason for hiding this comment

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

Can we use DI for stats, and convert the function to a method and add tests cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure leo

Copy link
Member

@lvrach lvrach Oct 13, 2023

Choose a reason for hiding this comment

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

hint: You can use memstats to assist in your testing.

Example:

require.EqualValues(t, statsStore.Get("pgnotifier.publish", stats.Tags{

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lvrach I have added test cases and changed it to method. Let me know if i got you correct

@lvrach
Copy link
Member

lvrach commented Oct 13, 2023

Remove < Replace with adequate description for this PR as per [Pull Request document](https://www.notion.so/rudderstacks/Pull-Requests-40a4c6bd7a5e4387ba9029bab297c9e3) > from the description, otherwise, the GitHub actions will not pass.

enterprise/reporting/reporting.go Outdated Show resolved Hide resolved
enterprise/reporting/event-stats/stats.go Outdated Show resolved Hide resolved
@gane5hvarma gane5hvarma removed the Draft label Oct 18, 2023
Copy link
Contributor

@atzoum atzoum left a comment

Choose a reason for hiding this comment

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

Some cleanup is needed on the default reporter

@@ -108,6 +110,8 @@ func NewDefaultReporter(ctx context.Context, log logger.Logger, configSubscriber
maxOpenConnections: maxOpenConnections,
maxConcurrentRequests: maxConcurrentRequests,
dbQueryTimeout: dbQueryTimeout,
statsReporter: NewEventStatsReporter(configSubscriber, stats),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
statsReporter: NewEventStatsReporter(configSubscriber, stats),

@@ -69,9 +69,11 @@ type DefaultReporter struct {
getMinReportedAtQueryTime stats.Measurement
getReportsQueryTime stats.Measurement
requestLatency stats.Measurement
statsReporter *EventStatsReporter
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
statsReporter *EventStatsReporter

@atzoum
Copy link
Contributor

atzoum commented Nov 9, 2023

@gane5hvarma is the Do not merge label still necessary?

@gane5hvarma
Copy link
Contributor Author

@atzoum thanks for pointing out. Removing the label

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

Successfully merging this pull request may close these issues.

7 participants