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

fix(core): always store span_type as str on span #1638

Merged
merged 3 commits into from
Sep 2, 2020

Conversation

Kyle-Verhoog
Copy link
Member

@Kyle-Verhoog Kyle-Verhoog commented Sep 1, 2020

Formerly if the span_type field was assigned to a Span object as a SpanType then it would fail to encode since the encoding does not handle the enum. This patch fixes this by making span_type a property and storing the enum value on the span.

with tracer.trace("op", span_type=SpanTypes.WEB):
    pass

# Works fine because the initializer handles the conversion of enum to str
with tracer.trace("op") as span:
    span.span_type = SpanTypes.WEB

# Fails to encode prior to this fix

thanks to @thehesiod for discovering this one!

@Kyle-Verhoog Kyle-Verhoog requested a review from a team as a code owner September 1, 2020 00:16
Copy link
Contributor

@majorgreys majorgreys left a comment

Choose a reason for hiding this comment

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

Great to see the test added as well!

@Kyle-Verhoog Kyle-Verhoog added this to the 0.42.0 milestone Sep 2, 2020
@Kyle-Verhoog Kyle-Verhoog merged commit 1616ab1 into master Sep 2, 2020
@Kyle-Verhoog Kyle-Verhoog deleted the kyle-verhoog/span_type branch September 2, 2020 19:59
majorgreys pushed a commit that referenced this pull request Sep 10, 2020
Formerly if the span_type field was assigned to a Span object as a SpanType then it would fail to encode since the encoding does not handle the enum. This patch fixes this by making span_type a property and storing the enum value on the span.

* add tests for varying span properties

* add setter for span_type
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