Skip to content

Resolve datetime deprecation warnings #3433

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

Merged
merged 3 commits into from
Apr 30, 2025
Merged

Conversation

emmanuel-ferdman
Copy link
Contributor

Description

This small PR resolves the deprecation warnings on datetime in Python3.12+. You can find them in the CI logs:

  /home/runner/work/opentelemetry-python-contrib/opentelemetry-python-contrib/exporter/opentelemetry-exporter-richconsole/src/opentelemetry/exporter/richconsole/__init__.py:71: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
    ts = datetime.datetime.utcfromtimestamp(nanoseconds / 1e9)

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?

run tests

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

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

@emmanuel-ferdman emmanuel-ferdman requested a review from a team as a code owner April 18, 2025 15:59
@xrmx
Copy link
Contributor

xrmx commented Apr 28, 2025

@emmanuel-ferdman Please setup ruff locally and fix formatting :)

@xrmx xrmx added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Apr 30, 2025
@xrmx xrmx enabled auto-merge (squash) April 30, 2025 13:59
@xrmx xrmx merged commit dec311f into open-telemetry:main Apr 30, 2025
720 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants