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

Span Status: only set description for ERROR status code. #1673

Merged
merged 3 commits into from Mar 9, 2021

Conversation

owais
Copy link
Contributor

@owais owais commented Mar 5, 2021

Description

According to the spec:

Description MUST only be used with the Error StatusCode value.
An empty Description is equivalent with a not present one.

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status

This commit updates the Status implementation to comply with the spec.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Add new tests

Does This PR Require a Contrib Repo Change?

  • The OTel specification has changed which prompted this PR to update the method interfaces of opentelemetry-api/ or opentelemetry-sdk/

Yes, https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@owais owais requested a review from a team as a code owner March 5, 2021 23:58
@owais owais requested review from lzchen and hectorhdzg and removed request for a team March 5, 2021 23:58
@owais owais force-pushed the status-code-description branch 2 times, most recently from 9c03467 to d418c60 Compare March 5, 2021 23:59
@owais owais force-pushed the status-code-description branch 6 times, most recently from 8819f18 to 85855e3 Compare March 6, 2021 01:05
CHANGELOG.md Outdated
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v0.18b0...HEAD)
- Status now only sets `description` when `status_code` is set to `StatusCode.ERROR`
([#1673])(https://github.com/open-telemetry/opentelemetry-python/pull/1673)
Copy link
Member

Choose a reason for hiding this comment

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

You may want to move this to ##Changed section.

Suggested change
([#1673])(https://github.com/open-telemetry/opentelemetry-python/pull/1673)
([#1673](https://github.com/open-telemetry/opentelemetry-python/pull/1673))

self._description = description
return

if status_code != StatusCode.ERROR:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use is not for enums?

According to the spec:

> Description MUST only be used with the Error StatusCode value.
> An empty Description is equivalent with a not present one.

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status

This commit updates the `Status` implementation to comply with the spec.
@codeboten codeboten closed this Mar 9, 2021
@codeboten codeboten reopened this Mar 9, 2021
@codeboten codeboten merged commit fb1ae06 into open-telemetry:main Mar 9, 2021
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.

None yet

4 participants