Skip to content

Conversation

pipiland2612
Copy link
Contributor

@pipiland2612 pipiland2612 commented Jun 17, 2025

Which problem is this PR solving?

Description of the changes

  • Add implementation for GetCallRate method in metricstore/elasticsearch/reader.go
  • Add corresponding unit tests

How was this change tested?

  • make lint test

Proof of this new feature

  • Check out my own repository https://github.com/pipiland2612/spm-elasticsearch
  • When I run this setup with the spanmetricsconnector enabled, along with Prometheus and Elasticsearch as metrics backends, the results from the Elasticsearch query closely align with what I see in the Prometheus UI.

image
image
image
image
image
image
image
image
image
image
Screenshot 2025-06-19 at 20 17 02
Screenshot 2025-06-19 at 20 17 18
Screenshot 2025-06-19 at 23 10 27
Screenshot 2025-06-19 at 23 10 48

Checklist

Copy link

codecov bot commented Jun 17, 2025

Codecov Report

Attention: Patch coverage is 96.55172% with 12 lines in your changes missing coverage. Please review.

Project coverage is 96.19%. Comparing base (0a5c8fa) to head (fb4537f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ternal/storage/metricstore/elasticsearch/reader.go 96.05% 6 Missing and 3 partials ⚠️
...nal/storage/metricstore/elasticsearch/to_domain.go 96.93% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7229      +/-   ##
==========================================
+ Coverage   96.16%   96.19%   +0.02%     
==========================================
  Files         372      374       +2     
  Lines       22345    22686     +341     
==========================================
+ Hits        21488    21822     +334     
- Misses        641      645       +4     
- Partials      216      219       +3     
Flag Coverage Δ
badger_v1 9.81% <ø> (ø)
badger_v2 1.77% <0.00%> (-0.06%) ⬇️
cassandra-4.x-v1-manual 12.97% <ø> (ø)
cassandra-4.x-v2-auto 1.76% <0.00%> (-0.06%) ⬇️
cassandra-4.x-v2-manual 1.76% <0.00%> (-0.06%) ⬇️
cassandra-5.x-v1-manual 12.97% <ø> (ø)
cassandra-5.x-v2-auto 1.76% <0.00%> (-0.06%) ⬇️
cassandra-5.x-v2-manual 1.76% <0.00%> (-0.06%) ⬇️
elasticsearch-6.x-v1 20.69% <ø> (ø)
elasticsearch-7.x-v1 20.74% <ø> (ø)
elasticsearch-8.x-v1 20.92% <ø> (ø)
elasticsearch-8.x-v2 1.77% <0.00%> (-0.06%) ⬇️
grpc_v1 11.34% <ø> (ø)
grpc_v2 1.77% <0.00%> (-0.06%) ⬇️
kafka-3.x-v1 10.16% <ø> (ø)
kafka-3.x-v2 1.77% <0.00%> (-0.06%) ⬇️
memory_v2 1.77% <0.00%> (-0.06%) ⬇️
opensearch-1.x-v1 20.79% <ø> (ø)
opensearch-2.x-v1 20.79% <ø> (ø)
opensearch-2.x-v2 1.86% <0.00%> (+0.04%) ⬆️
query 1.77% <0.00%> (-0.06%) ⬇️
tailsampling-processor 0.49% <0.00%> (-0.02%) ⬇️
unittests 95.06% <96.55%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pipiland2612 pipiland2612 changed the title Get call rate implementation [WIP] Get call rate implementation Jun 18, 2025
@pipiland2612 pipiland2612 marked this pull request as draft June 18, 2025 06:02
@pipiland2612 pipiland2612 marked this pull request as ready for review June 18, 2025 07:55
@pipiland2612 pipiland2612 changed the title [WIP] Get call rate implementation Get call rate implementation Jun 18, 2025
@pipiland2612
Copy link
Contributor Author

Hi @yurishkuro , the pull request is ready for your review

@pipiland2612 pipiland2612 changed the title Get call rate implementation [spm] GetCallRate implementation Jun 18, 2025
@pipiland2612 pipiland2612 changed the title [spm] GetCallRate implementation [WIP] [spm] GetCallRate implementation Jun 18, 2025
@pipiland2612 pipiland2612 marked this pull request as draft June 18, 2025 19:08
@pipiland2612 pipiland2612 force-pushed the GetCallRate_implementation branch from 00e72db to 7743095 Compare June 19, 2025 11:05
@pipiland2612 pipiland2612 marked this pull request as ready for review June 19, 2025 11:16
@pipiland2612 pipiland2612 changed the title [WIP] [spm] GetCallRate implementation [spm] GetCallRate implementation Jun 19, 2025
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
github-merge-queue bot pushed a commit that referenced this pull request Jul 1, 2025
## Which problem is this PR solving?
- Solve parts of #7243
- Supports #7229

## 🛑 Breaking change
- ES v2 implementation will by default materialize / elevate tags
`span.kind` and `span.status` (or `error`) to top level fields in the ES
document.
- 

## How was this change tested?
- make lint test

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `npm run lint` and `npm run test`

---------

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
pipiland2612 and others added 3 commits July 1, 2025 22:40
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
@pipiland2612 pipiland2612 force-pushed the GetCallRate_implementation branch from 8edf36d to 80f85b4 Compare July 1, 2025 20:02
@pipiland2612 pipiland2612 requested a review from yurishkuro July 1, 2025 20:22
const (
minStep = time.Millisecond
aggName = "results_buckets"
searchIndex = "jaeger-span-*"
Copy link
Member

Choose a reason for hiding this comment

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

index name can be customized by the user, we should be using the same config as ES storage.

Copy link
Contributor Author

@pipiland2612 pipiland2612 Jul 2, 2025

Choose a reason for hiding this comment

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

Thanks for your feedback. Solved at 51b838e
and fb4537f

Copy link
Contributor Author

@pipiland2612 pipiland2612 Jul 2, 2025

Choose a reason for hiding this comment

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

The current index search search for all index no matter the time range. I think I will solve this problem in W7: Optimisation

}

// executeSearch performs the Elasticsearch search.
func (r MetricsReader) executeSearch(ctx context.Context, p MetricsQueryParams) (*metrics.MetricFamily, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't like how "hidden" the processing function here, passed via p. Why not simply return the results of the search and call processing function afterwards?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, that's make sense. It will make the conversion layer only do it's job converting and we can make the processingFunc to be more transparent in the reader.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solved at 975c4e6

Copy link
Member

Choose a reason for hiding this comment

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

no, not solved, see below

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
@pipiland2612 pipiland2612 force-pushed the GetCallRate_implementation branch from 7f7fa47 to 975c4e6 Compare July 2, 2025 04:01
@pipiland2612 pipiland2612 requested a review from yurishkuro July 2, 2025 04:04
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
@yurishkuro yurishkuro added the changelog:exprimental Change to an experimental part of the code label Jul 2, 2025
}

// executeSearch performs the Elasticsearch search.
func (r MetricsReader) executeSearch(ctx context.Context, p MetricsQueryParams) (*metrics.MetricFamily, error) {
Copy link
Member

Choose a reason for hiding this comment

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

no, not solved, see below

@yurishkuro yurishkuro added this pull request to the merge queue Jul 2, 2025
Merged via the queue into jaegertracing:main with commit 0cf2b7b Jul 2, 2025
60 of 61 checks passed
@pipiland2612 pipiland2612 deleted the GetCallRate_implementation branch July 2, 2025 16:06
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.

3 participants