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

Low-resolution timers on Windows #3776

Open
tsandall opened this issue Sep 3, 2021 · 3 comments
Open

Low-resolution timers on Windows #3776

tsandall opened this issue Sep 3, 2021 · 3 comments
Labels
inactive monitoring Issues related to decision log and status plugins

Comments

@tsandall
Copy link
Member

tsandall commented Sep 3, 2021

It seems the timers we're using through the Go standard library are not high enough resolution for some the operations that we keep track of. This results in metrics being returned from OPA or emitted in the decision logs that are set to zero. Perhaps there's an alternative timer API we should be calling for Windows systems.

Example from iterating over 10, 100, 1000 element array:

PS C:\Users\torin> .\Downloads\opa_windows_amd64.exe eval '{1|numbers.range(1,10)[_]}' --metrics
{
  "result": [
    {
      "expressions": [
        {
          "value": [
            1
          ],
          "text": "{1|numbers.range(1,10)[_]}",
          "location": {
            "row": 1,
            "col": 1
          }
        }
      ]
    }
  ],
  "metrics": {
    "timer_rego_query_compile_ns": 10200,
    "timer_rego_query_eval_ns": 0,
    "timer_rego_query_parse_ns": 502300
  }
}
PS C:\Users\torin> .\Downloads\opa_windows_amd64.exe eval '{1|numbers.range(1,100)[_]}' --metrics
{
  "result": [
    {
        }
      ]
    }
  ],
  "metrics": {
    "timer_rego_query_compile_ns": 0,
    "timer_rego_query_eval_ns": 18000,
    "timer_rego_query_parse_ns": 0
  }
}
PS C:\Users\torin> .\Downloads\opa_windows_amd64.exe eval '{1|numbers.range(1,1000)[_]}' --metrics
{
  "result": [
    {
      "expressions": [
        {
          "value": [
            1
          ],
          "text": "{1|numbers.range(1,1000)[_]}",
          "location": {
            "row": 1,
            "col": 1
          }
        }
      ]
    }
  ],
  "metrics": {
    "timer_rego_query_compile_ns": 0,
    "timer_rego_query_eval_ns": 1016000,
    "timer_rego_query_parse_ns": 508700
  }
}
@tsandall tsandall added monitoring Issues related to decision log and status plugins and removed enhancement labels Dec 3, 2021
@stale
Copy link

stale bot commented Jan 2, 2022

This issue has been automatically marked as inactive because it has not had any activity in the last 30 days.

@stale stale bot added the inactive label Jan 2, 2022
@philipaconrad
Copy link
Contributor

philipaconrad commented Oct 18, 2022

MacOS and Windows seem to have situations where the timer resolution can be coarser or finer than anticipated, especially when power management is involved.

Additional Context:

@stale stale bot removed the inactive label Oct 18, 2022
@stale
Copy link

stale bot commented Nov 17, 2022

This issue has been automatically marked as inactive because it has not had any activity in the last 30 days.

@stale stale bot added the inactive label Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive monitoring Issues related to decision log and status plugins
Projects
None yet
Development

No branches or pull requests

2 participants