Skip to content

Conversation

pipiland2612
Copy link
Contributor

@pipiland2612 pipiland2612 commented Jul 7, 2025

Which problem is this PR solving?

Description of the changes

  • Implement GetErrorRate Implementation
  • Add corresponding unit test
  • Refactor reader.go (by introduce processor.go), reader_test.go

How was this change tested?

  • CI

Proof of the feature

  • may be there is a bug with getErrorRate chart inside jaeger-ui, it's turning math.NaN into 0
Screenshot 2025-07-07 at 16 51 07 Screenshot 2025-07-07 at 16 50 06 Screenshot 2025-07-07 at 16 52 21 Screenshot 2025-07-07 at 16 51 57 Screenshot 2025-07-07 at 16 53 37 Screenshot 2025-07-07 at 16 53 49

Checklist

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>
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
Copy link

codecov bot commented Jul 7, 2025

Codecov Report

Attention: Patch coverage is 95.91837% with 8 lines in your changes missing coverage. Please review.

Project coverage is 96.15%. Comparing base (fc24698) to head (b7e5f9a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...nal/storage/metricstore/elasticsearch/processor.go 95.03% 5 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7298      +/-   ##
==========================================
- Coverage   96.15%   96.15%   -0.01%     
==========================================
  Files         376      377       +1     
  Lines       22747    22863     +116     
==========================================
+ Hits        21873    21984     +111     
- Misses        659      662       +3     
- Partials      215      217       +2     
Flag Coverage Δ
badger_v1 9.17% <ø> (ø)
badger_v2 1.76% <0.00%> (-0.02%) ⬇️
cassandra-4.x-v1-manual 11.91% <ø> (ø)
cassandra-4.x-v2-auto 1.75% <0.00%> (-0.02%) ⬇️
cassandra-4.x-v2-manual 1.75% <0.00%> (-0.02%) ⬇️
cassandra-5.x-v1-manual 11.91% <ø> (ø)
cassandra-5.x-v2-auto 1.75% <0.00%> (-0.02%) ⬇️
cassandra-5.x-v2-manual 1.75% <0.00%> (-0.02%) ⬇️
elasticsearch-6.x-v1 16.66% <ø> (ø)
elasticsearch-7.x-v1 16.71% <ø> (ø)
elasticsearch-8.x-v1 16.87% <ø> (ø)
elasticsearch-8.x-v2 1.76% <0.00%> (-0.02%) ⬇️
grpc_v1 10.42% <ø> (ø)
grpc_v2 1.76% <0.00%> (-0.02%) ⬇️
kafka-3.x-v1 9.34% <ø> (ø)
kafka-3.x-v2 1.76% <0.00%> (-0.02%) ⬇️
memory_v2 1.76% <0.00%> (-0.02%) ⬇️
opensearch-1.x-v1 16.75% <ø> (ø)
opensearch-2.x-v1 16.75% <ø> (ø)
opensearch-2.x-v2 1.76% <0.00%> (-0.02%) ⬇️
query 1.76% <0.00%> (-0.02%) ⬇️
tailsampling-processor 0.48% <0.00%> (-0.01%) ⬇️
unittests 95.07% <95.91%> (+<0.01%) ⬆️

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.

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
@pipiland2612 pipiland2612 changed the title Get error rate implementation [spm] GetErrorRates implementation Jul 7, 2025
@pipiland2612
Copy link
Contributor Author

Hi @yurishkuro, this pr is ready for your review! Thank you

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
@pipiland2612 pipiland2612 requested a review from yurishkuro July 7, 2025 16:56
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
@pipiland2612 pipiland2612 requested a review from yurishkuro July 8, 2025 09:37
for i, label := range labels {
keys[i] = fmt.Sprintf("%s=%s", label.Name, label.Value)
}
return strings.Join(keys, ",")
Copy link
Member

Choose a reason for hiding this comment

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

what about the order of labels? "a=x,b=y" != "b=y,a=x"

Copy link
Contributor Author

@pipiland2612 pipiland2612 Jul 9, 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! For the sake of correctness, we should do it. I think we can handle this case by first sorting the array

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 be7612d

Copy link
Member

Choose a reason for hiding this comment

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

ok, so the code may be technically correct now, but isn't it your code that creates metrics family with labels in the first place? Is it possible to have more than one label? If not, do you need to concatenate them into a string rather than just looking up the service name?

Also, why are only service names used as labels, isn't there a use case where operation is also a label?

Copy link
Contributor Author

@pipiland2612 pipiland2612 Jul 10, 2025

Choose a reason for hiding this comment

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

Hi @yurishkuro, Yes Jaeger control the label inside to_domain.go, this is what I have been thinking about in the first place, we do not actually need to sort it because it's always the same order (but for safety, this is good and it's not that computationally expensive (just several labels is fast)). Yes, it's possible to have more than one label (e.g service_name, operation). Because there are more than one label, we can't look up by just the service_name.

No not only service_name is used as label, operation is also used as a label, check this:

func toDomainLabels(key string) []*metrics.Label {

// toDomainLabels converts the bucket key to Jaeger metric labels.
func toDomainLabels(key string) []*metrics.Label {
	return []*metrics.Label{
		{
			Name:  "operation",
			Value: key,
		},
	}
}

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
@pipiland2612 pipiland2612 requested a review from yurishkuro July 9, 2025 17:39
@pipiland2612
Copy link
Contributor Author

Hi @yurishkuro, the pull request is ready for your review ! Thank for you support

labelKey := getLabelKey(errorMetric.Labels)
callMetric, exists := callMetricsByLabels[labelKey]
if !exists {
continue // Skip if no matching call metric.
Copy link
Member

Choose a reason for hiding this comment

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

don't you need to generate a NaN data point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that this is very important, that the e2e tests need to verify the labels, without it we may fail the e2e test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @yurishkuro, this is solved at #7303

@yurishkuro yurishkuro added the changelog:exprimental Change to an experimental part of the code label Jul 10, 2025
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

going to merge, but please check the comments

@yurishkuro yurishkuro added this pull request to the merge queue Jul 10, 2025
Merged via the queue into jaegertracing:main with commit 368bff8 Jul 10, 2025
59 of 60 checks passed
@pipiland2612 pipiland2612 deleted the GetErrorRate_Implementation branch July 10, 2025 06:29
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.

2 participants