Skip to content

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

Merged
codeboten merged 3 commits intoopen-telemetry:mainfrom
owais:status-code-description
Mar 9, 2021
Merged

Span Status: only set description for ERROR status code.#1673
codeboten merged 3 commits intoopen-telemetry:mainfrom
owais:status-code-description

Conversation

@owais
Copy link
Copy Markdown
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 review from a team, hectorhdzg and lzchen 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

## [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
Copy Markdown
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))

@owais owais force-pushed the status-code-description branch from 85855e3 to bdba710 Compare March 6, 2021 01:27
self._description = description
return

if status_code != StatusCode.ERROR:
Copy link
Copy Markdown
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.
@owais owais force-pushed the status-code-description branch from 276e8b3 to dc32b31 Compare March 8, 2021 19:39
@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.

4 participants