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 models for sort.go, span.go, spanref.go, time.go, trace.go, model_test.proto #125

Merged
merged 12 commits into from
Jan 22, 2025

Conversation

Nabil-Salah
Copy link
Contributor

@Nabil-Salah Nabil-Salah commented Jan 21, 2025

Which problem is this PR solving?

Description of the changes

  • built on the prev pr #123
  • Copy set of types from original model/ -> sort.go, spanref.go, time.go, trace.go

How was this change tested?

  • go test ./model/v1

Checklist

@yurishkuro yurishkuro changed the title add models for sort.go, span.go, spanref.go, time.go, trace.go Add models for sort.go, span.go, spanref.go, time.go, trace.go Jan 21, 2025
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 74.90909% with 69 lines in your changes missing coverage. Please review.

Project coverage is 8.33%. Comparing base (66db30d) to head (8224687).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
model/v1/prototest/model_test.pb.go 23.33% 67 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #125      +/-   ##
========================================
+ Coverage   3.46%   8.33%   +4.87%     
========================================
  Files         10      16       +6     
  Lines       7555    7830     +275     
========================================
+ Hits         262     653     +391     
+ Misses      7283    7135     -148     
- Partials      10      42      +32     

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

@Nabil-Salah
Copy link
Contributor Author

Nabil-Salah commented Jan 21, 2025

do you need a rebase with the new commit or is that fine?
@yurishkuro

model/v1/ids.go Outdated Show resolved Hide resolved
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.

@Nabil-Salah I removed the following files from the PR because they are not direct copies, and I would like to understand the changes better. In fact, I think we should back-port the first change I made #118 by splitting certain logic into new files such that the same exact structure exists in the main repo - copying should really be no changes to the files. Can you do that?

	deleted:    model/v1/span.go
	deleted:    model/v1/span_pkg_test.go
	deleted:    model/v1/span_test.go

@yurishkuro yurishkuro changed the title Add models for sort.go, span.go, spanref.go, time.go, trace.go Add models for sort.go, spanref.go, time.go, trace.go Jan 21, 2025
@Nabil-Salah
Copy link
Contributor Author

Nabil-Salah commented Jan 21, 2025

yes of course will try to do so

I'll make my changes on this pr

@yurishkuro yurishkuro enabled auto-merge (squash) January 21, 2025 15:13
@yurishkuro
Copy link
Member

I created jaegertracing/jaeger#6581

@yurishkuro
Copy link
Member

@Nabil-Salah if you hit Approve on that PR I can merge it to unblock you. But I think besides that PR there are more changes like that needed, for example

  • SpanID.ToOTELSpanID() (and similar for trace ID) need to be changed to standalone functions without receivers, since they will remain in jaeger while SpanID type will be in jaeger-idl
  • I separated out ids_proto_test.go which relies on a test .proto file that will need to be migrated too

@Nabil-Salah
Copy link
Contributor Author

Nabil-Salah commented Jan 21, 2025

@yurishkuro
okay for now I'll try to copy files from your new merged pr and test it ->

  • the span and ids_proto_test.go files and the depends needed
  • other changes will keep them away like SpanID.ToOTELSpanID() and similar standalone functions

is it okay?

@Nabil-Salah
Copy link
Contributor Author

Nabil-Salah commented Jan 21, 2025

@yurishkuro

for span to be exact copy I need

  • go.uber.org/zap dependency other than that I will remove one function GetSamplerParams
  • go.opentelemetry.io/otel/trace or remove TestIsRPCClientServer test from span_test.go file

the problem is that sort, trace depends on span so nothing further can be copied here

if okay I can make a new pr that contain those

auto-merge was automatically disabled January 21, 2025 17:18

Head branch was pushed to by a user without write access

@Nabil-Salah Nabil-Salah changed the title Add models for sort.go, spanref.go, time.go, trace.go Add models for spanref.go, time.go Jan 21, 2025
@@ -0,0 +1,230 @@
// Copyright (c) 2018 Uber Technologies, Inc.
Copy link
Member

Choose a reason for hiding this comment

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

we cannot just copy generated file, it needs to be regenerated by make proto

@yurishkuro
Copy link
Member

zap is used in GetSamplerParams which is only used in a single place in the code base:

internal/sampling/samplingstrategy/adaptive/aggregator.go
153:	samplerType, samplerParam := span.GetSamplerParams(logger)

Doesn't make sense to keep it in the model, let's move to a private method in the aggregator.


For OTEL dependency in TestIsRPCClientServer, let's just replace it with a plain string, it's fine for the test.

Can you make those changes in jaeger?

Signed-off-by: nabil salah <[email protected]>
@Nabil-Salah Nabil-Salah changed the title Add models for spanref.go, time.go Add models for sort.go, span.go, spanref.go, time.go, trace.go, model_test.proto Jan 21, 2025
.PHONY: proto-model
proto-model:
$(call proto_compile, model/v1, proto/api_v2/model.proto)
$(PROTOC) -Imodel/proto --go_out=$(PWD)/model/v1/ model/v1/proto/model_test.proto
Copy link
Member

Choose a reason for hiding this comment

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

cannot use call proto_compile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it run and works but give error here

image


package prototest;

option go_package = "./prototest";
Copy link
Member

Choose a reason for hiding this comment

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

let's not store it here. Since we have prototest directory anyway, we can store the .proto file there as well.

@Nabil-Salah
Copy link
Contributor Author

Nabil-Salah commented Jan 21, 2025

@yurishkuro
for the makefile i didn't get it is that what you need?

@yurishkuro
Copy link
Member

there were changes to makefiles in #120

Signed-off-by: nabil salah <[email protected]>
@Nabil-Salah
Copy link
Contributor Author

Nabil-Salah commented Jan 21, 2025

@yurishkuro
how to generate from model_test.proto or should i add this make?
make proto doesn't generate model/v1/prototest/model_test.pb.go file

Makefile Outdated
@@ -179,6 +179,11 @@ proto-prepare-all:
proto-prepare:
mkdir -p ${PROTO_GEN_GO_DIR}

.PHONY: proto-model
proto-model:
$(call proto_compile, model/v1, proto/api_v2/model.proto)
Copy link
Member

Choose a reason for hiding this comment

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

this is already done in proto-api-v2

Makefile Outdated
@@ -179,6 +179,11 @@ proto-prepare-all:
proto-prepare:
mkdir -p ${PROTO_GEN_GO_DIR}

.PHONY: proto-model
proto-model:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
proto-model:
proto-prototest:

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.

Thanks!

@yurishkuro yurishkuro merged commit 73f885e into jaegertracing:main Jan 22, 2025
6 checks passed
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.

2 participants