googleinterns / cloud-operations-api-mock

Apache License 2.0
5 stars 2 forks source link

Add RPC for retrieving the span stored at a specific index #32

Closed the-ericwang35 closed 4 years ago

the-ericwang35 commented 4 years ago

One feature that the Go exporter team asked for is to be able to retrieve a certain span that has been uploaded to the server (by index). This functionality is not part of the Cloud Trace service, so we'll have to create our own endpoint to support this.

This PR adds a new endpoint, GetSpan, that takes in an index and returns the span at the given index. To do this, we'll have to maintain both a slice of spans (to retrieve the span at a given index in O(1) time), and a map[string]struct{} keyed by span names (to check for duplicate names in O(1) time).

Note that the lint errors are all from before and not introduced by this PR, and are all being fixed in this PR, so it's left alone in this PR to avoid conflicts.

the-ericwang35 commented 4 years ago

The lint errors are all from before and not introduced by this PR, and are all fixed in https://github.com/googleinterns/cloud-operations-api-mock/pull/35, so they're left alone in this PR to avoid any conflicts.