Conversation
f89d7e2 to
8f70419
Compare
Fix data generation script to send required fields nit remove non graphite changes nit Add datagen changes Fails still but can deploy local code Set defaults for all variables and manually specify pub_time Add table on supported metadata field nit Only confirm pub_time is set properly
ec4a46e to
adc9f02
Compare
|
@Gerrrr Can you take a look here |
Gerrrr
left a comment
There was a problem hiding this comment.
Thanks for opening this PR, @sarthaksin1857 ! I found a few things we need to fix before it is ready to merge. Also, given the wealth of subtle issues, this class may deserve a few unit tests.
| filter data by commit or version using `--since-commit` or `--since-version` selectors. | ||
|
|
||
| #### Supported Metadata Schema | ||
| The following keys are supported within the `data` dictionary: |
There was a problem hiding this comment.
It may not be clear what is the data dictionary in this case. In the paragraph above, we talk about tags, so I suggest replacing this statement with The following tags are supported:
| branch: Optional[str] | ||
| commit: Optional[str] | ||
|
|
||
| def __init__( |
There was a problem hiding this comment.
Think I fixed it, how does it look now?
| if isinstance(self.pub_time, str): | ||
| self.pub_time = parse_datetime(self.pub_time) | ||
| elif isinstance(self.pub_time, (int, float)): | ||
| self.pub_time = datetime.fromtimestamp(self.pub_time) |
There was a problem hiding this comment.
This change uses a different parsing logic than parse_datetime. The latter does dateparser.parse(date, settings={"RETURN_AS_TIMEZONE_AWARE": True}).
Why do need these extra manipulations with pub_time? I don't follow how making fields optional required it.
There was a problem hiding this comment.
This was more just me looking at this code an how to future proof it.
The function says that pub_time is already a date time and if its already a datetime, why try to parse it again?
Similarly if someone passes in a unix int like 1776522767 the string function wont work either
So before we passed in an integer string as "datetime" and then parsed it back into a string, and then into the proper object.
I will just move the logic into parse_datetime and make this code cleaner
| self.version = None | ||
| else: | ||
| self.version = version | ||
| if len(branch) == 0 or branch == "null": |
There was a problem hiding this comment.
This logic was lost in this PR. If a string text is empty or equal to "null", we still want to treat it as empty, unless there is a reason not to.
There was a problem hiding this comment.
Since I switched all actual "optional" fields to be optional, I will clean all of them (except pub_time)
| end_time: int, | ||
| version: Optional[str], | ||
| branch: Optional[str], | ||
| commit: Optional[str], |
There was a problem hiding this comment.
idea (maybe outside of scope of this PR): today, if we have other event tags like "environment": "prod", we'll crash with unexpected keyword argument. Maybe we can change this class such that it'd work arbitrary tags.
There was a problem hiding this comment.
Yea I wonder if we should even define fields here as "supported tags" and rather just store them in a map and print them all at the end as columns
a76be64 to
2b019bf
Compare
documentation fixup Address comments Add coverage for parsing Clean all string Indentation nit formatter Auto formatter
c0ea484 to
19e758c
Compare
|
@Gerrrr sorry for the wait this is ready for another pass. I made it so
I tried to extend the integration tests but it didn't seem to play well with tags. Whenever I tried sending an event, it would time out (I can file an issue for adding integration coverage and tackle that next?) |


#24
What
Proof it works
With the graphite example in the repo, we now see
Which makes sense as we do not set
runbut we do set everything else