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

Pass startTime & endTime in Trace Get request #6228

Closed
wants to merge 1 commit into from

Conversation

rim99
Copy link
Contributor

@rim99 rim99 commented Nov 20, 2024

Test would fail on proto marshal

Running tool: /usr/bin/go test -timeout 30s -run ^TestGetTraceTraceIDError$ github.com/jaegertracing/jaeger/cmd/query/app/apiv3

--- FAIL: TestGetTraceTraceIDError (0.00s)
    /home/xxx/projects/go/jaeger/cmd/query/app/apiv3/grpc_handler_test.go:132: 
        	Error Trace:	/home/xxx/projects/go/jaeger/cmd/query/app/apiv3/grpc_handler_test.go:132
        	Error:      	Received unexpected error:
        	            	rpc error: code = Internal desc = grpc: error while marshaling: proto: time.Time does not implement Marshal
        	Test:       	TestGetTraceTraceIDError
FAIL
FAIL	github.com/jaegertracing/jaeger/cmd/query/app/apiv3	0.007s
FAIL

@yurishkuro
Copy link
Member

Thanks, I see why this test is failing and know how to fix it. However, it raises an interesting question about which data type we should use for the timestamps in the API. In api_v2 we used google.protobuf.Timestamp, so api_v3 was trying to replicate that. However, in api_v2 the Span object also uses google.protobuf.Timestamp, whereas in v3 we are using OpenTelemetry Span type which represents timestamps as fixed int64

  fixed64 start_time_unix_nano = 7;

So while our api_v2 was consistent between data model and the service interface, api_v3 is not consistent.

@rim99
Copy link
Contributor Author

rim99 commented Nov 20, 2024

I see, but unix nano level of timestamp seems to be too granular for API queries.

Current HTTP API uses micro seconds level of timestamp for "loopback". I think we'd better have a very good reason to break it

@yurishkuro
Copy link
Member

I agree, I don't really want to change api_v3 as it has been declared stable a long time ago. So we will continue using google.protobuf.Timestamp, we just need to fix some annotations in the IDL and make a change in the Go repository. Specifically, the IDL file was missing these annotations:

// Enable gogoprotobuf extensions (https://github.com/gogo/protobuf/blob/master/extensions.md).
// Enable custom Marshal method.
option (gogoproto.marshaler_all) = true;
// Enable custom Unmarshal method.
option (gogoproto.unmarshaler_all) = true;
// Enable custom Size method (Required by Marshal and Unmarshal).
option (gogoproto.sizer_all) = true;

And then in the Go code I had to add a MarshalToSizedBuffer function to the Traces struct.

Do you want to try to make these changes?

@yurishkuro
Copy link
Member

I have a PR #6233

@yurishkuro yurishkuro closed this Nov 21, 2024
yurishkuro added a commit that referenced this pull request Nov 21, 2024
## Which problem is this PR solving?
- Part of #4150

## Description of the changes
- Upgrade to new IDL that removes gogo annotation from
api_v3/query.proto
- Add a pre-processor to inject annotations during build
- Fix tests
- Add start/end time to GetTrace test (which was failing in #6228)

## How was this change tested?
- 

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

---------

Signed-off-by: Yuri Shkuro <[email protected]>
@rim99
Copy link
Contributor Author

rim99 commented Nov 26, 2024

Thanks, I see why this test is failing and know how to fix it. However, it raises an interesting question about which data type we should use for the timestamps in the API. In api_v2 we used google.protobuf.Timestamp, so api_v3 was trying to replicate that. However, in api_v2 the Span object also uses google.protobuf.Timestamp, whereas in v3 we are using OpenTelemetry Span type which represents timestamps as fixed int64

  fixed64 start_time_unix_nano = 7;

So while our api_v2 was consistent between data model and the service interface, api_v3 is not consistent.

Just remembered this discussion, it looks like Jaeger has adopted nano level of timestamp in HTTP requests already. My memory was incorrect before.

Considering to update the time field as type of fixed64 start_time_unix_nano?

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