メトリクス生成プロセッサー

特定のルールに続いて既存のメトリクスを使用して新しいメトリクスを作成します。

Splunk Distribution of the OpenTelemetry Collectorでは、Metrics Generationプロセッサーを使用して、所定のルールに従って既存のメトリクスを使用して新しいメトリクスを作成します。

このプロセッサーは現在、新しいメトリクスを作成するための以下の2つのルールタイプをサポートしています:

  • calculateします。以下の算術演算のいずれかを適用して、2 つの既存のメトリクスから新しいメトリクスを作成します:addsubtractmultiplydivide、または percent

    • たとえば、これを使用して、pod.memory.utilizationメトリクスを等式pod.memory.utilization = (pod.memory.usage.bytes/ node.memory.limitで計算します。

    • 詳しくは、「calculate ルールの使用」を参照してください。

  • scaleします。既存のメトリクスの値を与えられた定数でスケーリングして新しいメトリクスを作成します。

    • たとえば、pod.memory.usage メトリクス値をメガバイトからバイトに変換するには、既存のメトリクス値に 1,048,576 を乗算します。

はじめに

以下の手順に従って、コンポーネントの設定とアクティベーションを行ってください:

  1. Splunk Distribution of the OpenTelemetry Collector をホストまたはコンテナプラットフォームにデプロイします:

  2. 次のセクションで説明するように、metricsgeneration プロセッサーを設定します。

  3. Collector を再起動します。

サンプル構成

リソースプロセッサーを有効にするには、設定ファイルの metricsgeneration セクションに processors を追加します。生成ルールのリストを使用して設定を指定します。生成ルールは、指定されたメトリクス名に一致するメトリクスを検索し、指定された操作をそれらのメトリクスに適用します。例:

YAML
processors:
  metricsgeneration:
      # specify the metric generation rules
      rules:
            # Name of the new metric. This is a required field.
          - name: <new_metric_name>

            # Unit for the new metric being generated.
            unit: <new_metric_unit>

            # type describes how the new metric will be generated. It can be one of `calculate` or `scale`.  calculate generates a metric applying the given operation on two operand metrics. scale operates only on operand1 metric to generate the new metric.
            type: {calculate, scale}

            # This is a required field. This must be a gauge or sum metric.
            metric1: <first_operand_metric>

            # This field is required only if the type is "calculate". When required, this must be a gauge or sum metric.
            metric2: <second_operand_metric>

            # Operation specifies which arithmetic operation to apply. It must be one of the five supported operations.
            operation: {add, subtract, multiply, divide, percent}

設定を完了するには、構成ファイルの service セクションの metrics パイプラインにプロセッサを含めます。例:

YAML
service:
  pipelines:
    metrics:
      processors: [metricsgeneration]

設定例:既存の2つのメトリクスを使用して新しいメトリクスを作成する

この例では、pod.cpu.usagenode.cpu.limitを分割する新しいメトリクスpod.cpu.utilizedを作成しています。

YAML
rules:
    - name: pod.cpu.utilized
      type: calculate
      metric1: pod.cpu.usage
      metric2: node.cpu.limit
      operation: divide

設定例:既存のメトリクスの値をスケーリングして新しいメトリクスを作成する

この例では、メトリクスpod.memory.usage.megabytesから新しいメトリクスpod.memory.usage.bytesを作成します。

YAML
rules:
    - name: pod.memory.usage.bytes
      unit: Bytes
      type: scale
      metric1: pod.memory.usage.megabytes
      operation: multiply
      scale_by: 1048576

calculate ルールの使用

calculateメトリクス生成ルールの具体的な動作は以下の通りです:

  • 作成されたメトリクスは、最初のメトリクスとして設定されたメトリクスと同じタイプになります。

  • 作成されるメトリクスに有効なデータポイントがない場合は、作成されません。これにより、プロセッサが空の新しいメトリクスを生成しないようにします。

  • 重複する属性が一致するデータポイントでメトリクス計算を実行するには、機能ゲート metricsgeneration.MatchAttributes を有効にします。この機能ゲートはデフォルトでオフになっています。つまり、計算中に 2 番目のメトリクスに使用される値は、単に最初のデータポイントの値です。

    • 機能ゲートの有効化と無効化の方法については、GitHub の「Collector Feature Gates」を参照してください。

設定

次の表は、metricsgeneration プロセッサーの構成オプションを示します:

トラブルシューティング

If you are a Splunk Observability Cloud customer and are not able to see your data in Splunk Observability Cloud, you can get help in the following ways.

Available to Splunk Observability Cloud customers

Available to prospective customers and free trial users

  • Ask a question and get answers through community support at Splunk Answers.

  • Join the Splunk community #observability Slack channel to communicate with customers, partners, and Splunk employees worldwide.