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

Convert date for cloud resource specifications to correct timezone from UTC #1391

Merged

Conversation

eiffel777
Copy link
Contributor

@eiffel777 eiffel777 commented Jul 21, 2020

The specifications for a cloud system are ingested from a json file in a format that includes a timestamp. The format can be seen in etl_schemas.d/cloud/resource_specs.schema.json. The timestamp in these files should be in UTC and when ingested for use with the cloud utilization statistic the timestamp should be changed to the time zone on the server. This is not currently being done. This PR uses a new etl action to create a staging table called staging_resource_specifications that converts the timestamp to the time zone on the server and then uses that table as the source for cloud_resource_specs table.

While fixing the timezone issue I found that the MIN() function was not being used when getting the start time for a unique set of specifications and updated the etl_action_defs.d/cloud_common/resource_specifications.json file to fix this.

In Asana, https://app.asana.com/0/342819846538629/1185459844560305

Tests performed

Tested manually in docker to make sure that time zone was converted correctly and that the resource specification were given the correct start and end times.

Types of changes

  • 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 change)

Checklist:

  • My code follows the code style of this project as found in the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@eiffel777 eiffel777 added bug Bugfixes Category:Cloud Cloud Realm labels Jul 21, 2020
@eiffel777 eiffel777 added this to the 9.0.0 milestone Jul 21, 2020
@eiffel777 eiffel777 self-assigned this Jul 21, 2020
"hostname": "raw.hostname",
"vcpus": "raw.vcpus",
"memory_mb": "raw.memory_mb",
"fact_date": "DATE(CONVERT_TZ(raw.fact_date, '+00:00', @@session.time_zone))"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to use the time zone specified in resources.json? Does this handle resources in a different time zone than the database server?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jtpalmer Anywhere else in the cloud realm where we need to convert timezones it does it this way so I'd like to keep it consistent with that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Update the documentation to note that cloud resources ignore the timezone configuration option (https://github.com/ubccr/xdmod/blame/xdmod9.0/docs/configuration.md#L424).

jtpalmer
jtpalmer previously approved these changes Jul 21, 2020
@eiffel777 eiffel777 merged commit 1428cb3 into ubccr:xdmod9.0 Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugfixes Category:Cloud Cloud Realm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants