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

fix(reporting): gateway events are not reported when source is connected to no destination(or device mode destination) #1822

Merged
merged 4 commits into from
Apr 10, 2022

Conversation

Sidddddarth
Copy link
Member

@Sidddddarth Sidddddarth commented Apr 7, 2022

Description of the change

Moved around metric computation in processor to get proper ingestion numbers.

  1. Sources with no destinations
  2. Sources with Device mode destinations

Example scenarios:

  1. 1 source - no dest: gateway = 1, destination_filter = -1(diff)
  2. 1 source - device mode dest: gateway = 1, destination_filter = -1(diff)
  3. 1 source - 2 dests(1 device, 1 cloud): gateway = 1, destination_filter = 1, transformation = 1, router = 1

Notion Link

https://www.notion.so/rudderstacks/Reporting-does-not-report-Gateway-events-when-there-is-no-destination-is-connected-to-a-source-b5a37d7df9944c84818c42475d7c55ca

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added unit tests for the code
  • I have made corresponding changes to the documentation

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 Apr 7, 2022

Codecov Report

Merging #1822 (8eca515) into master (c184c24) will decrease coverage by 0.02%.
The diff coverage is 16.12%.

@@            Coverage Diff             @@
##           master    #1822      +/-   ##
==========================================
- Coverage   24.24%   24.21%   -0.03%     
==========================================
  Files         122      122              
  Lines       24236    24294      +58     
==========================================
+ Hits         5876     5884       +8     
- Misses      18010    18059      +49     
- Partials      350      351       +1     
Impacted Files Coverage Δ
utils/types/reporting_types.go 0.00% <ø> (ø)
processor/processor.go 69.76% <16.12%> (-2.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c184c24...8eca515. Read the comment docs.

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.

Still many questions will go through the changes together

if countMetadataMap != nil {
if _, ok := countMetadataMap[countKey]; !ok {
countMetadataMap[countKey] = MetricMetadata{sourceID: event.Metadata.SourceID, destinationID: event.Metadata.DestinationID, sourceBatchID: event.Metadata.SourceBatchID, sourceTaskID: event.Metadata.SourceTaskID, sourceTaskRunID: event.Metadata.SourceTaskRunID, sourceJobID: event.Metadata.SourceJobID, sourceJobRunID: event.Metadata.SourceJobRunID, sourceDefinitionID: event.Metadata.SourceDefinitionID, destinationDefinitionID: event.Metadata.DestinationDefinitionID, sourceCategory: event.Metadata.SourceCategory}
countMetadataMap[countKey] = MetricMetadata{
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -879,21 +879,59 @@ func (proc *HandleT) updateMetricMaps(countMetadataMap map[string]MetricMetadata
var eventType string
eventName = event.Metadata.EventName
eventType = event.Metadata.EventType
countKey := strings.Join([]string{event.Metadata.SourceID, event.Metadata.DestinationID, event.Metadata.SourceBatchID, eventName, eventType}, METRICKEYDELIMITER)

countKey := strings.Join([]string{
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

processor/processor.go Outdated Show resolved Hide resolved
sourceForSingularEvent,
)

//REPORTING - GATEWAY metrics - START
Copy link
Contributor

Choose a reason for hiding this comment

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

The current implementation of capturing reporting metrics seems to be convoluted. The least I can say is that it is hard to follow, since as it appears many things need to happen at different stages of this method, without a clear purpose.
I will invest some time to study the current implementation in hope of forming a cleaner picture for the specific domain, otherwise I cannot be of any more use with regards to reviewing this PR.

@Sidddddarth Sidddddarth changed the title reportsForNoDestSourcesWithDiff fix.reportsForNoDestSourcesWithDiff Apr 8, 2022
Co-authored-by: Aris Tzoumas <atzoumas@rudderstack.com>
@Sidddddarth Sidddddarth changed the title fix.reportsForNoDestSourcesWithDiff fix.Reporting:reportsForNoDestSourcesWithDiff Apr 8, 2022
@atzoum
Copy link
Contributor

atzoum commented Apr 9, 2022

Please update the pull request's title according to our new policy

@Sidddddarth
Copy link
Member Author

Please update the pull request's title according to our new policy

Is there an example I can see?
Because this is how I interpreted the policy wrt the title😅

From the article:
<type>[optional scope]: <description>
I think this is a fix, although not a bug. Maybe it's a feature. Optional scope would be Reporting here?
The description portion can be shortened a bit more imo. I'll do that now.

Suggestions/corrections welcome.

@Sidddddarth Sidddddarth changed the title fix.Reporting:reportsForNoDestSourcesWithDiff fix.Reporting:introducingDESTINATIONFILTER_PU Apr 9, 2022
@atzoum
Copy link
Contributor

atzoum commented Apr 9, 2022

Please update the pull request's title according to our new policy

Is there an example I can see? Because this is how I interpreted the policy wrt the title😅

From the article: <type>[optional scope]: <description> I think this is a fix, although not a bug. Maybe it's a feature. Optional scope would be Reporting here? The description portion can be shortened a bit more imo. I'll do that now.

Suggestions/corrections welcome.

This should be enough (I used the title from the notion ticket, but feel free to change it if there is something more appropriate):

fix(reporting): gateway events are not reported when there is no destination connected to a source

In the title you are free to use language that humans can understand (with spaces) 😊

@Sidddddarth
Copy link
Member Author

This should be enough (I used the title from the notion ticket, but feel free to change it if there is something more appropriate):

fix(reporting): gateway events are not reported when there is no destination connected to a source

In the title you are free to use language that humans can understand (with spaces) 😊

Understood now.
I'd taken these examples to heart:

  • feat.pendingEvtRedesign
  • fix.routerCrashLoop
  • chore.ghLabelAction
  • refactor.jobsdbQueries
  • exp.tzoumasa
  • doc.readme
  • test.multitenantPickupAlg
    emphasis on human-readable.

@Sidddddarth Sidddddarth changed the title fix.Reporting:introducingDESTINATIONFILTER_PU fix(reporting): gateway events are not reported when source is connected to no destination(or device mode destination) Apr 10, 2022
@cisse21 cisse21 merged commit 2962bd6 into master Apr 10, 2022
@cisse21 cisse21 deleted the fix.reportsForNoDestSources branch April 10, 2022 15:57
This was referenced Jun 23, 2022
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.

4 participants