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

failure to parse quantities that are in nano units (e.g. nanocpus) #18

Closed
philgebhardt opened this issue Jul 29, 2024 · 0 comments · Fixed by #19
Closed

failure to parse quantities that are in nano units (e.g. nanocpus) #18

philgebhardt opened this issue Jul 29, 2024 · 0 comments · Fixed by #19

Comments

@philgebhardt
Copy link
Contributor

Hello there. First of all, I must say thank you for creating this crate! This project provides useful operations around Kubernetes quantities and your work here is very-much appreciated.

I've found an issue in using it to parse quantities returned from metrics-server, which is reporting quantities in nanocpus. The error manifests as the following when I try to produce a ParsedQuantity from a Quantity.

ParsingFailed(Error(Error { input: "n", code: Tag }))

An example of what is produced by the metrics API:

PodMetrics {
    metadata: ObjectMeta {
        annotations: None,
        creation_timestamp: Some(
            Time(
                2024-07-29T21:58:30Z,
            ),
        ),
        deletion_grace_period_seconds: None,
        deletion_timestamp: None,
        finalizers: None,
        generate_name: None,
        generation: None,
        labels: Some(
            {
                "app": "test",
            },
        ),
        managed_fields: None,
        name: Some(
            "test",
        ),
        namespace: Some(
            "default",
        ),
        owner_references: None,
        resource_version: None,
        self_link: None,
        uid: None,
    },
    timestamp: "2024-07-29T21:58:22Z",
    window: "12.450808s",
    containers: [
        PodMetricsContainer {
            name: "test",
            usage: PodMetricsContainerUsage {
                cpu: Quantity(
                    "1836507n",
                ),
                memory: Quantity(
                    "8480Ki",
                ),
            },
        },
    ],
}
ThomasK33 added a commit that referenced this issue Aug 27, 2024
add support for nanocpus (fixes issue #18)
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 a pull request may close this issue.

1 participant