Skip to content

Conversation

LDiazN
Copy link
Contributor

@LDiazN LDiazN commented Oct 1, 2025

Fixes several issues in the oonimeasurents component

Rewrites the /api/v1/measuremen_meta handler to be more similar to the monolith version

Also ports some measurement_meta related tests to the microservice

closes #1011

@LDiazN LDiazN requested a review from hellais October 1, 2025 11:56
@LDiazN LDiazN self-assigned this Oct 1, 2025
@LDiazN LDiazN marked this pull request as draft October 1, 2025 13:05
@LDiazN LDiazN changed the title Refs/heads/fix/measurements timestamp bug Several oonimeasurements fixes Oct 2, 2025
@LDiazN LDiazN marked this pull request as ready for review October 2, 2025 10:40
Copy link
Member

@hellais hellais left a comment

Choose a reason for hiding this comment

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

This is looking good. I left few comments on improvements that are mostly cosmetic and some small bugs to address prior to merge.

After those are addressed this is good to go.

Thanks for putting it together.


@field_serializer("measurement_start_time", "test_start_time")
def format_ts(self, v: datetime) -> str:
return v.strftime("%Y-%m-%dT%H:%M:%SZ")
Copy link
Member

Choose a reason for hiding this comment

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

💯

return int(asn_str.strip("AS"))


def validate_report_id(report_id: str) -> str:
Copy link
Member

Choose a reason for hiding this comment

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

Can we move this validation function closer to where it's being used up on top?

return report_id


def validate(item: str, accepted: str, error_msg: str):
Copy link
Member

Choose a reason for hiding this comment

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

I believe this function does not behave as intended. It's unclear from the docstring what it should do. The typing suggests it's a str, but it's use seems to treat it as a list[str].
I suggest changing either the docstring or the typing or both.

Copy link
Member

Choose a reason for hiding this comment

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

From its usage above (this means the order or the function definitions should be inverted), you are checking to make sure it contains only the characters in the list, so you should probably call this something like:

def is_in_charset(s: str, charset: str, error_msg: str):

elif request.report_id:
log.info(f"get_measurement_meta {request.report_id} {input}")
msmt_meta = _get_measurement_meta_clickhouse(
db, request.report_id, request.input
Copy link
Member

Choose a reason for hiding this comment

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

One of either measurement_uid or report_id should be provided, so you are missing the extra else branch which should lead to 400 status code error.

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.

Several oonimeasurements bugs

2 participants