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

Extended search based operator metrics #1972

Open
alstanchev opened this issue Jun 24, 2024 · 0 comments · May be fixed by #1973
Open

Extended search based operator metrics #1972

alstanchev opened this issue Jun 24, 2024 · 0 comments · May be fixed by #1973
Assignees
Milestone

Comments

@alstanchev
Copy link
Contributor

It would be nice to be able to define search metrics based on the search API.

It should be possible to tag devices with predefined values in the config as well as with resolved such from the things themselves.
All devices that match a filter and have the same tags should be aggregated under one metric instrument.
A cleanup functionality may be needed as there might be left out instruments for things that are deleted.
The configuration would as an extension to the already existing operator-metrics functionality.

operator-metrics {
      enabled = true
      scrape-interval = 30m
      custom-metrics {
        ...
      }
      custom-search-metrics {
        online_status {
          enabled = true
          scrape-interval = 20m # override scrape interval, run every 20 minute
          namespaces = [
            "org.eclipse.ditto"
          ]
          tags: {
            "online" = "{{online_placeholder}}"
            "location" = "{{attributes/Info/location}}"
          }
          filters = {
            online-filter = {
              filter = "gt(features/ConnectionStatus/properties/status/readyUntil/,time:now)"
              inline-placeholder-values = {
                // inline-placeholder-values are used to define hardcoded values to be used in the tags values if the placeholders are not json paths to an actual field in the thing
                // this is used to define different tags values based on the filter that matched the thing
                "online_placeholder" = true
              }
              // in order to do placeholder resolving from thing fields, the fields should be defined in the fields array
              // by default only the thingId is available for placeholder resolving
              fields = ["attributes/Info/location"]
              // The metric-value is used to define the value of the metric for the thing that matched the filter.
              // It does not support placeholders and should be a numeric value
            }
            offline-filter = {
              filter = "lt(features/ConnectionStatus/properties/status/readyUntil/,time:now)"
              inline-placeholder-values = {
                "online_placeholder" = false
              }
              fields = ["attributes/Info/location"]
            }
          }
        }
      }
    }
@alstanchev alstanchev self-assigned this Jun 24, 2024
@alstanchev alstanchev linked a pull request Jun 24, 2024 that will close this issue
@thjaeckle thjaeckle added this to the 3.6.0 milestone Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Waiting for Approval
Development

Successfully merging a pull request may close this issue.

2 participants