Skip to content

interval_ms field cannot be read #23358

@rcassetta-figma

Description

@rcassetta-figma

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

I previously filed this issue
#23183

And the resolution came across a couple PRs
#23221
#23217

This does seem to work for allowing the interval_ms field to be written to, but I am unable to read this field or check if it exists (which we need to do in order to know if we should be overwriting it).

Here is a snippet of VRL I have used to test what is happening

      # Coerce rate metrics into a standard window only if they are aggregated
      has_interval = to_string(exists(.interval_ms))
      interval_not_null = to_string(.interval_ms != null)
      has_agged = to_string(.tags.agged == "true")
      metric_name, err = .namespace + "." + .name
      if err != null {
        log(err, level: "error")
      }
      metric_log = "{{ metric_name }}:: has_interval:{{ has_interval }} has_agged:{{ has_agged }} interval_not_null:{{ interval_not_null }}"
      log(metric_log, level: "info", rate_limit_secs: 0)
      if exists(.interval_ms) && .tags.agged == "true" {
        .interval_ms = 30000
        log("Overridding interval1")
      }
      if metric_name == "my.metric.example" {
        .interval_ms = 30000
        log("Overridding interval2")
      }

What is happening is that for the specific my.metric.example metric, it IS overriding the value, but NOT for other rate metrics which have a interval_ms field. I piped the final results to a console sink so I I could verify this. The logs show that both the has_interval and interval_not_null conditions evaluate to false event for metrics which DO have this field and which DO get overwritten by the second attempt.

I dug into the code a bit with a co-worker and while we aren't confident enough in our understanding of the codebase, it seems like this issue might arise from a missing addition to the precompute value function

fn precompute_metric_value(metric: &Metric, info: &ProgramInfo) -> Value {

IIUC this would cause it to just never load a value for this path even when requested.

Configuration


Version

v0.48.0

Debug Output


Example Data

No response

Additional Context

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain: coreAnything related to core crates i.e. vector-core, core-common, etcdomain: vrlAnything related to the Vector Remap Languagetype: bugA code related bug.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions