Skip to content

[mysqld-mixin] How do we use it as a library? #518

Closed
@sdurrheimer

Description

@sdurrheimer

Is there a way to properly use the mysqld-mixin/mixin.libsonnet to import rules and alerts?

For example with prometheus/kube-prometheus, I was trying to do:

local thanosMixin = import 'thanos-mixin/mixin.libsonnet';
local corednsMixin = import 'coredns-mixin/mixin.libsonnet';
local certManagerMixin = import 'cert-manager-mixin/mixin.libsonnet';

// trying to use mysqld-mixin the same way as others
local mysqldMixin = import 'mysqld-mixin/mixin.libsonnet';

local kp =
  (import 'kube-prometheus/kube-prometheus.libsonnet') +
  (import 'thanos-mixin/config.libsonnet') +
  {
    _config+:: {
      namespace: 'monitoring',
    },
    prometheusRules+::
      thanosMixin.prometheusRules +
      certManagerMixin.prometheusRules +
      // trying to use mysqld-mixin the same way as others
      mysqldMixin.prometheusRules +
      {
        // groups+: [],
      },
    prometheusAlerts+:: 
      thanosMixin.prometheusAlerts +
      corednsMixin.prometheusAlerts +
      certManagerMixin.prometheusAlerts +
      // trying to use mysqld-mixin the same way as others
      mysqldMixin.prometheusAlerts +
      {
        // cat existingrule.yaml | gojsontoyaml -yamltojson > existingrule.json
        // groups+: (import 'existingrule.json').groups,
      },
  }

But I end up with the following error:

+ jsonnet -J vendor -m manifests kube-prometheus.jsonnet
+ xargs '-I{}' sh -c 'cat {} | gojsontoyaml > {}.yaml' -- '{}'
RUNTIME ERROR: only functions can be called, got null
	vendor/mysqld-mixin/mixin.libsonnet:9:14-44	object <anonymous>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions