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

feat(core): Return array or string from getTraceMetaTags() #13293

Closed
wants to merge 1 commit into from

Conversation

s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Aug 9, 2024

Changing the function signature for the convenience of returning a string or an array of strings.

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Let's maybe wait a bit with this PR as #13281 makes some changes to the API

Generally I'm not sure if we should move forward with this change for now for the reasons outlined in the PR description of #13201

scope,
client,
asArray,
}: { span?: Span; scope?: Scope; client?: Client; asArray?: boolean } = {}): string | string[] {
Copy link
Member

Choose a reason for hiding this comment

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

if we move forward with this, we can adjust the types so that TS knows that if asArray is true, it returns an array and otherwise a string

Copy link
Member Author

Choose a reason for hiding this comment

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

The type checking should already check this as I created two function overloads above. But I am open for another approach (in the case this gets merged) :D

Copy link
Member

Choose a reason for hiding this comment

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

sorry, I missed this. This is what I had in mind :)

@s1gr1d
Copy link
Member Author

s1gr1d commented Aug 12, 2024

I'll close this for now as this is a legit reason not to return an array:

I don't want to hand them an API that suggest they could pick one. Also, returning the API would make the API a tad less convenient to use and there's precedence for the simple string approach.
-- from #13201

@s1gr1d s1gr1d closed this Aug 12, 2024
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