diff --git a/content/ja/other/_index.md b/content/ja/other/_index.md index f9da4bf9a6..5eaeef6108 100644 --- a/content/ja/other/_index.md +++ b/content/ja/other/_index.md @@ -1,7 +1,9 @@ --- archetype: "home" -title: さらなるワークショップ +title: Ninja Workshops +menuPost: " " weight: 19 --- -{{%children containerstyle="div" style="h3" description="true" %}} +{{%children containerstyle="div" style="h5" description="true" %}} + diff --git a/content/ja/other/opentelemetry-collector/1-installation/1-confirmation.md b/content/ja/other/opentelemetry-collector/1-installation/1-confirmation.md new file mode 100644 index 0000000000..ae9d98e3b9 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/1-installation/1-confirmation.md @@ -0,0 +1,308 @@ +--- +title: OpenTelemetry Collector Contribをインストールする +linkTitle: 1.1 インストールを確認する +weight: 1 +--- + +## Collector が動作していることを確認する + +これで、Collector が動いているはずです。root権限で `systemctl` コマンドを使って、それを確かめてみましょう。ステータス表示を中止するには `q` を押してください。 + +{{< tabs >}} +{{% tab title="Command" %}} + +``` bash +sudo systemctl status otelcol-contrib +``` + +{{% /tab %}} +{{% tab title="Status Output" %}} + +``` text +● otelcol-contrib.service - OpenTelemetry Collector Contrib + Loaded: loaded (/lib/systemd/system/otelcol-contrib.service; enabled; vendor preset: enabled) + Active: active (running) since Tue 2023-05-16 08:23:23 UTC; 25s ago + Main PID: 1415 (otelcol-contrib) + Tasks: 5 (limit: 1141) + Memory: 22.2M + CPU: 125ms + CGroup: /system.slice/otelcol-contrib.service + └─1415 /usr/bin/otelcol-contrib --config=/etc/otelcol-contrib/config.yaml + +May 16 08:23:39 ip-10-0-9-125 otelcol-contrib[1415]: NumberDataPoints #0 +May 16 08:23:39 ip-10-0-9-125 otelcol-contrib[1415]: Data point attributes: +May 16 08:23:39 ip-10-0-9-125 otelcol-contrib[1415]: -> exporter: Str(logging) +May 16 08:23:39 ip-10-0-9-125 otelcol-contrib[1415]: -> service_instance_id: Str(df8a57f4-abdc-46b9-a847-acd62db1001f) +May 16 08:23:39 ip-10-0-9-125 otelcol-contrib[1415]: -> service_name: Str(otelcol-contrib) +May 16 08:23:39 ip-10-0-9-125 otelcol-contrib[1415]: -> service_version: Str(0.75.0) +May 16 08:23:39 ip-10-0-9-125 otelcol-contrib[1415]: StartTimestamp: 2023-05-16 08:23:39.006 +0000 UTC +May 16 08:23:39 ip-10-0-9-125 otelcol-contrib[1415]: Timestamp: 2023-05-16 08:23:39.006 +0000 UTC +May 16 08:23:39 ip-10-0-9-125 otelcol-contrib[1415]: Value: 0.000000 +May 16 08:23:39 ip-10-0-9-125 otelcol-contrib[1415]: {"kind": "exporter", "data_type": "metrics", "name": "logging"} +``` + +{{% /tab %}} +{{< /tabs >}} + +このワークショップでは、ここで設定した `otelcol-contrib` のスタンドアローンで動作するバイナリーを使っていきます。サービスを停止して、自動起動を無効化するために、次のコマンドを使ってください: + +{{< tabs >}} +{{% tab title="Command" %}} + +``` bash +sudo systemctl stop otelcol-contrib +``` + +{{% /tab %}} +{{< /tabs >}} + +{{< tabs >}} +{{% tab title="Command" %}} + +``` bash +sudo systemctl disable otelcol-contrib +``` + +{{% /tab %}} +{{< /tabs >}} + +--- + +{{% expand title="{{% badge style=primary icon=user-ninja %}}**Ninja:** Open Telemetry Collector Builder (ocb) を使って、独自のコレクターを作る {{% /badge %}}" %}} + +このパートでは、お使いのシステムに以下のものがインストールされている必要があります: + +- Go (latest version) + + ``` bash + cd /tmp + wget https://golang.org/dl/go1.20.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz + ``` + + `.profile` を編集して、次の環境変数をセットします: + + ``` bash + export GOROOT=/usr/local/go + export GOPATH=$HOME/go + export PATH=$GOPATH/bin:$GOROOT/bin:$PATH + ``` + + そして、シェルのセッションを更新します: + + ``` bash + source ~/.profile + ``` + + Go のバージョンを確認します: + + ``` bash + go version + ``` + +- ocb のインストール + - ocb バイナリーを [project releases](https://github.com/open-telemetry/opentelemetry-collector/releases/tag/cmd%2Fbuilder%2Fv0.80.0) + からダウンロードして、次のコマンドを実行します: + + ```bash + mv ocb_0.80.0_darwin_arm64 /usr/bin/ocb + chmod 755 /usr/bin/ocb + ``` + + 別のアプローチとして、Go のツールチェーンを使ってバイナリをローカルにビルドする方法もあります: + + ```bash + go install go.opentelemetry.io/collector/cmd/builder@v0.80.0 + mv $(go env GOPATH)/bin/builder /usr/bin/ocb + ``` + +- (Optional) Docker + +## なぜ独自のコレクターをビルドするの? + +コレクターのデフォルトのディストリビューション(core および contrib)は、含まれれるコンポーネントが少なすぎたり、もしくは多すぎたりします。 + +本番環境で contrib コレクターを実行することはできますが、インストールされているコンポーネントの量が多く、デプロイに必要ではないものも含まれるため、一般的には推奨されません。 + +## 独自のコレクターをビルドする利点は? + +独自のコレクターバイナリー(通常は「ディストリビューション」と呼ばれる)を作成することで、必要なものだけをビルドすることができます。 + +メリットは次のとおりです: + +1. バイナリーのサイズが小さい +2. 一般的な Go の脆弱性スキャナーを利用できる +3. 組織独自のコンポーネントを組み込むことができる + +## カスタムコレクターをビルドするときの注意事項は? + +さて、これは Ninja ゾーンの人たちにあえて言うことではないかもしれませんが: + +1. Go の開発経験を、必須ではないが、推奨される +1. Splunk の **サポートがない** +1. ディストリビューションのライフサイクルを管理しなければならない + +プロジェクトは安定性に向けて進んでいますが、行われた変更がワークフローを壊す可能性があることに注意してください。Splunk チームは、より高い安定性とサポートを提供し、デプロイメントニーズに対応するためのキュレーションされた経験を提供しています。 + +## Ninja ゾーン + +必要なツールをすべてインストールしたら、以下のディレクトリ構造に従い、 `otelcol-builder.yaml` という新しいファイルを作成します: + + +``` bash +. +└── otelcol-builder.yaml +``` + +ファイルを作成したら、インストールするコンポーネントのリストと追加のメタデータを追加する必要があります。 + +この例では、導入設定に必要なコンポーネントのみをインストールするためのビルダーマニフェストを作成します: + +```yaml +dist: + name: otelcol-ninja + description: A custom build of the Open Telemetry Collector + output_path: ./dist + +extensions: +- gomod: go.opentelemetry.io/collector/extension/ballastextension v0.80.0 +- gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.80.0 +- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/httpforwarder v0.80.0 +- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.80.0 + +exporters: +- gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.80.0 +- gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.80.0 +- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/splunkhecexporter v0.80.0 +- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter v0.80.0 +- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sapmexporter v0.80.0 + +processors: +- gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.80.0 +- gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.80.0 + +receivers: +- gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.80.0 +- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.80.0 +- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.80.0 +- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.80.0 +- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.80.0 +``` + +_ocb_ のためのyamlファイルを作成して更新したら、 次のコマンドを実行します: + +```shell +ocb --config=otelcol-builder.yaml +``` + +すると、次のようなディレクトリ構造が作成されます: + +``` text +├── dist +│   ├── components.go +│   ├── components_test.go +│   ├── go.mod +│   ├── go.sum +│   ├── main.go +│   ├── main_others.go +│   ├── main_windows.go +│   └── otelcol-ninja +└── otelcol-builder.yaml +``` + +### リファレンス + +1. [https://opentelemetry.io/docs/collector/custom-collector/](https://opentelemetry.io/docs/collector/custom-collector/) + +{{% /expand %}} + +--- + +## デフォルト設定 + +OpenTelemetry Collector は YAML ファイルを使って設定をしていきます。これらのファイルには、必要に応じて変更できるデフォルト設定が含まれています。提供されているデフォルト設定を見てみましょう: + +{{< tabs >}} +{{% tab title="Command" %}} + +```bash +cat /etc/otelcol-contrib/config.yaml +``` + +{{% /tab %}} +{{% tab title="config.yaml" %}} + +```yaml { lineNos="table" wrap="true"} +extensions: + health_check: + pprof: + endpoint: 0.0.0.0:1777 + zpages: + endpoint: 0.0.0.0:55679 + +receivers: + otlp: + protocols: + grpc: + http: + + opencensus: + + # Collect own metrics + prometheus: + config: + scrape_configs: + - job_name: 'otel-collector' + scrape_interval: 10s + static_configs: + - targets: ['0.0.0.0:8888'] + + jaeger: + protocols: + grpc: + thrift_binary: + thrift_compact: + thrift_http: + + zipkin: + +processors: + batch: + +exporters: + logging: + verbosity: detailed + +service: + + pipelines: + + traces: + receivers: [otlp, opencensus, jaeger, zipkin] + processors: [batch] + exporters: [logging] + + metrics: + receivers: [otlp, opencensus, prometheus] + processors: [batch] + exporters: [logging] + + extensions: [health_check, pprof, zpages] +``` + +{{% /tab %}} +{{< /tabs >}} + +おめでとうございます!OpenTelemetry Collector のダウンロードとインストールに成功しました。あなたは OTel Ninja になる準備ができました。しかしまずは、設定ファイルと OpenTelemetry Collector の異なるディストリビューションについて見ていきましょう。 + +{{% notice style="note" %}} + +Splunk は、自社で完全にサポートされた OpenTelemetry Collector のディストリビューションを提供しています。このディストリビューションは、[Splunk GitHub Repository](https://github.com/signalfx/splunk-otel-collector) からインストールするか、Splunk Observability Cloud のウィザードを使用して、簡単なインストールスクリプトを作成し、コピー&ペーストすることで利用できます。このディストリビューションには、OpenTelemetry Collector Contrib ディストリビューションにはない追加機能や強化が含まれています。 + +- Splunk の OpenTelemetry Collector ディストリビューションは本番環境でテスト済みであり、多くの顧客が本番環境で使用しています。 +- このディストリビューションを使用する顧客は、公式の Splunk サポートから、SLA の範囲内で直接支援を受けることができます。 +- メトリクスとトレース収集のコア構成体験に将来的な破壊的変更がないことを心配せずに、Splunk の OpenTelemetry Collector ディストリビューションを使用または移行することができます(OpenTelemetry ログ収集の設定はベータ版です)。Collector 自身のメトリクスに破壊的変更がある可能性はあります。 + +{{% /notice %}} + +このセクションでは、ホストメトリクスを Splunk Observability Cloud に送信するために、設定ファイルの各セクションを詳しく見ていき、変更する方法について説明します。 diff --git a/content/ja/other/opentelemetry-collector/1-installation/_index.md b/content/ja/other/opentelemetry-collector/1-installation/_index.md new file mode 100644 index 0000000000..59b2615de2 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/1-installation/_index.md @@ -0,0 +1,42 @@ +--- +title: OpenTelemetry Collector Contrib をインストールする +linkTitle: 1. インストール +weight: 1 +--- + +## OpenTelemetry Collector の Contrib ディストリビューションをダウンロードする + +OpenTelemetry Collector のインストールのために、まずはダウンロードするのが最初のステップです。このラボでは、 `wget` コマンドを使って OpenTelemetry の GitHub リポジトリから `.deb` パッケージをダウンロードしていきます。 + +[OpenTelemetry Collector Contrib releases page](https://github.com/open-telemetry/opentelemetry-collector-releases/releases) +から、ご利用のプラットフォーム用の `.deb` パッケージを入手してください。 + +``` bash +wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.80.0/otelcol-contrib_0.80.0_linux_amd64.deb +``` + +## OpenTelemetry Collector の Contrib ディストリビューションをインストールする + +`dpkg` を使って、 `.deb` パッケージをインストールします。下記の **dpkg Output** のようになれば、インストールは成功です! + +{{< tabs >}} +{{% tab title="Install" %}} + +``` bash +sudo dpkg -i otelcol-contrib_0.80.0_linux_amd64.deb +``` + +{{% /tab %}} +{{% tab title="dpkg Output" %}} + +``` text +Selecting previously unselected package otelcol-contrib. +(Reading database ... 64218 files and directories currently installed.) +Preparing to unpack otelcol-contrib_0.75.0_linux_amd64.deb ... +Unpacking otelcol-contrib (0.75.0) ... +Setting up otelcol-contrib (0.75.0) ... +Created symlink /etc/systemd/system/multi-user.target.wants/otelcol-contrib.service → /lib/systemd/system/otelcol-contrib.service. +``` + +{{% /tab %}} +{{< /tabs >}} diff --git a/content/ja/other/opentelemetry-collector/2-extensions/1-health.md b/content/ja/other/opentelemetry-collector/2-extensions/1-health.md new file mode 100644 index 0000000000..208276c683 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/2-extensions/1-health.md @@ -0,0 +1,58 @@ +--- +title: OpenTelemetry Collector エクステンション +linkTitle: 2.1 Health Check +weight: 1 +--- + +## Health Check エクステンション + +他のコンポーネントと同様に、エクステンションは `config.yaml` ファイルで設定できます。ここでは実際に `config.yaml` ファイルを編集して、エクステンションを設定していきましょう。デフォルトの `config.yaml` では、すでに **pprof** エクステンションと **zpages** エクステンションが設定されていることを確認してみてください。このワークショップでは、設定ファイルをアップデートして **health_check** エクステンションを追加し、ポートを解放し、外部ネットワークからコレクターのヘルスチェックにアクセスできるようにしていきます。 + +{{% tab title="Command" %}} + +``` bash +sudo vi /etc/otelcol-contrib/config.yaml +``` + +{{% /tab %}} + +{{% tab title="Extensions Configuration" %}} + +```yaml {hl_lines="3"} +extensions: + health_check: + endpoint: 0.0.0.0:13133 +``` + +{{% /tab %}} + +コレクターを起動します: + +{{% tab title="Command" %}} + +``` bash +otelcol-contrib --config=file:/etc/otelcol-contrib/config.yaml +``` + +{{% /tab %}} + +このエクステンションはHTTPのURLを公開し、OpenTelemetory Collectorの稼働状況をチェックするプローブを提供します。このエクステンションはKubernetes環境でのLiveness/Readinessプローブとしても使われています。 `curl` コマンドの使い方は、[curl man page](https://curl.se/docs/manpage.html) を参照してください。 + +ターミナルを開いて、対象インスタンスにSSH接続し、次のコマンドを実行します: + +{{< tabs >}} +{{% tab title="curl Command" %}} + +```bash +curl http://localhost:13133 +``` + +{{% /tab %}} +{{% tab title="curl Output" %}} + +``` text +{"status":"Server available","upSince":"2023-04-27T10:11:22.153295874+01:00","uptime":"16m24.684476004s"} +``` + +{{% /tab %}} +{{< /tabs >}} diff --git a/content/ja/other/opentelemetry-collector/2-extensions/2-performance.md b/content/ja/other/opentelemetry-collector/2-extensions/2-performance.md new file mode 100644 index 0000000000..0024c1504e --- /dev/null +++ b/content/ja/other/opentelemetry-collector/2-extensions/2-performance.md @@ -0,0 +1,9 @@ +--- +title: OpenTelemetry Collector エクステンション +linkTitle: 2.2 Performance Profiler +weight: 2 +--- + +## Performance Profiler エクステンション + +[**Performance Profiler**](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/extension/pprofextension/README.md) エクステンションは、Go の net/http/pprof エンドポイントを有効化します。これは通常、開発者がパフォーマンスプロファイルを収集し、サービスの問題を調査するために使用します。**このワークショップでは詳しく紹介はしません**。 diff --git a/content/ja/other/opentelemetry-collector/2-extensions/3-zpages.md b/content/ja/other/opentelemetry-collector/2-extensions/3-zpages.md new file mode 100644 index 0000000000..37a801d134 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/2-extensions/3-zpages.md @@ -0,0 +1,356 @@ +--- +title: OpenTelemetry Collector エクステンション +linkTitle: 2.3 zPages +weight: 3 +--- + +## zPages エクステンション + +[**zPages**](https://github.com/open-telemetry/opentelemetry-collector/blob/main/extension/zpagesextension/README.md) は、外部エクスポータに代わるプロセス内部の機能です。有効化すると、バックグラウンドでトレースとメトリクス情報を収集し、集計し、どのようなデータを扱ったかの Web ページを公開します。zpages は、コレクターが期待どおりに動作していることを確認するための非常に便利な診断機能です。 + +{{< tabs >}} +{{% tab title="ServiceZ" %}} + +**ServiceZ** は、コレクターサービスの概要と、pipelinez、extensionz、featurez zPages へのクイックアクセスを提供します。このページでは、ビルドとランタイムの情報も提供します。 + +URL: [http://localhost:55679/debug/servicez](http://localhost:55679/debug/servicez) (`localhost` は、適切なホスト名に切り替えてください) + +![ServiceZ](../../images/servicez.png) + +{{% /tab %}} +{{% tab title="PipelineZ" %}} + +**PipelineZ** は、コレクターで実行中のパイプラインに関する情報を提供します。タイプ、データが変更されているか、各パイプラインで使用されているレシーバー、プロセッサー、エクスポーターの情報を見ることができます。 + +URL: [http://localhost:55679/debug/pipelinez](http://localhost:55679/debug/pipelinez) (`localhost` は、適切なホスト名に切り替えてください) + +![PipelineZ](../../images/pipelinez.png) + +{{% /tab %}} +{{% tab title="ExtensionZ" %}} + +**ExtensionZ** は、コレクターで有効化されたエクステンションを確認できます。 + +Example URL: [http://localhost:55679/debug/extensionz](http://localhost:55679/debug/extensionz) (`localhost` は、適切なホスト名に切り替えてください) + +![ExtensionZ](../../images/extensionz.png) + +{{% /tab %}} +{{% /tabs %}} + +{{% notice style="info" %}} +ついていけない場合は、ブラウザーでzPagesの情報を発信しているテスト環境にアクセスしてください: + +- **ServiceZ:** [http://63.33.64.193:55679/debug/servicez](http://63.33.64.193:55679/debug/servicez) +- **PipelineZ:** [http://63.33.64.193:55679/debug/pipelinez](http://63.33.64.193:55679/debug/pipelinez) +- **ExtensionZ:** [http://63.33.64.193:55679/debug/extensionz](http://63.33.64.193:55679/debug/extensionz) +{{% /notice %}} + +--- + +{{% expand title="{{% badge style=primary icon=user-ninja %}}**Ninja:** storage エクステンションでデータの耐久性を向上させる{{% /badge %}}" %}} + +これをこなうには、ディストリビューションに `file_storage` エクステンションモジュールがインストールされていることを確認する必要があります。確認するには、`otelcol-contrib components` コマンドを実行します: + +{{< tabs >}} +{{% tab title="Truncated Output" %}} + +```yaml +# ... truncated for clarity +extensions: + - file_storage +``` + +{{% /tab %}} +{{% tab title="Full Output" %}} + +```yaml +buildinfo: + command: otelcol-contrib + description: OpenTelemetry Collector Contrib + version: 0.80.0 +receivers: + - prometheus_simple + - apache + - influxdb + - purefa + - purefb + - receiver_creator + - mongodbatlas + - vcenter + - snmp + - expvar + - jmx + - kafka + - skywalking + - udplog + - carbon + - kafkametrics + - memcached + - prometheus + - windowseventlog + - zookeeper + - otlp + - awsecscontainermetrics + - iis + - mysql + - nsxt + - aerospike + - elasticsearch + - httpcheck + - k8sobjects + - mongodb + - hostmetrics + - signalfx + - statsd + - awsxray + - cloudfoundry + - collectd + - couchdb + - kubeletstats + - jaeger + - journald + - riak + - splunk_hec + - active_directory_ds + - awscloudwatch + - sqlquery + - windowsperfcounters + - flinkmetrics + - googlecloudpubsub + - podman_stats + - wavefront + - k8s_events + - postgresql + - rabbitmq + - sapm + - sqlserver + - redis + - solace + - tcplog + - awscontainerinsightreceiver + - awsfirehose + - bigip + - filelog + - googlecloudspanner + - cloudflare + - docker_stats + - k8s_cluster + - pulsar + - zipkin + - nginx + - opencensus + - azureeventhub + - datadog + - fluentforward + - otlpjsonfile + - syslog +processors: + - resource + - batch + - cumulativetodelta + - groupbyattrs + - groupbytrace + - k8sattributes + - experimental_metricsgeneration + - metricstransform + - routing + - attributes + - datadog + - deltatorate + - spanmetrics + - span + - memory_limiter + - redaction + - resourcedetection + - servicegraph + - transform + - filter + - probabilistic_sampler + - tail_sampling +exporters: + - otlp + - carbon + - datadog + - f5cloud + - kafka + - mezmo + - skywalking + - awsxray + - dynatrace + - loki + - prometheus + - logging + - azuredataexplorer + - azuremonitor + - instana + - jaeger + - loadbalancing + - sentry + - splunk_hec + - tanzuobservability + - zipkin + - alibabacloud_logservice + - clickhouse + - file + - googlecloud + - prometheusremotewrite + - awscloudwatchlogs + - googlecloudpubsub + - jaeger_thrift + - logzio + - sapm + - sumologic + - otlphttp + - googlemanagedprometheus + - opencensus + - awskinesis + - coralogix + - influxdb + - logicmonitor + - signalfx + - tencentcloud_logservice + - awsemf + - elasticsearch + - pulsar +extensions: + - zpages + - bearertokenauth + - oidc + - host_observer + - sigv4auth + - file_storage + - memory_ballast + - health_check + - oauth2client + - awsproxy + - http_forwarder + - jaegerremotesampling + - k8s_observer + - pprof + - asapclient + - basicauth + - headers_setter +``` + +{{% /tab %}} +{{< /tabs >}} + +このエクステンションは、エクスポーターが設定されたエンドポイントにデータを送信できない事象が発生したときに、データをディスクにキューイングする機能をエクスポーターに提供します。 + +このエクステンションを設定するには、以下の情報を含むように設定を更新する必要があります。まず、 /tmp/otel-data ディレクトリを作成し、読み取り/書き込み権限を与えてください: + +```yaml +extensions: +... + file_storage: + directory: /tmp/otel-data + timeout: 10s + compaction: + directory: /tmp/otel-data + on_start: true + on_rebound: true + rebound_needed_threshold_mib: 5 + rebound_trigger_threshold_mib: 3 + +# ... truncated for clarity + +service: + extensions: [health_check, pprof, zpages, file_storage] +``` + +## なぜキューデータをディスクに書くの? + +コレクターはネットワークの不調(および、コレクターの再起動)を乗り切って、アップストリームプロバイダーに確実にデータを送信できるようになります。 + +## キューデータをディスクに書く時の注意事項は? + +ディスクの性能により、データスループットの性能に影響を与える可能性があります + +### 参照 + +1. [https://community.splunk.com/t5/Community-Blog/Data-Persistence-in-the-OpenTelemetry-Collector/ba-p/624583](https://community.splunk.com/t5/Community-Blog/Data-Persistence-in-the-OpenTelemetry-Collector/ba-p/624583) +2. [https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/storage/filestorage](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/storage/filestorage) + +{{% /expand %}} + +--- + +## 設定を確認しましょう + +さて、エクステンションについて説明したので、設定の変更箇所を確認していきましょう。 + +--- + +{{% expand title="{{% badge icon=check color=green title=**Check-in** %}}設定ファイルを確認してください{{% /badge %}}" %}} +{{< tabs >}} +{{% tab title="config.yaml" %}} + +```yaml { lineNos="table" wrap="true" hl_lines="3" } +extensions: + health_check: + endpoint: 0.0.0.0:13133 + pprof: + endpoint: 0.0.0.0:1777 + zpages: + endpoint: 0.0.0.0:55679 + +receivers: + otlp: + protocols: + grpc: + http: + + opencensus: + + # Collect own metrics + prometheus: + config: + scrape_configs: + - job_name: 'otel-collector' + scrape_interval: 10s + static_configs: + - targets: ['0.0.0.0:8888'] + + jaeger: + protocols: + grpc: + thrift_binary: + thrift_compact: + thrift_http: + + zipkin: + +processors: + batch: + +exporters: + logging: + verbosity: detailed + +service: + + pipelines: + + traces: + receivers: [otlp, opencensus, jaeger, zipkin] + processors: [batch] + exporters: [logging] + + metrics: + receivers: [otlp, opencensus, prometheus] + processors: [batch] + exporters: [logging] + + extensions: [health_check, pprof, zpages] +``` + +{{% /tab %}} +{{< /tabs >}} +{{% /expand %}} + +--- + +さて、エクステンションについて復習したところで、ワークショップのデータパイプラインの部分に飛び込んでみましょう。パイプラインとは、コレクター内でデータがたどる経路を定義するもので、レシーバーから始まり、追加の処理や変更をし、最終的にエクスポーターを経由してコレクターを出ます。 + +OpenTelemetry Collector のデータパイプラインは、レシーバー、プロセッサー、エクスポーターで構成されています。まずは、レシーバーから見ていきましょう。 diff --git a/content/ja/other/opentelemetry-collector/2-extensions/_index.md b/content/ja/other/opentelemetry-collector/2-extensions/_index.md new file mode 100644 index 0000000000..f240384dc2 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/2-extensions/_index.md @@ -0,0 +1,37 @@ +--- +title: OpenTelemetry Collector エクステンション +linkTitle: 2. エクステンション +weight: 2 +--- + +さて、OpenTelemetry Collector はインストールできました。次は OpenTelemetry Collector のエクステンション(拡張機能)を見てみましょう。エクステンションはオプションで、主にテレメトリーデータの処理を伴わないタスクで使用できます。例としては、ヘルスモニタリング、サービスディスカバリ、データ転送などがあります。 + +{{< mermaid >}} +%%{ + init:{ + "theme": "base", + "themeVariables": { + "primaryColor": "#ffffff", + "clusterBkg": "#eff2fb", + "defaultLinkColor": "#333333" + } + } +}%% + +flowchart LR; + style E fill:#e20082,stroke:#333,stroke-width:4px,color:#fff + subgraph Collector + A[OTLP] --> M(Receivers) + B[JAEGER] --> M(Receivers) + C[Prometheus] --> M(Receivers) + end + subgraph Processors + M(Receivers) --> H(Filters, Attributes, etc) + E(Extensions) + end + subgraph Exporters + H(Filters, Attributes, etc) --> S(OTLP) + H(Filters, Attributes, etc) --> T(JAEGER) + H(Filters, Attributes, etc) --> U(Prometheus) + end +{{< /mermaid >}} diff --git a/content/ja/other/opentelemetry-collector/3-receivers/1-hostmetrics.md b/content/ja/other/opentelemetry-collector/3-receivers/1-hostmetrics.md new file mode 100644 index 0000000000..b76de000ee --- /dev/null +++ b/content/ja/other/opentelemetry-collector/3-receivers/1-hostmetrics.md @@ -0,0 +1,44 @@ +--- +title: OpenTelemetry Collector レシーバー +linkTitle: 1. Host Metrics +weight: 1 +--- + +## Host Metrics レシーバー + +[**Host Metrics レシーバー**](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/README.md) は、さまざまなソースからスクレイピングされたホストシステムに関するメトリクスを生成します。これは、コレクターがエージェントとしてデプロイされるときに使用さます。 + +`etc/otel-contrib/config.yaml` ファイルを更新して、**hostmetrics** レシーバーを設定してみましょう。以下の YAML を **receivers** セクションの下に挿入します。 + +``` bash +sudo vi /etc/otelcol-contrib/config.yaml +``` + +{{% tab title="Host Metrics Receiver Configuration" %}} + +```yaml {hl_lines="2-22"} +receivers: + hostmetrics: + collection_interval: 10s + scrapers: + # CPU utilization metrics + cpu: + # Disk I/O metrics + disk: + # File System utilization metrics + filesystem: + # Memory utilization metrics + memory: + # Network interface I/O metrics & TCP connection metrics + network: + # CPU load metrics + load: + # Paging/Swap space utilization and I/O metrics + paging: + # Process count metrics + processes: + # Per process CPU, Memory and Disk I/O metrics. Disabled by default. + # process: +``` + +{{% /tab %}} diff --git a/content/ja/other/opentelemetry-collector/3-receivers/2-prometheus.md b/content/ja/other/opentelemetry-collector/3-receivers/2-prometheus.md new file mode 100644 index 0000000000..a9587ff23c --- /dev/null +++ b/content/ja/other/opentelemetry-collector/3-receivers/2-prometheus.md @@ -0,0 +1,38 @@ +--- +title: OpenTelemetry Collector レシーバー +linkTitle: 2. Prometheus +weight: 2 +--- + +## Prometheus レシーバー + +**Prometheus** のレシーバーも、もちろんあります。[Prometheus](https://prometheus.io/docs/introduction/overview/) は OpenTelemetry Collector で使われているオープンソースのツールキットです。このレシーバーは、OpenTelemetry Collector 自身からメトリクスをスクレイピングするためにも使われます。これらのメトリクスは、コレクタの健全性をモニタリングするために使用できる。 + +ここでは、**prometheus** レシーバーを変更して、コレクター自身からメトリクスを収集できるようにしてみます。レシーバーの名前を **prometheus** から **prometheus/internal** に変更して、レシーバーが何をしているのかをより明確しましょう。設定ファイルを以下のように更新します: + +{{% tab title="Prometheus Receiver Configuration" %}} + +```yaml {hl_lines="1"} +prometheus/internal: + config: + scrape_configs: + - job_name: 'otel-collector' + scrape_interval: 10s + static_configs: + - targets: ['0.0.0.0:8888'] +``` + +{{% /tab %}} + +## ダッシュボード例 - Prometheus メトリクス + + + +このスクリーンショットは、 `prometheus/internal` レシーバーが OpenTelemetry Collector から収集したメトリクスの、spmeのダッシュボードの例です。ここではスパン・メトリクス・ログの、それぞれの受信および送信の様子を見ることができます。 + +{{% notice style="note" %}} +このダッシュボードはSplunk Observability Cloud にある組み込みダッシュボードで、Splunk OpenTelemetry Collector のインストールの状況を簡単にモニタリングできます。 +{{% /notice %}} + + +![otel-charts](../../images/otel-charts.png) diff --git a/content/ja/other/opentelemetry-collector/3-receivers/3-other-receivers.md b/content/ja/other/opentelemetry-collector/3-receivers/3-other-receivers.md new file mode 100644 index 0000000000..dba4a00fe7 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/3-receivers/3-other-receivers.md @@ -0,0 +1,154 @@ +--- +title: OpenTelemetry Collector レシーバー +linkTitle: 3. その他のレシーバー +weight: 3 +--- + +## その他のレシーバー + +デフォルトの設定には、他のレシーバーがあることに気づくはずです。 **otlp**、**opencensus**、**jaeger**、**zipkin** が定義されています。これらは他のソースからテレメトリーデータを受信するために使われます。このワークショップでは、これらのレシーバーについては取り上げませんので、そのままにしておきましょう。 + +--- + +{{% expand title="{{% badge style=primary icon=user-ninja %}}**Ninja:** レシーバーを動的に生成する{{% /badge %}}" %}} + +dockerコンテナ、kubernetesポッド、sshセッションのような短時間のタスクを観測するために、[receiver creator](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/receivercreator) レシーバーと [observer](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/observer) エクステンションを使って、対象のサービスが起動するタイミングで新しいレシーバーを作成することができます。 + +## 何が必要なの? + +receiver creator とそれに関連する observer エクステンションの使用を開始するには、collector build manifest に追加する必要があります。 + +詳細は [installation](../1-installation/) を参照してください。 + +## 注意事項はある? + +短命なタスクの中には、_username_ や _password_ のような追加設定を必要とするものがあります。それらの値は[環境変数](https://opentelemetry.io/docs/collector/configuration/#configuration-environment-variables) を参照したり、 `${file:./path/to/database/password}` のようなスキーム展開構文を使うこともできます。 + +組織における機密情報の取り扱い規定に従って、どのような方法を取るかを検討してください。 + +## Ninja ゾーン + +この Ninja ゾーンに必要なものは2つだけです: + +1. builder manifestに、 receiver creator レシーバーと observer エクステンションを追加する +2. 検出されたエンドポイントを検出するように、設定を作成する + +次のようにすると、設定をテンプレート化できます: + +```yaml +receiver_creator: + watch_observers: [host_observer] + receivers: + redis: + rule: type == "port" && port == 6379 + config: + password: ${env:HOST_REDIS_PASSWORD} +``` + +他の例は [receiver creator's examples](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/receivercreator#examples) にあります。 + +{{% /expand %}} + +--- + +## 設定を確認しましょう + +これで、レシーバーをカバーできました。ここで、設定のの変更内容をチェックしてみましょう。 + +--- + +{{% expand title="{{% badge icon=check color=green title=**Check-in** %}}設定をレビューしてください{{% /badge %}}" %}} +{{< tabs >}} +{{% tab title="config.yaml" %}} + +```yaml {lineNos="table" wrap="true" hl_lines="10-30 39"} +extensions: + health_check: + endpoint: 0.0.0.0:13133 + pprof: + endpoint: 0.0.0.0:1777 + zpages: + endpoint: 0.0.0.0:55679 + +receivers: + hostmetrics: + collection_interval: 10s + scrapers: + # CPU utilization metrics + cpu: + # Disk I/O metrics + disk: + # File System utilization metrics + filesystem: + # Memory utilization metrics + memory: + # Network interface I/O metrics & TCP connection metrics + network: + # CPU load metrics + load: + # Paging/Swap space utilization and I/O metrics + paging: + # Process count metrics + processes: + # Per process CPU, Memory and Disk I/O metrics. Disabled by default. + # process: + otlp: + protocols: + grpc: + http: + + opencensus: + + # Collect own metrics + prometheus/internal: + config: + scrape_configs: + - job_name: 'otel-collector' + scrape_interval: 10s + static_configs: + - targets: ['0.0.0.0:8888'] + + jaeger: + protocols: + grpc: + thrift_binary: + thrift_compact: + thrift_http: + + zipkin: + +processors: + batch: + +exporters: + logging: + verbosity: detailed + +service: + + pipelines: + + traces: + receivers: [otlp, opencensus, jaeger, zipkin] + processors: [batch] + exporters: [logging] + + metrics: + receivers: [otlp, opencensus, prometheus/internal] + processors: [batch] + exporters: [logging] + + extensions: [health_check, pprof, zpages] +``` + +{{% /tab %}} +{{< /tabs >}} +{{% /expand %}} + +--- + +これで、レシーバーを通して OpenTelemetry Collector にデータがどのように取り込まれるかを確認しました。次に、コレクターが受信したデータをどのように処理するかを見てみましょう。 + +{{% notice style="warning" %}} +**ここではコレクターを再起動しないでください**! `/etc/otelcol-contrib/config.yaml` の変更はまだ完了していません。 +{{% /notice %}} diff --git a/content/ja/other/opentelemetry-collector/3-receivers/_index.md b/content/ja/other/opentelemetry-collector/3-receivers/_index.md new file mode 100644 index 0000000000..cb72ee073f --- /dev/null +++ b/content/ja/other/opentelemetry-collector/3-receivers/_index.md @@ -0,0 +1,41 @@ +--- +title: OpenTelemetry Collector レシーバー +linkTitle: 3. レシーバー +weight: 3 +--- + +レシーバーワークショップへようこそ!OpenTelemetry Collectorのデータパイプラインのスタート地点です。さあ、始めましょう。 + +レシーバーはデータをCollectorに取り込む方法で、プッシュベースとプルベースのものがあります。レシーバーは1つ以上のデータソースをサポートします。一般的に、レシーバーは指定されたフォーマットでデータを受け入れ、内部フォーマットに変換し、該当するパイプラインで定義されたプロセッサやエクスポータにデータを渡します。 + +プッシュまたはプルベースのレシーバは、データをCollectorに取り込む方法です。レシーバは 1 つまたは複数のデータソースをサポートします。通常、レシーバは指定されたフォーマットでデータを受け入れ、内部フォーマットに変換し、該当するパイプラインで定義されたプロセッサーや エクスポーターにデータを渡します。 + +{{< mermaid >}} +%%{ + init:{ + "theme":"base", + "themeVariables": { + "primaryColor": "#ffffff", + "clusterBkg": "#eff2fb", + "defaultLinkColor": "#333333" + } + } +}%% + +flowchart LR; + style M fill:#e20082,stroke:#333,stroke-width:4px,color:#fff + subgraph Collector + A[OTLP] --> M(Receivers) + B[JAEGER] --> M(Receivers) + C[Prometheus] --> M(Receivers) + end + subgraph Processors + M(Receivers) --> H(Filters, Attributes, etc) + E(Extensions) + end + subgraph Exporters + H(Filters, Attributes, etc) --> S(OTLP) + H(Filters, Attributes, etc) --> T(JAEGER) + H(Filters, Attributes, etc) --> U(Prometheus) + end +{{< /mermaid >}} diff --git a/content/ja/other/opentelemetry-collector/4-processors/1-batch-processor.md b/content/ja/other/opentelemetry-collector/4-processors/1-batch-processor.md new file mode 100644 index 0000000000..e97f2d4cbf --- /dev/null +++ b/content/ja/other/opentelemetry-collector/4-processors/1-batch-processor.md @@ -0,0 +1,13 @@ +--- +title: OpenTelemetry Collector プロセッサー +linkTitle: 4.1 Batch +weight: 1 +--- + +## Batch プロセッサー + +デフォルトでは、**batch** プロセッサーだけが有効になっています。このプロセッサーは、データをエクスポートする前にバッチ処理して、エクスポーターへのネットワーク・コールの回数を減らすために使われます。このワークショップではデフォルトの設定を使用します: + +- `send_batch_size` (デフォルト = 8192): タイムアウトに関係なく、バッチを送信するスパン、メトリクスデータポイント、またはログレコードの数。パイプラインの次のコンポーネントに送信されるバッチサイズを制限する場合には、 `send_batch_max_size` を使います。 +- `timeout` (デフォルト = 200ms): サイズに関係なく、バッチが送信されるまでの時間。ゼロに設定すると、`send_batch_size` の設定を無視して `send_batch_max_size` だけが適用され、データは直ちに送信されます。 +- `send_batch_max_size` (デフォルト = 0): バッチサイズの上限。`0` を設定すると、バッチサイズの上限がないことして扱われます。この設定は、大きなバッチが小さなユニットに分割されることを保証します。`send_batch_size` 以上でなければななりません。 diff --git a/content/ja/other/opentelemetry-collector/4-processors/2-resource-detection.md b/content/ja/other/opentelemetry-collector/4-processors/2-resource-detection.md new file mode 100644 index 0000000000..957c3c469f --- /dev/null +++ b/content/ja/other/opentelemetry-collector/4-processors/2-resource-detection.md @@ -0,0 +1,54 @@ +--- +title: OpenTelemetry Collector プロセッサー +linkTitle: 4.2 Resource Detection +weight: 2 +--- + +## Resource Detection プロセッサー + +**resourcedetection** プロセッサーは、ホストからリソース情報を検出して、テレメトリーデータ内のリソース値をこの情報で追加または上書きすることができます。 + +デフォルトでは、可能であればホスト名を FQDN に設定し、そうでなければ OS が提供するホスト名になります。このロジックは `hostname_sources` オプションを使って変更できます。FQDN を取得せず、OSが提供するホスト名を使用するには、`hostname_sources`を`os`に設定します。 + +{{% tab title="System Resource Detection Processor Configuration" %}} + +``` yaml {hl_lines="3-7"} +processors: + batch: + resourcedetection/system: + detectors: [system] + system: + hostname_sources: [os] +``` + +{{% /tab %}} + +If the workshop instance is running on an AWS/EC2 instance we can gather the following tags from the EC2 metadata API (this is not available on other platforms). +ワークショップのインスタンスが AWS/EC2 インスタンスで実行されている場合、EC2 のメタデータ API から以下のタグを収集します(これは他のプラットフォームでは利用できないものもあります)。 + +- `cloud.provider ("aws")` +- `cloud.platform ("aws_ec2")` +- `cloud.account.id` +- `cloud.region` +- `cloud.availability_zone` +- `host.id` +- `host.image.id` +- `host.name` +- `host.type` + +これらのタグをメトリクスに追加するために、別のプロセッサーとして定義してみましょう。 + +{{% tab title="EC2 Resource Detection Processor Configuration" %}} + +``` yaml {hl_lines="7-8"} +processors: + batch: + resourcedetection/system: + detectors: [system] + system: + hostname_sources: [os] + resourcedetection/ec2: + detectors: [ec2] +``` + +{{% /tab %}} diff --git a/content/ja/other/opentelemetry-collector/4-processors/3-attributes.md b/content/ja/other/opentelemetry-collector/4-processors/3-attributes.md new file mode 100644 index 0000000000..69621aefd2 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/4-processors/3-attributes.md @@ -0,0 +1,184 @@ +--- +title: OpenTelemetry Collector プロセッサー +linkTitle: 4.3 Attributes +weight: 3 +--- + +## Attributes プロセッサー + +attribute プロセッサーを使うと、スパン、ログ、またはメトリクスの属性を変更できます。また、このプロセッサーは、入力データをフィルタリングし、マッチさせ、指定されたアクションに含めるべきか、除外すべきかを決定する機能もサポートしています。 + +アクションを設定するには、指定された順序で実行されるアクションのリストを記述します。サポートされるアクションは以下の通りです: + +- `insert`: その属性がない場合に、新しい属性値を挿入します。 +- `update`: その属性がある場合に、その属性値を更新します。 +- `upsert`: insert または update を実行します。属性がない場合には新しい属性値を挿入し、属性がある場合にはその値を更新します。 +- `delete`: 入力データから属性値を削除します。 +- `hash`: 属性値をハッシュ化 (SHA1) します。 +- `extract`: 入力キーの値を正規表現ルールを使って抽出し、対象キーの値を更新します。対象キーがすでに存在する場合は、その値は上書きされます。 + +次の例のように、attribute プロセッサーを使って、キーは `participant.name`、あたいはあなたの名前(例: `marge_simpson`)という新しい属性を追加してみましょう。 + +{{% notice style="warning" %}} + +`INSERT_YOUR_NAME_HERE` の箇所は、自分の名前に置き換えてください。また、自分の名前に **スペースを使わない** ようにしてください。 + +{{% /notice %}} + +このワークショップの後半では、この属性を使用して Splunk Observability Cloud でメトリクスをフィルタリングします。 + +{{% tab title="Attributes Processor Configuration" %}} + +``` yaml {hl_lines="9-13"} +processors: + batch: + resourcedetection/system: + detectors: [system] + system: + hostname_sources: [os] + resourcedetection/ec2: + detectors: [ec2] + attributes/conf: + actions: + - key: participant.name + action: insert + value: "INSERT_YOUR_NAME_HERE" +``` + +{{%/ tab %}} + +--- + +{{% expand title="{{% badge style=primary icon=user-ninja %}}**Ninja:** コネクターを使って内部への洞察を加速する{{% /badge %}}" %}} + +最近追加されたものの一つとして、[connector](https://opentelemetry.io/docs/collector/configuration/#connectors) というコンセプトがあります。これを使うと、あるパイプラインの出力を別のパイプラインの入力に結合できるようになります。 + +利用シーンとして、送信するデータポイントの量、エラーステータスを含むログの数をメトリクスをとして出力するサービスがあります。他には、あるデプロイ環境から送信されるデータ量のメトリクスを生成するサービスがあります。このような場合に、count コネクターですぐに対応できます。 + +## プロセッサーではなくコネクターなのはなぜ? + +プロセッサーは、処理したデータを次に渡すものであり、追加の情報を出力することはできません。コネクターはレシーバーで受け取ったデータを出力せずに、私たちが求める洞察を作り出す機会を提供します。 + +たとえば、count コネクターを使うと、環境変数 `deployment` を持たないログ、メトリクス、トレースの数をカウントすることができます。 + +また、非常にシンプルな例として、`deployment` 別にデータ使用量を分解して出力することもできます。 + +## コネクターの注意事項 + +コネクターは、あるパイプラインからエクスポートされ、別のパイプラインでレシーバーで定義されたデータのみを受け入れます。コレクターをどう構築してどう利用するか、設定を検討する必要があります。 + +## 参照 + +1. [https://opentelemetry.io/docs/collector/configuration/#connectors](https://opentelemetry.io/docs/collector/configuration/#connectors) +2. [https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/connector/countconnector](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/connector/countconnector) + +{{% /expand %}} + +--- + +## 設定を確認しましょう + +これで、プロセッサーがカバーできました。ここで、設定のの変更内容をチェックしてみましょう。 + +--- + +{{% expand title="{{% badge icon=check color=green title=**Check-in** %}}設定をレビューしてください{{% /badge %}}" %}} +{{< tabs >}} +{{% tab title="config.yaml" %}} + +```yaml {lineNos="table" wrap="true" hl_lines="58-68"} +extensions: + health_check: + endpoint: 0.0.0.0:13133 + pprof: + endpoint: 0.0.0.0:1777 + zpages: + endpoint: 0.0.0.0:55679 + +receivers: + hostmetrics: + collection_interval: 10s + scrapers: + # CPU utilization metrics + cpu: + # Disk I/O metrics + disk: + # File System utilization metrics + filesystem: + # Memory utilization metrics + memory: + # Network interface I/O metrics & TCP connection metrics + network: + # CPU load metrics + load: + # Paging/Swap space utilization and I/O metrics + paging: + # Process count metrics + processes: + # Per process CPU, Memory and Disk I/O metrics. Disabled by default. + # process: + otlp: + protocols: + grpc: + http: + + opencensus: + + # Collect own metrics + prometheus/internal: + config: + scrape_configs: + - job_name: 'otel-collector' + scrape_interval: 10s + static_configs: + - targets: ['0.0.0.0:8888'] + + jaeger: + protocols: + grpc: + thrift_binary: + thrift_compact: + thrift_http: + + zipkin: + +processors: + batch: + resourcedetection/system: + detectors: [system] + system: + hostname_sources: [os] + resourcedetection/ec2: + detectors: [ec2] + attributes/conf: + actions: + - key: participant.name + action: insert + value: "INSERT_YOUR_NAME_HERE" + +exporters: + logging: + verbosity: detailed + +service: + + pipelines: + + traces: + receivers: [otlp, opencensus, jaeger, zipkin] + processors: [batch] + exporters: [logging] + + metrics: + receivers: [otlp, opencensus, prometheus] + processors: [batch] + exporters: [logging] + + extensions: [health_check, pprof, zpages] +``` + +{{% /tab %}} +{{< /tabs >}} +{{% /expand %}} + +--- diff --git a/content/ja/other/opentelemetry-collector/4-processors/_index.md b/content/ja/other/opentelemetry-collector/4-processors/_index.md new file mode 100644 index 0000000000..7181caeca0 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/4-processors/_index.md @@ -0,0 +1,38 @@ +--- +title: OpenTelemetry Collector プロセッサー +linkTitle: 4. プロセッサー +weight: 4 +--- + + +[**プロセッサー**](https://github.com/open-telemetry/opentelemetry-collector/blob/main/processor/README.md)は、レシーバーとエクスポーターとの間で、データに対して実行される処理です。プロセッサーはオプションですが、いくつかは推奨されています。OpenTelemetry Collector Contrib には[多数のプロセッサー](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor)が含まれています。 + +{{< mermaid >}} +%%{ + init:{ + "theme":"base", + "themeVariables": { + "primaryColor": "#ffffff", + "clusterBkg": "#eff2fb", + "defaultLinkColor": "#333333" + } + } +}%% + +flowchart LR; + style Processors fill:#e20082,stroke:#333,stroke-width:4px,color:#fff + subgraph Collector + A[OTLP] --> M(Receivers) + B[JAEGER] --> M(Receivers) + C[Prometheus] --> M(Receivers) + end + subgraph Processors + M(Receivers) --> H(Filters, Attributes, etc) + E(Extensions) + end + subgraph Exporters + H(Filters, Attributes, etc) --> S(OTLP) + H(Filters, Attributes, etc) --> T(JAEGER) + H(Filters, Attributes, etc) --> U(Prometheus) + end +{{< /mermaid >}} diff --git a/content/ja/other/opentelemetry-collector/5-exporters/_index.md b/content/ja/other/opentelemetry-collector/5-exporters/_index.md new file mode 100644 index 0000000000..c3a3bfd5e6 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/5-exporters/_index.md @@ -0,0 +1,40 @@ +--- +title: OpenTelemetry Collector エクスポーター +linkTitle: 5. エクスポーター +weight: 5 +--- + +エクスポーターは、プッシュまたはプルベースであり、一つ以上のバックエンド/デスティネーションにデータを送信する方法です。エクスポーターは、一つまたは複数のデータソースをサポートすることがあります。 + +このワークショップでは、[**otlphttp**](https://opentelemetry.io/docs/specs/otel/protocol/exporter/) エクスポーターを使用します。OpenTelemetry Protocol (OTLP) は、テレメトリーデータを伝送するためのベンダーニュートラルで標準化されたプロトコルです。OTLP エクスポーターは、OTLP プロトコルを実装するサーバーにデータを送信します。OTLP エクスポーターは、[**gRPC**](https://grpc.io/) および [**HTTP**](https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview)/[**JSON**](https://www.json.org/json-en.html) プロトコルの両方をサポートします。 + + +{{< mermaid >}} +%%{ + init:{ + "theme":"base", + "themeVariables": { + "primaryColor": "#ffffff", + "clusterBkg": "#eff2fb", + "defaultLinkColor": "#333333" + } + } +}%% + +flowchart LR; + style Exporters fill:#e20082,stroke:#333,stroke-width:4px,color:#fff + subgraph Collector + A[OTLP] --> M(Receivers) + B[JAEGER] --> M(Receivers) + C[Prometheus] --> M(Receivers) + end + subgraph Processors + M(Receivers) --> H(Filters, Attributes, etc) + E(Extensions) + end + subgraph Exporters + H(Filters, Attributes, etc) --> S(OTLP) + H(Filters, Attributes, etc) --> T(JAEGER) + H(Filters, Attributes, etc) --> U(Prometheus) + end +{{< /mermaid >}} diff --git a/content/ja/other/opentelemetry-collector/5-exporters/otlphttp.md b/content/ja/other/opentelemetry-collector/5-exporters/otlphttp.md new file mode 100644 index 0000000000..ad503c015d --- /dev/null +++ b/content/ja/other/opentelemetry-collector/5-exporters/otlphttp.md @@ -0,0 +1,184 @@ +--- +title: OpenTelemetry Collector エクスポーター +linkTitle: 5.1 OTLP HTTP +weight: 1 +--- + +## OTLP HTTP エクスポーター + +Splunk Observability Cloud へ HTTP 経由でメトリックスを送信するためには、**otlphttp** エクスポーターを設定する必要があります。 + +`/etc/otelcol-contrib/config.yaml` ファイルを編集し、**otlphttp** エクスポーターを設定しましょう。以下の YAML を **exporters** セクションの下に挿入し、例えば2スペースでインデントしてください。 + +また、ディスクの容量不足を防ぐために、ロギングエクスポーターの詳細度を変更します。デフォルトの `detailed` は非常に詳細です。 + +```yaml {hl_lines="3-4"} +exporters: + logging: + verbosity: normal + otlphttp/splunk: +``` + +次に、`metrics_endpoint` を定義して、ターゲットURLを設定していきます。 + +{{% notice style="note" %}} +Splunk 主催のワークショップの参加者である場合、使用しているインスタンスにはすでに Realm 環境変数が設定されています。その環境変数を設定ファイルで参照します。それ以外の場合は、新しい環境変数を作成して Realm を設定する必要があります。例えば: + +``` bash +export REALM="us1" +``` + +{{% /notice %}} + +使用するURLは `https://ingest.${env:REALM}.signalfx.com/v2/datapoint/otlp` です。(Splunkは、データの居住地に応じて世界中の主要地域に Realm を持っています)。 + +**otlphttp** エクスポーターは、`traces_endpoint` と `logs_endpoint` それぞれのターゲットURLを定義することにより、トレースとログを送信するようにも設定できますが、そのような設定はこのワークショップの範囲外とします。 + +```yaml {hl_lines="5"} +exporters: + logging: + verbosity: normal + otlphttp/splunk: + metrics_endpoint: https://ingest.${env:REALM}.signalfx.com/v2/datapoint/otlp +``` + +デフォルトでは、すべてのエンドポイントで `gzip` 圧縮が有効になっています。エクスポーターの設定で `compression: none` を設定することにより、圧縮を無効にすることができます。このワークショップでは圧縮を有効にしたままにし、データを送信する最も効率的な方法としてデフォルト設定を使っていきます。 + +Splunk Observability Cloud にメトリクスを送信するためには、アクセストークンを使用する必要があります。これは、Splunk Observability Cloud UI で新しいトークンを作成することにより行うことができます。トークンの作成方法についての詳細は、[Create a token](https://docs.splunk.com/Observability/admin/authentication-tokens/org-tokens.html) を参照してください。トークンは **INGEST** タイプである必要があります。 + +{{% notice style="note" %}} +Splunk 主催のワークショップの参加者である場合、使用しているインスタンスにはすでにアクセストークンが設定されています(環境変数として設定されています)ので、その環境変数を設定ファイルで参照します。それ以外の場合は、新しいトークンを作成し、それを環境変数として設定する必要があります。例えば: + +``` bash +export ACCESS_TOKEN= +``` + +{{% /notice %}} + +トークンは、設定ファイル内で `headers:` セクションの下に `X-SF-TOKEN: ${env:ACCESS_TOKEN}` を挿入することにで定義します: + +```yaml {hl_lines="6-8"} +exporters: + logging: + verbosity: normal + otlphttp/splunk: + metrics_endpoint: https://ingest.${env:REALM}.signalfx.com/v2/datapoint/otlp + headers: + X-SF-TOKEN: ${env:ACCESS_TOKEN} +``` + +## 設定を確認しましょう + +これで、エクスポーターもカバーできました。設定を確認していきましょう: +Now that we've covered exporters, let's check our configuration changes: + +--- + +{{% expand title="{{% badge icon=check color=green title=**Check-in** %}}設定をレビューしてください{{% /badge %}}" %}} +{{< tabs >}} +{{% tab title="config.yaml" %}} + +```yaml {lineNos="table" wrap="true" hl_lines="72-76"} +extensions: + health_check: + endpoint: 0.0.0.0:13133 + pprof: + endpoint: 0.0.0.0:1777 + zpages: + endpoint: 0.0.0.0:55679 + +receivers: + hostmetrics: + collection_interval: 10s + scrapers: + # CPU utilization metrics + cpu: + # Disk I/O metrics + disk: + # File System utilization metrics + filesystem: + # Memory utilization metrics + memory: + # Network interface I/O metrics & TCP connection metrics + network: + # CPU load metrics + load: + # Paging/Swap space utilization and I/O metrics + paging: + # Process count metrics + processes: + # Per process CPU, Memory and Disk I/O metrics. Disabled by default. + # process: + otlp: + protocols: + grpc: + http: + + opencensus: + + # Collect own metrics + prometheus/internal: + config: + scrape_configs: + - job_name: 'otel-collector' + scrape_interval: 10s + static_configs: + - targets: ['0.0.0.0:8888'] + + jaeger: + protocols: + grpc: + thrift_binary: + thrift_compact: + thrift_http: + + zipkin: + +processors: + batch: + resourcedetection/system: + detectors: [system] + system: + hostname_sources: [os] + resourcedetection/ec2: + detectors: [ec2] + attributes/conf: + actions: + - key: participant.name + action: insert + value: "INSERT_YOUR_NAME_HERE" + +exporters: + logging: + verbosity: normal + otlphttp/splunk: + metrics_endpoint: https://ingest.${env:REALM}.signalfx.com/v2/datapoint/otlp + headers: + X-SF-TOKEN: ${env:ACCESS_TOKEN} + +service: + + pipelines: + + traces: + receivers: [otlp, opencensus, jaeger, zipkin] + processors: [batch] + exporters: [logging] + + metrics: + receivers: [otlp, opencensus, prometheus] + processors: [batch] + exporters: [logging] + + extensions: [health_check, pprof, zpages] +``` + +{{% /tab %}} +{{< /tabs >}} +{{% /expand %}} + +--- + +もちろん、**OTLP** プロトコルをサポートする他のソリューションを指すように `metrics_endpoint` を簡単に設定することができます。 + +次に、`config.yaml` のサービスセクションで、今設定したレシーバー、プロセッサー、エクスポーターを有効にしていきます。 diff --git a/content/ja/other/opentelemetry-collector/6-service/1-hostmetrics.md b/content/ja/other/opentelemetry-collector/6-service/1-hostmetrics.md new file mode 100644 index 0000000000..4a78edd39f --- /dev/null +++ b/content/ja/other/opentelemetry-collector/6-service/1-hostmetrics.md @@ -0,0 +1,27 @@ +--- +title: OpenTelemetry Collector サービス +linkTitle: 6.1 Host Metrics +weight: 1 +--- + +## Hostmetrics レシーバー + +ワークショップのレシーバー部分で振り返ると、ホストシステムに関するメトリクスを生成するために、様々なソースからスクレイピングする [Host Metrics](../3-receivers/#host-metrics-receiver) レシーバーを定義しました。このレシーバーを有効にするためには、メトリクスパイプラインに `hostmetrics` レシーバーを含める必要があります。 + +`metrics` パイプラインで、メトリクスの `receivers` セクションに `hostmetrics` を追加します。 + +```yaml {hl_lines="11"} +service: + + pipelines: + + traces: + receivers: [otlp, opencensus, jaeger, zipkin] + processors: [batch] + exporters: [logging] + + metrics: + receivers: [hostmetrics, otlp, opencensus, prometheus] + processors: [batch] + exporters: [logging] +``` diff --git a/content/ja/other/opentelemetry-collector/6-service/2-prometheus.md b/content/ja/other/opentelemetry-collector/6-service/2-prometheus.md new file mode 100644 index 0000000000..1df6d9797e --- /dev/null +++ b/content/ja/other/opentelemetry-collector/6-service/2-prometheus.md @@ -0,0 +1,27 @@ +--- +title: OpenTelemetry Collector サービス +linkTitle: 6.2 Prometheus +weight: 2 +--- + +## Prometheus Internal レシーバー + +ワークショップの前半で、`prometheus` レシーバーの名前を変更し、コレクター内部のメトリクスを収集していることを反映して、`prometheus/internal` という名前にしました。 + +現在、メトリクスパイプラインの下で `prometheus/internal` レシーバーを有効にする必要があります。`metrics` パイプラインの下の `receivers` セクションを更新して、`prometheus/internal` を含めます: + +```yaml {hl_lines="11"} +service: + + pipelines: + + traces: + receivers: [otlp, opencensus, jaeger, zipkin] + processors: [batch] + exporters: [logging] + + metrics: + receivers: [hostmetrics, otlp, opencensus, prometheus/internal] + processors: [batch] + exporters: [logging] +``` diff --git a/content/ja/other/opentelemetry-collector/6-service/3-resourcedetection.md b/content/ja/other/opentelemetry-collector/6-service/3-resourcedetection.md new file mode 100644 index 0000000000..570c89d9e8 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/6-service/3-resourcedetection.md @@ -0,0 +1,27 @@ +--- +title: OpenTelemetry Collector サービス +linkTitle: 6.3 Resource Detection +weight: 3 +--- + +## Resource Detection プロセッサー + +また、コレクターがインスタンスのホスト名やAWS/EC2のメタデータを取得できるように、`resourcedetection/system` および `resourcedetection/ec2` プロセッサーを追加しました。これらのプロセッサーをメトリクスパイプライン下で有効にする必要があります。 + +`metrics` パイプラインの下の `processors` セクションを更新して、`resourcedetection/system` および `resourcedetection/ec2` を追加します: + +```yaml {hl_lines="12"} +service: + + pipelines: + + traces: + receivers: [otlp, opencensus, jaeger, zipkin] + processors: [batch] + exporters: [logging] + + metrics: + receivers: [hostmetrics, otlp, opencensus, prometheus/internal] + processors: [batch, resourcedetection/system, resourcedetection/ec2] + exporters: [logging] +``` diff --git a/content/ja/other/opentelemetry-collector/6-service/4-attributes.md b/content/ja/other/opentelemetry-collector/6-service/4-attributes.md new file mode 100644 index 0000000000..fa98b130a8 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/6-service/4-attributes.md @@ -0,0 +1,27 @@ +--- +title: OpenTelemetry Collector サービス +linkTitle: 6.4 Attributes +weight: 4 +--- + +## Attributes プロセッサー + +また、このワークショップのプロセッサーセクションでは、`attributes/conf` プロセッサーを追加し、コレクターがすべてのメトリクスに `participant.name` という新しい属性を挿入するようにしました。これをメトリクスパイプライン下で有効にする必要があります。 + +`metrics` パイプラインの下の `processors` セクションを更新して、`attributes/conf` を追加します: + +```yaml {hl_lines="12"} +service: + + pipelines: + + traces: + receivers: [otlp, opencensus, jaeger, zipkin] + processors: [batch] + exporters: [logging] + + metrics: + receivers: [hostmetrics, otlp, opencensus, prometheus/internal] + processors: [batch, resourcedetection/system, resourcedetection/ec2, attributes/conf] + exporters: [logging] +``` diff --git a/content/ja/other/opentelemetry-collector/6-service/5-otlphttp.md b/content/ja/other/opentelemetry-collector/6-service/5-otlphttp.md new file mode 100644 index 0000000000..a83614b9d1 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/6-service/5-otlphttp.md @@ -0,0 +1,246 @@ +--- +title: OpenTelemetry Collector サービス +linkTitle: 6.5 OTLP HTTP +weight: 5 +--- + +## OTLP HTTP エクスポーター + +ワークショップのエクスポーターセクションでは、`otlphttp` エクスポーターを設定して、メトリクスを Splunk Observability Cloud に送信するようにしました。これをメトリクスパイプライン下で有効にする必要があります。 + +`metrics` パイプラインの下の `exporters` セクションを更新して、`otlphttp/splunk` を追加します: + +```yaml {hl_lines="13"} +service: + + pipelines: + + traces: + receivers: [otlp, opencensus, jaeger, zipkin] + processors: [batch] + exporters: [logging] + + metrics: + receivers: [hostmetrics, otlp, opencensus, prometheus/internal] + processors: [batch, resourcedetection/system, resourcedetection/ec2, attributes/conf] + exporters: [logging, otlphttp/splunk] +``` + +--- + +{{% expand title="{{% badge style=primary icon=user-ninja %}}**Ninja:** コレクターの内部を観測する{{% /badge %}}" %}} + +コレクターは、その動作に関する内部シグナルを捕捉しています。これには実行中のコンポーネントからの追加されるシグナルも含まれます。これは、データの流れに関する決定を行うコンポーネントが、その情報をメトリクスやトレースとして表面化する方法を必要とするためです。 + +## なぜコレクターを監視するの? + +これは「監視者を監視するのは誰か?」という種類の問題ですが、このような情報を表面化できることは重要です。コレクターの歴史の興味深い部分は、GoメトリクスのSDKが安定と考えられる前に存在していたことで、コレクターは当面の間、この機能を提供するために Prometheus エンドポイントを公開しています。 + +## 注意点 + +組織内で稼働している各コレクターの内部使用状況を監視することは、新しいメトリクス量(MTS)を大幅な増加させる可能性があります。Splunkディストリビューションはこれらのメトリクスをキュレーションしており、増加を予測するのに役立ちます。 + +## Ninja ゾーン + +コレクターの内部オブザーバビリティを公開するためには、いくつかの設定を追加することがあります: + +{{< tabs >}} +{{% tab title="telemetry schema" %}} + +```yaml +service: + telemetry: + logs: + level: + development: + encoding: + disable_caller: + disable_stacktrace: + output_paths: [, paths...] + error_output_paths: [, paths...] + initial_fields: + key: value + metrics: + level: + # Address binds the promethues endpoint to scrape + address: +``` + +{{% /tab %}} +{{% tab title="example-config.yml" %}} + +```yaml +service: + telemetry: + logs: + level: info + encoding: json + disable_stacktrace: true + initial_fields: + instance.name: ${env:INSTANCE} + metrics: + address: localhost:8888 +``` + +{{% /tab %}} +{{< /tabs >}} + +## 参照 + +1. [https://opentelemetry.io/docs/collector/configuration/#service](https://opentelemetry.io/docs/collector/configuration/#service) + +{{% /expand %}} + +--- + +## 完成した設定 + +--- + +{{% expand title="{{% badge icon=check color=green title=**Check-in** %}}完成した設定をレビューしてください{{% /badge %}}" %}} +{{< tabs >}} +{{% tab title="config.yaml" %}} + +``` yaml {lineNos="table" wrap="true"} +extensions: + health_check: + endpoint: 0.0.0.0:13133 + pprof: + endpoint: 0.0.0.0:1777 + zpages: + endpoint: 0.0.0.0:55679 + +receivers: + hostmetrics: + collection_interval: 10s + scrapers: + # CPU utilization metrics + cpu: + # Disk I/O metrics + disk: + # File System utilization metrics + filesystem: + # Memory utilization metrics + memory: + # Network interface I/O metrics & TCP connection metrics + network: + # CPU load metrics + load: + # Paging/Swap space utilization and I/O metrics + paging: + # Process count metrics + processes: + # Per process CPU, Memory and Disk I/O metrics. Disabled by default. + # process: + otlp: + protocols: + grpc: + http: + + opencensus: + + # Collect own metrics + prometheus/internal: + config: + scrape_configs: + - job_name: 'otel-collector' + scrape_interval: 10s + static_configs: + - targets: ['0.0.0.0:8888'] + + jaeger: + protocols: + grpc: + thrift_binary: + thrift_compact: + thrift_http: + + zipkin: + +processors: + batch: + resourcedetection/system: + detectors: [system] + system: + hostname_sources: [os] + resourcedetection/ec2: + detectors: [ec2] + attributes/conf: + actions: + - key: participant.name + action: insert + value: "INSERT_YOUR_NAME_HERE" + +exporters: + logging: + verbosity: normal + otlphttp/splunk: + metrics_endpoint: https://ingest.${env:REALM}.signalfx.com/v2/datapoint/otlp + headers: + X-SF-TOKEN: ${env:ACCESS_TOKEN} + +service: + + pipelines: + + traces: + receivers: [otlp, opencensus, jaeger, zipkin] + processors: [batch] + exporters: [logging] + + metrics: + receivers: [hostmetrics, otlp, opencensus, prometheus/internal] + processors: [batch, resourcedetection/system, resourcedetection/ec2, attributes/conf] + exporters: [logging, otlphttp/splunk] + + extensions: [health_check, pprof, zpages] +``` + +{{% /tab %}} +{{% /tabs %}} + +{{% /expand %}} + +--- + +{{% notice style="tip" %}} +コレクターを再起動する前に、設定ファイルを検証することをお勧めします。これは、組み込みの `validate` コマンドを使用して行うことができます: + +{{< tabs >}} +{{% tab title="Command" %}} + +``` bash +otelcol-contrib validate --config=file:/etc/otelcol-contrib/config.yaml +``` + +{{% /tab %}} +{{% tab title="Example error output" %}} + +``` text +Error: failed to get config: cannot unmarshal the configuration: 1 error(s) decoding: + +* error decoding 'processors': error reading configuration for "attributes/conf": 1 error(s) decoding: + +* 'actions[0]' has invalid keys: actions +2023/06/29 09:41:28 collector server run finished with error: failed to get config: cannot unmarshal the configuration: 1 error(s) decoding: + +* error decoding 'processors': error reading configuration for "attributes/conf": 1 error(s) decoding: + +* 'actions[0]' has invalid keys: actions +``` + +{{% /tab %}} +{{< /tabs >}} +{{% /notice %}} + +動作する設定ができたので、コレクターを起動し、その後 [zPages](../2-extensions/#zpages) が報告している内容を確認しましょう。 + +{{% tab title="Command" %}} + +``` bash +otelcol-contrib --config=file:/etc/otelcol-contrib/config.yaml +``` + +{{% /tab %}} + +![pipelinez-full-config](../../images/pipelinez-full-config.png) diff --git a/content/ja/other/opentelemetry-collector/6-service/_index.md b/content/ja/other/opentelemetry-collector/6-service/_index.md new file mode 100644 index 0000000000..2a3b394f41 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/6-service/_index.md @@ -0,0 +1,27 @@ +--- +title: OpenTelemetry Collector サービス +linkTitle: 6. サービス +weight: 6 +--- + +**Service** セクションでは、レシーバー、プロセッサー、エクスポーター、およびエクステンションにある設定に基づいて、コレクターで有効にするコンポーネントを設定していきます。 + + +{{% notice style="info" %}} +コンポーネントが設定されていても、**Service** セクション内で定義されていない場合、そのコンポーネントは**有効化されません**。 +{{% /notice %}} + +サービスのセクションは、以下の3つのサブセクションで構成されています: + +- extensions(拡張機能) +- pipelines(パイプライン) +- telemetry(テレメトリー) + +デフォルトの設定では、拡張機能セクションが `health_check`、`pprof`、`zpages` を有効にするように設定されており、これらは以前のエクステンションのモジュールで設定しました。 + +``` yaml +service: + extensions: [health_check, pprof, zpages] +``` + +それでは、メトリックパイプラインを設定していきましょう! diff --git a/content/ja/other/opentelemetry-collector/7-visualisation/index.files/dashboard_OTel-Contrib-Dashboard.json b/content/ja/other/opentelemetry-collector/7-visualisation/index.files/dashboard_OTel-Contrib-Dashboard.json new file mode 100644 index 0000000000..672c86cad5 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/7-visualisation/index.files/dashboard_OTel-Contrib-Dashboard.json @@ -0,0 +1,1418 @@ +{ + "chartExports": [ + { + "chart": { + "autoDetectRelatedDetectorIds": [], + "created": 0, + "creator": null, + "customProperties": {}, + "description": "", + "id": "FybsAETAwAI", + "importOf": "FwPCYY8AIB0", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "Disk free", + "options": { + "colorBy": "Dimension", + "colorScale2": null, + "hideMissingValues": false, + "legendOptions": { + "fields": [ + { + "enabled": false, + "property": "dsname" + }, + { + "enabled": false, + "property": "host" + }, + { + "enabled": false, + "property": "sf_originatingMetric" + }, + { + "enabled": false, + "property": "sf_metric" + }, + { + "enabled": false, + "property": "plugin" + }, + { + "enabled": true, + "property": "plugin_instance" + }, + { + "enabled": false, + "property": "fs_type" + }, + { + "enabled": false, + "property": "device" + }, + { + "enabled": true, + "property": "mountpoint" + }, + { + "enabled": true, + "property": "os.type" + }, + { + "enabled": true, + "property": "type" + }, + { + "enabled": true, + "property": "mode" + }, + { + "enabled": true, + "property": "state" + }, + { + "enabled": false, + "property": "host.id" + }, + { + "enabled": false, + "property": "participant.name" + }, + { + "enabled": false, + "property": "my.name" + } + ] + }, + "maximumPrecision": 3, + "noDataOptions": { + "linkText": null, + "linkUrl": null, + "noDataMessage": null + }, + "programOptions": { + "disableSampling": false, + "maxDelay": null, + "minimumResolution": 0, + "timezone": null + }, + "publishLabelOptions": [ + { + "displayName": "Used bytes", + "label": "A", + "paletteIndex": 4, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + } + ], + "refreshInterval": null, + "secondaryVisualization": "Sparkline", + "sortBy": "-value", + "time": { + "range": 900000, + "rangeEnd": 0, + "type": "relative" + }, + "type": "List", + "unitPrefix": "Metric" + }, + "packageSpecifications": "", + "programText": "A = data('system.filesystem.usage', filter=filter('state', 'free')).publish(label='A')", + "relatedDetectorIds": [], + "tags": null + } + }, + { + "chart": { + "autoDetectRelatedDetectorIds": [], + "created": 0, + "creator": null, + "customProperties": {}, + "description": "", + "id": "FybsAETAwAM", + "importOf": "FwPCYY8AIBk", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "CPU Load Average (1m)", + "options": { + "colorBy": "Dimension", + "colorScale": null, + "colorScale2": null, + "maximumPrecision": 3, + "noDataOptions": { + "linkText": null, + "linkUrl": null, + "noDataMessage": null + }, + "programOptions": { + "disableSampling": false, + "maxDelay": null, + "minimumResolution": 0, + "timezone": null + }, + "publishLabelOptions": [ + { + "displayName": "system.cpu.load_average.1m", + "label": "A", + "paletteIndex": null, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + } + ], + "refreshInterval": null, + "secondaryVisualization": "None", + "showSparkLine": false, + "time": { + "range": 300000, + "rangeEnd": 0, + "type": "relative" + }, + "timestampHidden": true, + "type": "SingleValue", + "unitPrefix": "Metric" + }, + "packageSpecifications": "", + "programText": "A = data('system.cpu.load_average.1m').publish(label='A')", + "relatedDetectorIds": [], + "tags": null + } + }, + { + "chart": { + "autoDetectRelatedDetectorIds": [], + "created": 0, + "creator": null, + "customProperties": {}, + "description": "Page swaps/sec", + "id": "FybsAETAwAQ", + "importOf": "FwPCYY8AIBo", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "Memory Paging", + "options": { + "areaChartOptions": { + "showDataMarkers": false + }, + "axes": [ + { + "highWatermark": null, + "highWatermarkLabel": null, + "label": "Page in - RED", + "lowWatermark": null, + "lowWatermarkLabel": null, + "max": null, + "min": 0 + }, + { + "highWatermark": null, + "highWatermarkLabel": null, + "label": "Page out - BLUE", + "lowWatermark": null, + "lowWatermarkLabel": null, + "max": null, + "min": 0 + } + ], + "axisPrecision": null, + "colorBy": "Dimension", + "defaultPlotType": "LineChart", + "eventPublishLabelOptions": [], + "histogramChartOptions": { + "colorThemeIndex": 16 + }, + "includeZero": false, + "legendOptions": { + "fields": null + }, + "lineChartOptions": { + "showDataMarkers": false + }, + "noDataOptions": { + "linkText": null, + "linkUrl": null, + "noDataMessage": null + }, + "onChartLegendOptions": { + "dimensionInLegend": null, + "showLegend": false + }, + "programOptions": { + "disableSampling": false, + "maxDelay": null, + "minimumResolution": 0, + "timezone": null + }, + "publishLabelOptions": [ + { + "displayName": "Page In", + "label": "A", + "paletteIndex": 4, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "Page Out", + "label": "B", + "paletteIndex": 1, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 1 + } + ], + "showEventLines": false, + "stacked": false, + "time": { + "range": 7200000, + "rangeEnd": 0, + "type": "relative" + }, + "type": "TimeSeriesChart", + "unitPrefix": "Metric" + }, + "packageSpecifications": "", + "programText": "A = data('system.paging.operations', filter=filter('direction', 'page_in'), rollup='delta').publish(label='A')\nB = data('system.paging.operations', filter=filter('direction', 'page_out'), rollup='delta').publish(label='B')", + "relatedDetectorIds": [], + "tags": null + } + }, + { + "chart": { + "autoDetectRelatedDetectorIds": [], + "created": 0, + "creator": null, + "customProperties": {}, + "description": "", + "id": "FybsAETAwAU", + "importOf": "FwPCYY8AIBw", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "Memory", + "options": { + "areaChartOptions": { + "showDataMarkers": false + }, + "axes": [ + { + "highWatermark": null, + "highWatermarkLabel": null, + "label": "Bytes", + "lowWatermark": null, + "lowWatermarkLabel": null, + "max": null, + "min": 0 + }, + { + "highWatermark": null, + "highWatermarkLabel": null, + "label": "", + "lowWatermark": null, + "lowWatermarkLabel": null, + "max": null, + "min": null + } + ], + "axisPrecision": null, + "colorBy": "Metric", + "defaultPlotType": "AreaChart", + "eventPublishLabelOptions": [], + "histogramChartOptions": { + "colorThemeIndex": 16 + }, + "includeZero": false, + "legendOptions": { + "fields": [ + { + "enabled": true, + "property": "sf_originatingMetric" + }, + { + "enabled": true, + "property": "sf_metric" + }, + { + "enabled": false, + "property": "plugin" + }, + { + "enabled": false, + "property": "dsname" + }, + { + "enabled": false, + "property": "host" + }, + { + "enabled": false, + "property": "AWSUniqueId" + }, + { + "enabled": true, + "property": "my.name" + }, + { + "enabled": true, + "property": "os.type" + }, + { + "enabled": true, + "property": "host.id" + }, + { + "enabled": true, + "property": "state" + }, + { + "enabled": true, + "property": "participant.name" + } + ] + }, + "lineChartOptions": { + "showDataMarkers": false + }, + "noDataOptions": { + "linkText": null, + "linkUrl": null, + "noDataMessage": null + }, + "onChartLegendOptions": { + "dimensionInLegend": "state", + "showLegend": true + }, + "programOptions": { + "disableSampling": false, + "maxDelay": null, + "minimumResolution": 0, + "timezone": null + }, + "publishLabelOptions": [ + { + "displayName": "Inactive", + "label": "T", + "paletteIndex": 1, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "Slab Unreclaimable", + "label": "U", + "paletteIndex": 4, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "Buffered", + "label": "V", + "paletteIndex": 5, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "Used", + "label": "W", + "paletteIndex": 7, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "Free", + "label": "X", + "paletteIndex": 14, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "Cached", + "label": "Y", + "paletteIndex": 1, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "Slab Reclaimable", + "label": "Z", + "paletteIndex": 15, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + } + ], + "showEventLines": false, + "stacked": true, + "time": { + "range": 7200000, + "rangeEnd": 0, + "type": "relative" + }, + "type": "TimeSeriesChart", + "unitPrefix": "Binary" + }, + "packageSpecifications": "", + "programText": "T = data('system.memory.usage', filter=filter('state', 'inactive')).publish(label='T')\nU = data('system.memory.usage', filter=filter('state', 'slab_unreclaimable')).publish(label='U')\nV = data('system.memory.usage', filter=filter('state', 'buffered')).publish(label='V')\nW = data('system.memory.usage', filter=filter('state', 'used')).publish(label='W')\nX = data('system.memory.usage', filter=filter('state', 'free')).publish(label='X')\nY = data('system.memory.usage', filter=filter('state', 'cached')).publish(label='Y')\nZ = data('system.memory.usage', filter=filter('state', 'slab_reclaimable')).publish(label='Z')", + "relatedDetectorIds": [], + "tags": null + } + }, + { + "chart": { + "autoDetectRelatedDetectorIds": [], + "created": 0, + "creator": null, + "customProperties": {}, + "description": "", + "id": "FybsAETAwAY", + "importOf": "FwPCYY8AIBg", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "Memory used", + "options": { + "colorBy": "Metric", + "colorScale": null, + "colorScale2": null, + "maximumPrecision": 3, + "noDataOptions": { + "linkText": null, + "linkUrl": null, + "noDataMessage": null + }, + "programOptions": { + "disableSampling": false, + "maxDelay": null, + "minimumResolution": 0, + "timezone": null + }, + "publishLabelOptions": [ + { + "displayName": "Used", + "label": "A", + "paletteIndex": 14, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + } + ], + "refreshInterval": null, + "secondaryVisualization": "None", + "showSparkLine": false, + "time": { + "range": 300000, + "rangeEnd": 0, + "type": "relative" + }, + "timestampHidden": true, + "type": "SingleValue", + "unitPrefix": "Metric" + }, + "packageSpecifications": "", + "programText": "A = data('system.memory.usage', filter=filter('state', 'used')).publish(label='A')", + "relatedDetectorIds": [], + "tags": null + } + }, + { + "chart": { + "autoDetectRelatedDetectorIds": [], + "created": 0, + "creator": null, + "customProperties": {}, + "description": "Bits/sec", + "id": "FybsAETAwAc", + "importOf": "FwPCYY8AICE", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "Network I/O", + "options": { + "areaChartOptions": { + "showDataMarkers": false + }, + "axes": [ + { + "highWatermark": null, + "highWatermarkLabel": null, + "label": "Input bits/s - RED", + "lowWatermark": null, + "lowWatermarkLabel": null, + "max": null, + "min": 0 + }, + { + "highWatermark": null, + "highWatermarkLabel": null, + "label": "Output bits/s - BLUE", + "lowWatermark": null, + "lowWatermarkLabel": null, + "max": null, + "min": 0 + } + ], + "axisPrecision": null, + "colorBy": "Metric", + "defaultPlotType": "LineChart", + "eventPublishLabelOptions": [], + "histogramChartOptions": { + "colorThemeIndex": 16 + }, + "includeZero": false, + "legendOptions": { + "fields": null + }, + "lineChartOptions": { + "showDataMarkers": false + }, + "noDataOptions": { + "linkText": null, + "linkUrl": null, + "noDataMessage": null + }, + "onChartLegendOptions": { + "dimensionInLegend": "device", + "showLegend": true + }, + "programOptions": { + "disableSampling": false, + "maxDelay": null, + "minimumResolution": 0, + "timezone": null + }, + "publishLabelOptions": [ + { + "displayName": "Input bits/sec", + "label": "A", + "paletteIndex": 4, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "Output bits/sec", + "label": "B", + "paletteIndex": 1, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 1 + } + ], + "showEventLines": false, + "stacked": false, + "time": { + "range": 7200000, + "rangeEnd": 0, + "type": "relative" + }, + "type": "TimeSeriesChart", + "unitPrefix": "Binary" + }, + "packageSpecifications": "", + "programText": "A = data('system.network.io', filter=filter('direction', 'receive')).sum(by=['device']).publish(label='A')\nB = data('system.network.io', filter=filter('direction', 'transmit'), rollup='delta').sum(by=['device']).publish(label='B')", + "relatedDetectorIds": [], + "tags": null + } + }, + { + "chart": { + "autoDetectRelatedDetectorIds": [], + "created": 0, + "creator": null, + "customProperties": {}, + "description": "Errors/sec", + "id": "FybsAETAwAg", + "importOf": "FwPCYY8AICI", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "Network errors", + "options": { + "areaChartOptions": { + "showDataMarkers": false + }, + "axes": [ + { + "highWatermark": null, + "highWatermarkLabel": null, + "label": "Interface errors - RED", + "lowWatermark": null, + "lowWatermarkLabel": null, + "max": null, + "min": 0 + }, + { + "highWatermark": null, + "highWatermarkLabel": null, + "label": "Retransmits - BLUE", + "lowWatermark": null, + "lowWatermarkLabel": null, + "max": null, + "min": 0 + } + ], + "axisPrecision": null, + "colorBy": "Metric", + "defaultPlotType": "LineChart", + "eventPublishLabelOptions": [], + "histogramChartOptions": { + "colorThemeIndex": 16 + }, + "includeZero": false, + "legendOptions": { + "fields": null + }, + "lineChartOptions": { + "showDataMarkers": false + }, + "noDataOptions": { + "linkText": null, + "linkUrl": null, + "noDataMessage": null + }, + "onChartLegendOptions": { + "dimensionInLegend": null, + "showLegend": false + }, + "programOptions": { + "disableSampling": false, + "maxDelay": null, + "minimumResolution": 0, + "timezone": null + }, + "publishLabelOptions": [ + { + "displayName": "Errors/sec", + "label": "A", + "paletteIndex": null, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "system.network.errors", + "label": "B", + "paletteIndex": null, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "Interface errors/sec", + "label": "C", + "paletteIndex": 4, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + } + ], + "showEventLines": false, + "stacked": false, + "time": { + "range": 7200000, + "rangeEnd": 0, + "type": "relative" + }, + "type": "TimeSeriesChart", + "unitPrefix": "Metric" + }, + "packageSpecifications": "", + "programText": "A = data('system.network.errors', filter=filter('direction', 'receive')).publish(label='A', enable=False)\nB = data('system.network.errors', filter=filter('direction', 'transmit')).publish(label='B', enable=False)\nC = (A+B).sum().publish(label='C')", + "relatedDetectorIds": [], + "tags": null + } + }, + { + "chart": { + "autoDetectRelatedDetectorIds": [], + "created": 0, + "creator": null, + "customProperties": {}, + "description": "", + "id": "FybsAETAwAk", + "importOf": "FwPCYY8AIB4", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "Disk used", + "options": { + "colorBy": "Dimension", + "colorScale2": null, + "hideMissingValues": false, + "legendOptions": { + "fields": [ + { + "enabled": true, + "property": "device" + }, + { + "enabled": false, + "property": "fs_type" + }, + { + "enabled": false, + "property": "host" + }, + { + "enabled": false, + "property": "sf_originatingMetric" + }, + { + "enabled": true, + "property": "mountpoint" + }, + { + "enabled": false, + "property": "sf_metric" + }, + { + "enabled": false, + "property": "plugin_instance" + }, + { + "enabled": false, + "property": "plugin" + }, + { + "enabled": false, + "property": "dsname" + }, + { + "enabled": false, + "property": "AWSUniqueId" + }, + { + "enabled": false, + "property": "os.type" + }, + { + "enabled": true, + "property": "type" + }, + { + "enabled": false, + "property": "mode" + }, + { + "enabled": true, + "property": "state" + }, + { + "enabled": false, + "property": "host.id" + }, + { + "enabled": false, + "property": "participant.name" + }, + { + "enabled": false, + "property": "my.name" + } + ] + }, + "maximumPrecision": 3, + "noDataOptions": { + "linkText": null, + "linkUrl": null, + "noDataMessage": null + }, + "programOptions": { + "disableSampling": false, + "maxDelay": null, + "minimumResolution": 0, + "timezone": null + }, + "publishLabelOptions": [ + { + "displayName": "system.filesystem.usage", + "label": "A", + "paletteIndex": 4, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "A", + "label": "B", + "paletteIndex": null, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + } + ], + "refreshInterval": null, + "secondaryVisualization": "Sparkline", + "sortBy": "-value", + "time": { + "range": 900000, + "rangeEnd": 0, + "type": "relative" + }, + "type": "List", + "unitPrefix": "Metric" + }, + "packageSpecifications": "", + "programText": "B = (A).publish(label='B')\nA = data('system.filesystem.usage', filter=filter('state', 'used')).publish(label='A', enable=False)", + "relatedDetectorIds": [], + "tags": null + } + }, + { + "chart": { + "autoDetectRelatedDetectorIds": [], + "created": 0, + "creator": null, + "customProperties": {}, + "description": "", + "id": "FybsAETAwAo", + "importOf": "FwPCYY8AIBs", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "CPU %", + "options": { + "areaChartOptions": { + "showDataMarkers": false + }, + "axes": [ + { + "highWatermark": null, + "highWatermarkLabel": null, + "label": "", + "lowWatermark": null, + "lowWatermarkLabel": null, + "max": null, + "min": 0 + }, + { + "highWatermark": null, + "highWatermarkLabel": null, + "label": "", + "lowWatermark": null, + "lowWatermarkLabel": null, + "max": null, + "min": null + } + ], + "axisPrecision": null, + "colorBy": "Dimension", + "defaultPlotType": "AreaChart", + "eventPublishLabelOptions": [], + "histogramChartOptions": { + "colorThemeIndex": 16 + }, + "includeZero": false, + "legendOptions": { + "fields": null + }, + "lineChartOptions": { + "showDataMarkers": false + }, + "noDataOptions": { + "linkText": null, + "linkUrl": null, + "noDataMessage": null + }, + "onChartLegendOptions": { + "dimensionInLegend": null, + "showLegend": false + }, + "programOptions": { + "disableSampling": false, + "maxDelay": null, + "minimumResolution": 0, + "timezone": null + }, + "publishLabelOptions": [ + { + "displayName": "CPU utilization (%)", + "label": "A", + "paletteIndex": null, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + } + ], + "showEventLines": false, + "stacked": false, + "time": { + "range": 7200000, + "rangeEnd": 0, + "type": "relative" + }, + "type": "TimeSeriesChart", + "unitPrefix": "Metric" + }, + "packageSpecifications": "", + "programText": "A = data('system.cpu.time', filter=filter('state', 'user')).scale(10).publish(label='A')", + "relatedDetectorIds": [], + "tags": null + } + }, + { + "chart": { + "autoDetectRelatedDetectorIds": [], + "created": 0, + "creator": null, + "customProperties": {}, + "description": "Operations/sec", + "id": "FybsAETAwAs", + "importOf": "FwPCYY8AIB8", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "Disk I/O", + "options": { + "areaChartOptions": { + "showDataMarkers": false + }, + "axes": [ + { + "highWatermark": null, + "highWatermarkLabel": null, + "label": "Read ops - RED", + "lowWatermark": null, + "lowWatermarkLabel": null, + "max": null, + "min": 0 + }, + { + "highWatermark": null, + "highWatermarkLabel": null, + "label": "Write ops - BLUE", + "lowWatermark": null, + "lowWatermarkLabel": null, + "max": null, + "min": 0 + } + ], + "axisPrecision": null, + "colorBy": "Metric", + "defaultPlotType": "LineChart", + "eventPublishLabelOptions": [], + "histogramChartOptions": { + "colorThemeIndex": 16 + }, + "includeZero": false, + "legendOptions": { + "fields": null + }, + "lineChartOptions": { + "showDataMarkers": false + }, + "noDataOptions": null, + "onChartLegendOptions": { + "dimensionInLegend": null, + "showLegend": false + }, + "programOptions": { + "disableSampling": false, + "maxDelay": null, + "minimumResolution": 0, + "timezone": null + }, + "publishLabelOptions": [ + { + "displayName": "Read ops/sec", + "label": "A", + "paletteIndex": 4, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "Write ops/sec", + "label": "B", + "paletteIndex": 1, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 1 + } + ], + "showEventLines": false, + "stacked": false, + "time": { + "range": 7200000, + "rangeEnd": 0, + "type": "relative" + }, + "type": "TimeSeriesChart", + "unitPrefix": "Metric" + }, + "packageSpecifications": "", + "programText": "A = data('disk_ops.read',rollup='rate').sum().publish(label='A')\nB = data('disk_ops.write',rollup='rate').sum().publish(label='B')", + "relatedDetectorIds": [], + "tags": null + } + }, + { + "chart": { + "autoDetectRelatedDetectorIds": [], + "created": 0, + "creator": null, + "customProperties": {}, + "description": "", + "id": "FybsAETAwAw", + "importOf": "FwPCYY8AICA", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "Total network bits/sec", + "options": { + "colorBy": "Metric", + "colorScale2": null, + "hideMissingValues": false, + "legendOptions": { + "fields": null + }, + "maximumPrecision": 4, + "noDataOptions": { + "linkText": null, + "linkUrl": null, + "noDataMessage": null + }, + "programOptions": { + "disableSampling": false, + "maxDelay": null, + "minimumResolution": 0, + "timezone": null + }, + "publishLabelOptions": [ + { + "displayName": "Input bits/sec", + "label": "A", + "paletteIndex": 4, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "Output bits/sec", + "label": "B", + "paletteIndex": 1, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 1 + } + ], + "refreshInterval": null, + "secondaryVisualization": "Sparkline", + "sortBy": "+sf_metric", + "time": { + "range": 900000, + "rangeEnd": 0, + "type": "relative" + }, + "type": "List", + "unitPrefix": "Binary" + }, + "packageSpecifications": "", + "programText": "A = data('system.network.io', filter=filter('direction', 'receive')).sum().publish(label='A')\nB = data('system.network.io', filter=filter('direction', 'transmit'), rollup='rate').sum().publish(label='B')", + "relatedDetectorIds": [], + "tags": null + } + }, + { + "chart": { + "autoDetectRelatedDetectorIds": [], + "created": 0, + "creator": null, + "customProperties": {}, + "description": "", + "id": "FybsAETAwA0", + "importOf": "FwPCYY8AICM", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "Load average", + "options": { + "colorBy": "Dimension", + "colorScale2": null, + "hideMissingValues": false, + "legendOptions": { + "fields": null + }, + "maximumPrecision": 3, + "noDataOptions": { + "linkText": null, + "linkUrl": null, + "noDataMessage": null + }, + "programOptions": { + "disableSampling": false, + "maxDelay": null, + "minimumResolution": 0, + "timezone": null + }, + "publishLabelOptions": [ + { + "displayName": "1m Average", + "label": "A", + "paletteIndex": null, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "5m Average", + "label": "B", + "paletteIndex": null, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + }, + { + "displayName": "15m Average", + "label": "C", + "paletteIndex": null, + "plotType": null, + "valuePrefix": null, + "valueSuffix": null, + "valueUnit": null, + "yAxis": 0 + } + ], + "refreshInterval": null, + "secondaryVisualization": "Sparkline", + "sortBy": "+sf_metric", + "time": { + "range": 900000, + "rangeEnd": 0, + "type": "relative" + }, + "type": "List", + "unitPrefix": "Metric" + }, + "packageSpecifications": "", + "programText": "A = data('system.cpu.load_average.1m').mean().publish(label='A')\nB = data('system.cpu.load_average.5m').mean().publish(label='B')\nC = data('system.cpu.load_average.15m').mean().publish(label='C')", + "relatedDetectorIds": [], + "tags": null + } + } + ], + "crossLinkExports": [], + "dashboardExports": [ + { + "dashboard": { + "authorizedWriters": null, + "chartDensity": "DEFAULT", + "charts": [ + { + "chartId": "FybsAETAwAY", + "column": 3, + "height": 1, + "row": 0, + "width": 3 + }, + { + "chartId": "FybsAETAwAw", + "column": 6, + "height": 1, + "row": 0, + "width": 3 + }, + { + "chartId": "FybsAETAwAk", + "column": 9, + "height": 1, + "row": 0, + "width": 3 + }, + { + "chartId": "FybsAETAwAM", + "column": 0, + "height": 1, + "row": 0, + "width": 3 + }, + { + "chartId": "FybsAETAwAo", + "column": 0, + "height": 1, + "row": 1, + "width": 6 + }, + { + "chartId": "FybsAETAwA0", + "column": 6, + "height": 1, + "row": 1, + "width": 6 + }, + { + "chartId": "FybsAETAwAU", + "column": 0, + "height": 1, + "row": 2, + "width": 6 + }, + { + "chartId": "FybsAETAwAQ", + "column": 6, + "height": 1, + "row": 2, + "width": 6 + }, + { + "chartId": "FybsAETAwAs", + "column": 0, + "height": 1, + "row": 3, + "width": 6 + }, + { + "chartId": "FybsAETAwAI", + "column": 6, + "height": 1, + "row": 3, + "width": 6 + }, + { + "chartId": "FybsAETAwAc", + "column": 0, + "height": 1, + "row": 4, + "width": 6 + }, + { + "chartId": "FybsAETAwAg", + "column": 6, + "height": 1, + "row": 4, + "width": 6 + } + ], + "created": 0, + "creator": null, + "customProperties": null, + "description": "", + "discoveryOptions": null, + "eventOverlays": null, + "filters": { + "sources": null, + "time": { + "end": "Now", + "start": "-5m" + }, + "variables": [ + { + "alias": "host", + "applyIfExists": false, + "description": "Host running collectd", + "preferredSuggestions": [], + "property": "host", + "propertyMappings": [ + "host", + "host.name" + ], + "replaceOnly": false, + "required": true, + "restricted": false, + "value": [ + "*" + ] + } + ] + }, + "groupId": "FybsAETAwAE", + "groupName": "OpenTelemetry Contrib", + "id": "FybsAETAwA4", + "importOf": "FwPCYY8AICQ", + "lastUpdated": 0, + "lastUpdatedBy": null, + "maxDelayOverride": null, + "name": "OTel Contrib Dashboard", + "permissions": null, + "selectedEventOverlays": [], + "tags": null + } + } + ], + "groupExport": { + "group": { + "authorizedWriters": null, + "created": 0, + "creator": null, + "dashboardConfigs": [ + { + "configId": "FwPCYY8AICU", + "dashboardId": "FybsAETAwA4", + "descriptionOverride": null, + "filtersOverride": null, + "nameOverride": null + } + ], + "dashboards": [ + "FybsAETAwA4" + ], + "description": "", + "email": null, + "id": "FybsAETAwAE", + "importDetails": { + "hashCode": -1470956163, + "importOf": "FwOxtI_AEB4", + "importTime": 1686585381165 + }, + "importOf": "FwOxtI_AEB4", + "lastUpdated": 0, + "lastUpdatedBy": null, + "name": "OpenTelemetry Contrib", + "permissions": null, + "teams": null + } + }, + "hashCode": 390745185, + "id": "FybsAETAwAE", + "modelVersion": 1, + "packageType": "GROUP" +} \ No newline at end of file diff --git a/content/ja/other/opentelemetry-collector/7-visualisation/index.md b/content/ja/other/opentelemetry-collector/7-visualisation/index.md new file mode 100644 index 0000000000..01f8da2fe2 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/7-visualisation/index.md @@ -0,0 +1,44 @@ +--- +title: データの可視化 +linkTitle: 7. 可視化 +weight: 7 +--- + +## Splunk Observability Cloud + +OpenTelemetry Collector を設定して Splunk Observability Cloud にメトリクスを送信するようにしたので、Splunk Observability Cloud でデータを見てみましょう。Splunk Observability Cloud への招待を受け取っていない場合は、講師がログイン資格情報を提供します。 + +その前に、もう少し興味深くするために、インスタンスでストレステストを実行しましょう。これにより、ダッシュボードが活性化されます。 + +``` bash +sudo apt install stress +while true; do stress -c 2 -t 40; stress -d 5 -t 40; stress -m 20 -t 40; done +``` + +Splunk Observability Cloudにログインしたら、左側のナビゲーションを使用して **Dashboards** に移動します: + +![menu-dashboards](../images/menu-dashboards.png) + +検索ボックスで **OTel Contrib** を検索します: + +![search-dashboards](../images/search-dashboards.png) + +{{% notice style="info" %}} +ダッシュボードが存在しない場合は、講師が迅速に追加します。このワークショップの Splunk 主催版に参加していない場合、インポートするダッシュボードグループはこのページの下部にあります。 +{{% /notice %}} + +**OTel Contrib Dashboard** ダッシュボードをクリックして開きます: + +![otel-dashboard](../images/otel-dashboard.png) + +ダッシュボードの上部にある **Filter** 欄に「participant」の途中まで入力し、候補に出る **participant.name** を選択します: + +![search-filter](../images/search-filter.png) + +`participant.name` で、`config.yaml` 内で設定したあなたの名前を入力するか、リストから選択することができます: + +![select-conf-attendee-name](../images/select-participant-name.png) + +これで、OpenTelemetry Collector を設定したホストの、ホストメトリクスを確認することができます。 + +{{% attachments sort="asc" style="info" title="ダッシュボードJSONのダウンロード方法" /%}} diff --git a/content/ja/other/opentelemetry-collector/8-develop/1-project-setup.md b/content/ja/other/opentelemetry-collector/8-develop/1-project-setup.md new file mode 100644 index 0000000000..323a75b3fc --- /dev/null +++ b/content/ja/other/opentelemetry-collector/8-develop/1-project-setup.md @@ -0,0 +1,34 @@ +--- +title: OpenTelemetry Collector を開発する +linkTitle: 8.1 セットアップ +weight: 9 +--- + +## プロジェクトのセットアップ {{% badge style=primary icon=user-ninja %}}**Ninja**{{% /badge %}} + +{{% notice style="note" %}} + +このワークショップのセクションを完了する時間は経験によって異なる場合があります。 + +完成したものは[こちら](https://github.com/splunk/collector-workshop-example)にあります。詰まった場合や講師と一緒に進めたい場合に利用してください。 + +{{% /notice %}} + +新しい _Jenkins CI_ レシーバーの開発を始めるため、まずは Go プロジェクトのセットアップから始めていきます。 +新しい Go プロジェクトを作成する手順は以下の通りです: + +1. `${HOME}/go/src/jenkinscireceiver` という名前の新しいディレクトリを作成し、そのディレクトリに移動します。 + 1. 実際のディレクトリ名や場所は厳密ではありません。自分の開発ディレクトリを自由に選ぶことができます。 +1. `go mod init splunk.conf/workshop/example/jenkinscireceiver` を実行して、Go のモジュールを初期化します。 + 1. 依存関係を追跡するために使用される `go.mod` というファイルが作成されます。 + 1. インポートされている依存関係のチェックサム値が `go.sum` として保存されます。 + +{{% expand title="{{% badge icon=check color=green title=**Check-in** %}}go.modをレビューする{{% /badge %}}" %}} + +`` text +module splunk.conf/workshop/example/jenkinscireceiver + +go 1.20 +``` + +{{% /expand %}} diff --git a/content/ja/other/opentelemetry-collector/8-develop/2-configuration.md b/content/ja/other/opentelemetry-collector/8-develop/2-configuration.md new file mode 100644 index 0000000000..d8859c4260 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/8-develop/2-configuration.md @@ -0,0 +1,93 @@ +--- +title: OpenTelemetry Collector を開発する +linkTitle: 8.2 Configuration +weight: 10 +--- + +## Configuration の構築 + +コンポーネントの Configuration 部分は、ユーザーがコンポーネントに対する入力を行う方法であり、設定に使用される値は以下のようである必要があります: + +1. そのフィールドが何を制御するのか、ユーザーが直感的に理解できる +1. 必須項目とオプション項目が明確である +1. 共通の名前とフィールドを再利用する +1. オプションをシンプルに保つ + +{{% tabs %}} +{{% tab title="良い config" %}} + +``` yaml +--- +# Required Values +endpoint: http://my-jenkins-server:8089 +auth: + authenticator: basicauth/jenkins +# Optional Values +collection_interval: 10m +metrics: + example.metric.1: + enabled: true + example.metric.2: + enabled: true + example.metric.3: + enabled: true + example.metric.4: + enabled: true +``` + +{{% /tab %}} +{{% tab title="悪い config" %}} + +```yaml +--- +jenkins_server_addr: hostname +jenkins_server_api_port: 8089 +interval: 10m +filter_builds_by: + - name: my-awesome-build + status: amber +track: + values: + example.metric.1: yes + example.metric.2: yes + example.metric.3: no + example.metric.4: no +``` + +{{% /tab %}} +{{% /tabs %}} + +悪い例では、Configuration のベストプラクティスに反するとコンポーネントが使いにくくなってしまうことが理解できるはずです。 +フィールドの値が何であるべきかを明確ではなく、既存のプロセッサーに移譲できる機能を含み、コレクター内の他のコンポーネントと比較してフィールドの命名に一貫性がありません。 + +良い例では、必要な値をシンプルに保ち、他のコンポーネントからのフィールド名を再利用し、コンポーネントが Jenkins とコレクター間の相互作用にのみ焦点を当てています。 + +設定値の中には、このコンポーネントで独自に追加するものと、コレクター内部の共有ライブラリによって提供されているものがあります。これらはビジネスロジックに取り組む際にさらに詳しく説明します。Configuration は小さく始めるべきで、ビジネスロジックに追加の機能が必要になったら、設定も追加していきましょう。 + +## コードを書く + +Configuration に必要なコードを実装するために、`config.go` という名前の新しいファイルを以下の内容で作成します: + +``` go +package jenkinscireceiver + +import ( + "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/receiver/scraperhelper" + + "splunk.conf/workshop/example/jenkinscireceiver/internal/metadata" +) + +type Config struct { + // HTTPClientSettings contains all the values + // that are commonly shared across all HTTP interactions + // performed by the collector. + confighttp.HTTPClientSettings `mapstructure:",squash"` + // ScraperControllerSettings will allow us to schedule + // how often to check for updates to builds. + scraperhelper.ScraperControllerSettings `mapstructure:",squash"` + // MetricsBuilderConfig contains all the metrics + // that can be configured. + metadata.MetricsBuilderConfig `mapstructure:",squash"` +} +``` diff --git a/content/ja/other/opentelemetry-collector/8-develop/3-component.md b/content/ja/other/opentelemetry-collector/8-develop/3-component.md new file mode 100644 index 0000000000..083a9fa817 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/8-develop/3-component.md @@ -0,0 +1,64 @@ +--- +title: OpenTelemetry Collector を開発する +linkTitle: 8.3 コンポーネントを検討する +weight: 11 +--- + +## コンポーネントを検討する + +Jenkinsからメトリクスを取得するために必要なコンポーネントの種類をおさらいしましょう: + +{{% tabs %}} +{{% tab title="エクステンション" %}} +エクステンションが解決するビジネスユースケースは以下の通りです: + +1. 実行時の設定が必要な共有機能を持つ +1. コレクターの実行時間の観察に間接的に役立つ + +詳細については、[エクステンションの概要](../2-extensions)を参照してください。 +{{% /tab %}} +{{% tab title="レシーバー" %}} +レシーバーが解決するビジネスユースケースは以下の通りです: + +- リモートソースからのデータの取得 +- リモートソースからのデータの受信 + +これらは一般的に _pull_ 対 _push_ ベースのデータ収集と呼ばれ、詳細については[レシーバーの概要](../3-receivers)で読むことができます。 +{{% /tab %}} +{{% tab title="プロセッサー" %}} +プロセッサーが解決するビジネスユースケースは以下の通りです: + +- データ、フィールド、または値の追加または削除 +- データの観察と意思決定 +- バッファリング、キューイング、および並べ替え + +プロセッサーを通過するデータタイプは、下流のコンポーネントに同じデータタイプを転送する必要があることを覚えておいてください。 +詳細については、[プロセッサーの概要](../4-processors)をご覧ください。 +{{% /tab %}} +{{% tab title="エクスポーター" %}} +エクスポーターが解決するビジネスユースケースは以下の通りです: + +- データをツール、サービス、またはストレージに送信する + +OpenTelemetryコレクターは「バックエンド」、すべてを一元化した観測可能性スイートを目指すのではなく、OpenTelemetryの創設原則に忠実であり続けることを目指しています。つまり、ベンダーに依存しない全ての人のための観測可能性です。詳細については、[エクスポーターの概要](../5-exporters)をお読みください。 + +{{% /tab %}} +{{% tab title="{{% badge style=primary icon=user-ninja %}}**Ninja:** コネクター{{% /badge %}}" %}} + +コネクターは比較的新しいコンポーネントで、このワークショップではあまり触れていません。 +コネクターは、異なるテレメトリタイプやパイプラインをまたいで使用できるプロセッサーのようなものだといえます。たとえば、コネクターはログとしてデータを受け取り、メトリクスとして出力したり、あるパイプラインからメトリクスを受け取り、テレメトリーデータに関するメトリクスを提供したりすることができます。 + +コネクターが解決するビジネスケースは以下の通りです: + +- 異なるテレメトリタイプ間の変換 + - ログからメトリクスへ + - トレースからメトリクスへ + - メトリクスからログへ +- 受信したデータを観察し、自身のデータを生成する + - メトリクスを受け取り、データの分析メトリクスを生成する。 + +**Ninja**セクションの一部として[プロセッサーの概要](../4-processors)内で簡単に概要が説明されています。 +{{% /tab %}} +{{% /tabs %}} + +これらのコンポーネントについて考えると、Jenkins に対応する場合はプルベースのレシーバーを開発する必要があることがわかります。 diff --git a/content/ja/other/opentelemetry-collector/8-develop/4-design.md b/content/ja/other/opentelemetry-collector/8-develop/4-design.md new file mode 100644 index 0000000000..591ef36e03 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/8-develop/4-design.md @@ -0,0 +1,247 @@ +--- +title: OpenTelemetry Collector を開発する +linkTitle: 8.4 メトリクスを設計する +weight: 12 +--- + +### メトリクスを設計する + +レシーバーによってキャプチャされるメトリクスを定義し、エクスポートするために、コレクターのために開発された [mdatagen](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/cmd/mdatagen) を使って、yaml で定義したメトリクスをコードに変換していきます。 + +{{% tabs %}} +{{% tab title="metadata.yaml"%}} + +``` yaml +--- +# Type defines the name to reference the component +# in the configuration file +type: jenkins + +# Status defines the component type and the stability level +status: + class: receiver + stability: + development: [metrics] + +# Attributes are the expected fields reported +# with the exported values. +attributes: + job.name: + description: The name of the associated Jenkins job + type: string + job.status: + description: Shows if the job had passed, or failed + type: string + enum: + - failed + - success + - unknown + +# Metrics defines all the pontentially exported values from this receiver. +metrics: + jenkins.jobs.count: + enabled: true + description: Provides a count of the total number of configured jobs + unit: "{Count}" + gauge: + value_type: int + jenkins.job.duration: + enabled: true + description: Show the duration of the job + unit: "s" + gauge: + value_type: int + attributes: + - job.name + - job.status + jenkins.job.commit_delta: + enabled: true + description: The calculation difference of the time job was finished minus commit timestamp + unit: "s" + gauge: + value_type: int + attributes: + - job.name + - job.status +``` + +{{% /tab %}} +{{% tab title="gen.go" %}} + +``` go +// To generate the additional code needed to capture metrics, +// the following command to be run from the shell: +// go generate -x ./... + +//go:generate go run github.com/open-telemetry/opentelemetry-collector-contrib/cmd/mdatagen@v0.80.0 metadata.yaml +package jenkinscireceiver + +// There is no code defined within this file. +``` + +{{% /tab%}} +{{% /tabs %}} + +次のセクションに進む前に、これらのファイルをプロジェクトフォルダ内に作成してください。 + +## Factory の構築 + +Factory はソフトウェアデザインパターンの一種で、提供された Configuration を使って、動的にオブジェクト(この場合は `jenkinscireceiver`)を作成するものです。現実的な例では、携帯電話店に行って、あなたの正確な説明に合った携帯電話を求め、それを提供されるようなものです。 + +コマンド `go generate -x ./...` を実行すると、定義されたメトリクスをエクスポートするために必要なすべてのコードを含む新しいフォルダ `jenkinscireceiver/internal/metadata` が作成されます。生成されるコードは以下の通りです: + +{{% tabs %}} +{{% tab title="factory.go" %}} + +``` go +package jenkinscireceiver + +import ( + "errors" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/scraperhelper" + + "splunk.conf/workshop/example/jenkinscireceiver/internal/metadata" +) + +func NewFactory() receiver.Factory { + return receiver.NewFactory( + metadata.Type, + newDefaultConfig, + receiver.WithMetrics(newMetricsReceiver, metadata.MetricsStability), + ) +} + +func newMetricsReceiver(_ context.Context, set receiver.CreateSettings, cfg component.Config, consumer consumer.Metrics) (receiver.Metrics, error) { + // Convert the configuration into the expected type + conf, ok := cfg.(*Config) + if !ok { + return nil, errors.New("can not convert config") + } + sc, err := newScraper(conf, set) + if err != nil { + return nil, err + } + return scraperhelper.NewScraperControllerReceiver( + &conf.ScraperControllerSettings, + set, + consumer, + scraperhelper.AddScraper(sc), + ) +} +``` + +{{% /tab %}} +{{% tab title="config.go" %}} + +``` go +package jenkinscireceiver + +import ( + "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/receiver/scraperhelper" + + "splunk.conf/workshop/example/jenkinscireceiver/internal/metadata" +) + +type Config struct { + // HTTPClientSettings contains all the values + // that are commonly shared across all HTTP interactions + // performed by the collector. + confighttp.HTTPClientSettings `mapstructure:",squash"` + // ScraperControllerSettings will allow us to schedule + // how often to check for updates to builds. + scraperhelper.ScraperControllerSettings `mapstructure:",squash"` + // MetricsBuilderConfig contains all the metrics + // that can be configured. + metadata.MetricsBuilderConfig `mapstructure:",squash"` +} + +func newDefaultConfig() component.Config { + return &Config{ + ScraperControllerSettings: scraperhelper.NewDefaultScraperControllerSettings(metadata.Type), + HTTPClientSettings: confighttp.NewDefaultHTTPClientSettings(), + MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), + } +} +``` + +{{% /tab %}} +{{% tab title="scraper.go" %}} + +``` go +package jenkinscireceiver + +type scraper struct {} + +func newScraper(cfg *Config, set receiver.CreateSettings) (scraperhelper.Scraper, error) { + // Create a our scraper with our values + s := scraper{ + // To be filled in later + } + return scraperhelper.NewScraper(metadata.Type, s.scrape) +} + +func (scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { + // To be filled in + return pmetrics.NewMetrics(), nil +} +``` + +{{% /tab %}} +{{% tab title="build-config.yaml" %}} + +``` yaml +--- +dist: + name: otelcol + description: "Conf workshop collector" + output_path: ./dist + version: v0.0.0-experimental + +extensions: + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/basicauthextension v0.80.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.80.0 + +receivers: + - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.80.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.80.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.80.0 + - gomod: splunk.conf/workshop/example/jenkinscireceiver v0.0.0 + path: ./jenkinscireceiver + +processors: + - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.80.0 + +exporters: + - gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.80.0 + - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.80.0 + - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.80.0 + +# This replace is a go directive that allows for redefine +# where to fetch the code to use since the default would be from a remote project. +replaces: +- splunk.conf/workshop/example/jenkinscireceiver => ./jenkinscireceiver +``` + +{{% /tab %}} +{{% tab title="project layout" %}} + +``` text +├── build-config.yaml +└── jenkinscireceiver + ├── go.mod + ├── config.go + ├── factory.go + ├── scraper.go + └── internal + └── metadata +``` + +{{% /tab %}} +{{% /tabs %}} + +これらのファイルがプロジェクトに作成されたら、`go mod tidy` を実行します。すると、すべての依存ライブラリが取得され、`go.mod` が更新されます。 diff --git a/content/ja/other/opentelemetry-collector/8-develop/5-business-logic.md b/content/ja/other/opentelemetry-collector/8-develop/5-business-logic.md new file mode 100644 index 0000000000..955c837516 --- /dev/null +++ b/content/ja/other/opentelemetry-collector/8-develop/5-business-logic.md @@ -0,0 +1,225 @@ +--- +title: OpenTelemetry Collector を開発する +linkTitle: 8.5 ビジネスロジックを作る +weight: 13 +--- + +## ビジネスロジックを作る + +この時点では、何も行っていないカスタムコンポーネントが作成されています。ここから、Jenkins からデータを取得するための必要なロジックを追加していきましょう。 + +ここからのステップは以下の通りです: + +1. Jenkinsに接続するクライアントを作成する +1. 設定されたすべてのジョブをキャプチャする +1. 設定されたジョブの最後のビルドのステータスを報告する +1. コミットタイムスタンプとジョブ完了の時間差を計算する + +変更を `scraper.go` に加えていきます。 + +{{% tabs %}} +{{% tab title="1. Jenkins クライアントを追加する" %}} + +Jenkinsサーバーに接続するために、パッケージ ["github.com/yosida95/golang-jenkins"](https://pkg.go.dev/github.com/yosida95/golang-jenkins) を使用します。これには、Jenkinsサーバーからデータを読み取るために必要な機能が提供されています。 + +次に、["go.opentelemetry.io/collector/receiver/scraperhelper"](https://pkg.go.dev/go.opentelemetry.io/collector/receiver/scraperhelper) ライブラリのいくつかのヘルパー関数を利用して、コンポーネントの起動が完了したらJenkinsサーバーに接続できるようにするスタート関数を作成します。 + +```go +package jenkinscireceiver + +import ( + "context" + + jenkins "github.com/yosida95/golang-jenkins" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/scraperhelper" + + "splunk.conf/workshop/example/jenkinscireceiver/internal/metadata" +) + +type scraper struct { + mb *metadata.MetricsBuilder + client *jenkins.Jenkins +} + +func newScraper(cfg *Config, set receiver.CreateSettings) (scraperhelper.Scraper, error) { + s := &scraper{ + mb : metadata.NewMetricsBuilder(cfg.MetricsBuilderConfig, set), + } + + return scraperhelper.NewScraper( + metadata.Type, + s.scrape, + scraperhelper.WithStart(func(ctx context.Context, h component.Host) error { + client, err := cfg.ToClient(h, set.TelemetrySettings) + if err != nil { + return err + } + // The collector provides a means of injecting authentication + // on our behalf, so this will ignore the libraries approach + // and use the configured http client with authentication. + s.client = jenkins.NewJenkins(nil, cfg.Endpoint) + s.client.SetHTTPClient(client) + return nil + }), + ) +} + +func (s scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { + // To be filled in + return pmetric.NewMetrics(), nil +} + +``` +これで、Jenkinsレシーバーを初期化するために必要なすべてのコードが完成しました。 + +{{% /tab%}} +{{% tab title="2. ジョブをキャプチャする" %}} + +ここから先は、実装が必要な `scrape` メソッドに焦点を当てます。このメソッドは、設定された間隔(デフォルトでは1分)ごとに実行されます。 + +Jenkins サーバーの負荷状況や、どの程度のプロジェクトが実行されているかを測定するために、Jenkins で設定されているジョブの数をキャプチャしたいと考えています。これを行うために、Jenkins クライアントを呼び出してすべてのジョブをリスト化し、エラーが報告された場合はメトリクスなしでそれを返し、そうでなければメトリクスビルダーからのデータを発行します。 + +```go +func (s scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { + jobs, err := s.client.GetJobs() + if err != nil { + return pmetric.Metrics{}, err + } + + // Recording the timestamp to ensure + // all captured data points within this scrape have the same value. + now := pcommon.NewTimestampFromTime(time.Now()) + + // Casting to an int64 to match the expected type + s.mb.RecordJenkinsJobsCountDataPoint(now, int64(len(jobs))) + + // To be filled in + + return s.mb.Emit(), nil +} +``` + +{{% /tab%}} +{{% tab title="3. ジョブの状態を報告する" %}} + +前のステップにより、すべてのジョブをキャプチャしてジョブの数をレポートできるようになりました。 +このステップでは、それぞれのジョブを調査し、レポートされた値を使用してメトリクスをキャプチャしていきます。 + +```go +func (s scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { + jobs, err := s.client.GetJobs() + if err != nil { + return pmetric.Metrics{}, err + } + + // Recording the timestamp to ensure + // all captured data points within this scrape have the same value. + now := pcommon.NewTimestampFromTime(time.Now()) + + // Casting to an int64 to match the expected type + s.mb.RecordJenkinsJobsCountDataPoint(now, int64(len(jobs))) + + for _, job := range jobs { + // Ensure we have valid results to start off with + var ( + build = job.LastCompletedBuild + status = metadata.AttributeJobStatusUnknown + ) + + // This will check the result of the job, however, + // since the only defined attributes are + // `success`, `failure`, and `unknown`. + // it is assume that anything did not finish + // with a success or failure to be an unknown status. + + switch build.Result { + case "aborted", "not_built", "unstable": + status = metadata.AttributeJobStatusUnknown + case "success": + status = metadata.AttributeJobStatusSuccess + case "failure": + status = metadata.AttributeJobStatusFailed + } + + s.mb.RecordJenkinsJobDurationDataPoint( + now, + int64(job.LastCompletedBuild.Duration), + job.Name, + status, + ) + } + + return s.mb.Emit(), nil +} +``` + +{{% /tab%}} +{{% tab title="4. 差分を報告する" %}} + +最後のステップでは、コミットからジョブ完了までにかかった時間を計算して、[DORA メトリクス](https://cloud.google.com/blog/products/devops-sre/using-the-four-keys-to-measure-your-devops-performance) を推測するのに役立てていきます。 + +```go +func (s scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { + jobs, err := s.client.GetJobs() + if err != nil { + return pmetric.Metrics{}, err + } + + // Recording the timestamp to ensure + // all captured data points within this scrape have the same value. + now := pcommon.NewTimestampFromTime(time.Now()) + + // Casting to an int64 to match the expected type + s.mb.RecordJenkinsJobsCountDataPoint(now, int64(len(jobs))) + + for _, job := range jobs { + // Ensure we have valid results to start off with + var ( + build = job.LastCompletedBuild + status = metadata.AttributeJobStatusUnknown + ) + + // Previous step here + + // Ensure that the `ChangeSet` has values + // set so there is a valid value for us to reference + if len(build.ChangeSet.Items) == 0 { + continue + } + + // Making the assumption that the first changeset + // item is the most recent change. + change := build.ChangeSet.Items[0] + + // Record the difference from the build time + // compared against the change timestamp. + s.mb.RecordJenkinsJobCommitDeltaDataPoint( + now, + int64(build.Timestamp-change.Timestamp), + job.Name, + status, + ) + } + + return s.mb.Emit(), nil +} +``` + +{{% /tab%}} +{{% /tabs %}} + +これらのステップがすべて完了すると、Jenkins CI レシーバーが完成します! + +## 次は何をするの? + +コンポーネントに必要な機能は、おそらく他にもたくさん思いつくでしょう。例えば: + +- ジョブで使用されたブランチ名を含めることはできますか? +- ジョブのプロジェクト名を含めることはできますか? +- プロジェクトのジョブの総持続時間をどのように計算しますか? +- 変更が機能するかどうかをどのように検証しますか? + +この時間を使って遊んでみたり、壊してみたり、変更してみたり、ビルドからのログをキャプチャしてみるなどしてください。 diff --git a/content/ja/other/opentelemetry-collector/8-develop/_index.md b/content/ja/other/opentelemetry-collector/8-develop/_index.md new file mode 100644 index 0000000000..7772000dbd --- /dev/null +++ b/content/ja/other/opentelemetry-collector/8-develop/_index.md @@ -0,0 +1,39 @@ +--- +title: OpenTelemetry Collector を開発する +linkTitle: 8. Develop +weight: 8 +--- + +## カスタムコンポーネントの開発 + +Open Telemetry Collectorのためのコンポーネントを構築するには、以下の3つの主要な部分が必要です: + +1. Configuration - _ユーザーが設定できる値は何か_ +1. Factory - _提供された値を使ってコンポーネントを作成する_ +1. Business Logic - _コンポーネントが実行する必要があること_ + +これについて、プロジェクトの重要なDevOpsメトリクスを追跡するためにJenkinsと連携するコンポーネントを構築する例を考えていきます。 + +測定しようとしているメトリクスは次のとおりです: + +1. 変更に対するリードタイム - _「コミットが本番環境に入るまでにかかる時間」_ +1. 変更失敗率 - _「本番環境での障害を引き起こすデプロイの割合」_ +1. デプロイ頻度 - _「[チーム]が本番環境に成功してリリースする頻度」_ +1. 平均復旧時間 - _「[チーム]が本番環境の障害から復旧するのにかかる時間」_ + +これらの指標は Google の [DevOps Research and Assessment (DORA)](https://dora.dev/) チームによって特定されたもので、ソフトウェア開発チームのパフォーマンスを示すのに役立ちます。_Jenkins CI_ を選択した理由は、私たちが同じオープンソースソフトウェアエコシステムに留まり、将来的にベンダー管理のCIツールが採用する例となることができるためです。 + +## 計装 🆚 コンポーネント + +組織内でオブザーバビリティを向上させる際には、トレードオフが発生するため、考慮する点があります。 + +| | 長所 | 短所 | +| ----- | ----- | ----- | +| **(自動)計装**[^1] | システムを観測するために外部APIが不要 | 計装を変更するにはプロジェクトの変更が必要 | +| | システム所有者/開発者は可観測性の変更が可能 | ランタイムへの追加の依存が必要 | +| | システムの文脈を理解し、_Exemplar_ とキャプチャされたデータを関連付けることが可能 | システムのパフォーマンスに影響を与える可能性がある | +| **コンポーネント** | データ名や意味の変更をシステムのリリースサイクルから独立した展開が可能 | APIの破壊的な変更の可能性があり、システムとコレクター間でリリースの調整が必要 | +| | その後の利用に合わせて収集されるデータの更新/拡張が容易 | キャプチャされたデータの意味がシステムリリースと一致せず、予期せず壊れる可能性がある | + + +[^1]: 計装(instrument, インストゥルメント)とは、アプリケーションなどのシステムコンポーネントに対して、トレースやメトリクス、ログなどのテレメトリーデータを出力させる実装。計装ライブラリを最低限セットアップするだけで一通りのトレースやメトリクスなどを出力できるような対応を「自動計装」と呼びます。 diff --git a/content/ja/other/opentelemetry-collector/_index.md b/content/ja/other/opentelemetry-collector/_index.md new file mode 100644 index 0000000000..8efef69fdb --- /dev/null +++ b/content/ja/other/opentelemetry-collector/_index.md @@ -0,0 +1,77 @@ +--- +title: OpenTelemetryでクラウドネイティブ環境のオブザーバビリティを実現する +linkTitle: OpenTelemetry Collector +weight: 10 +alwaysopen: false +description: OpenTelemetry Collectorのコンセプトを学び、Splunk Observability Cloudにデータを送信する方法を理解しましょう。 +--- + +## 概要 + +OpenTelemetry を使い始める場合は、バックエンドに直接データを送ることから始めるかもしれません。最初のステップとしてはよいですが、OpenTelemetry Collector をオブザーバビリティのアーキテクチャとして使用するのは多くの利点があり、本番環境では Collector を使ったデプロイを推奨しています。 + +このワークショップでは、OpenTelemetry Collector を使用することに焦点を当て、Splunk Observability Cloud で使用するためのレシーバー、プロセッサー、エクスポーターを定義し、実際にテレメトリデータを送信するためのパイプラインを設定することで、環境に合わせて Collector を活用を学びます。また、分散プラットフォームのビジネスニーズに対応するための、カスタムコンポーネントを追加できるようになるまでの道のりを進むことになります。 + +### Ninja セクション + +ワークショップの途中には、展開できる {{% badge style=primary icon=user-ninja %}}Ninja セクション{{% /badge %}} があります。これらはより実践的で、ワークショップ中、もしくは自分の時間を使って、さらに技術的な詳細に取り組むことができます。 + +OpenTelemetry プロジェクトは頻繁に開発されているため、Ninjaセクションの内容が古くなる可能性があることに注意してください。コンテンツが古い場合には更新のリクエストを出すこともできますので、必要なものを見つけた場合はお知らせください。 + +--- + +{{% expand title="{{% badge style=primary icon=user-ninja %}}**Ninja:** をテストして!{{% /badge %}}" %}} +**このワークショップを完了すると、正式に OpenTelemetry Collector ニンジャになります!** +{{% /expand %}} + +--- + +## 対象者 + +このワークショップは、OpenTelemetry Collector のアーキテクチャとデプロイメントについてさらに学びたいと考えている開発者やシステム管理者を対象としています。 + +## 前提条件 +- データ収集に関する基本的な理解 +- コマンドラインとvim/viの経験 +- Ubuntu 20.04 LTSまたは22.04 LTSが稼働するインスタンス/ホスト/VM + - 最小要件はAWS/EC2 t2.micro(1 CPU、1GB RAM、8GBストレージ) + +## 学習目標 + +このセッションの終わりまでに、参加者は以下を行うことができるようになります: + +- OpenTelemetry のコンポーネントを理解する +- レシーバー、プロセッサー、エクスポーターを使用してデータを収集・分析する +- OpenTelemetry を使用する利点を特定する +- 自分たちのビジネスニーズに対応するカスタムコンポーネントを構築する + +## OpenTelemetry のアーキテクチャー + +{{< mermaid >}} +%%{ + init:{ + "theme":"base", + "themeVariables": { + "primaryColor": "#ffffff", + "clusterBkg": "#eff2fb", + "defaultLinkColor": "#333333" + } + } +}%% + +flowchart LR; + subgraph Collector + A[OTLP] --> M(Receivers) + B[JAEGER] --> M(Receivers) + C[Prometheus] --> M(Receivers) + end + subgraph Processors + M(Receivers) --> H(Filters, Attributes, etc) + E(Extensions) + end + subgraph Exporters + H(Filters, Attributes, etc) --> S(OTLP) + H(Filters, Attributes, etc) --> T(JAEGER) + H(Filters, Attributes, etc) --> U(Prometheus) + end +{{< /mermaid >}} diff --git a/content/ja/other/opentelemetry-collector/images/extensionz.png b/content/ja/other/opentelemetry-collector/images/extensionz.png new file mode 100644 index 0000000000..d543bed0a9 Binary files /dev/null and b/content/ja/other/opentelemetry-collector/images/extensionz.png differ diff --git a/content/ja/other/opentelemetry-collector/images/menu-dashboards.png b/content/ja/other/opentelemetry-collector/images/menu-dashboards.png new file mode 100644 index 0000000000..77b5d43775 Binary files /dev/null and b/content/ja/other/opentelemetry-collector/images/menu-dashboards.png differ diff --git a/content/ja/other/opentelemetry-collector/images/otel-charts.png b/content/ja/other/opentelemetry-collector/images/otel-charts.png new file mode 100644 index 0000000000..d956d99570 Binary files /dev/null and b/content/ja/other/opentelemetry-collector/images/otel-charts.png differ diff --git a/content/ja/other/opentelemetry-collector/images/otel-dashboard.png b/content/ja/other/opentelemetry-collector/images/otel-dashboard.png new file mode 100644 index 0000000000..fa9810e9d9 Binary files /dev/null and b/content/ja/other/opentelemetry-collector/images/otel-dashboard.png differ diff --git a/content/ja/other/opentelemetry-collector/images/pipelinez-full-config.png b/content/ja/other/opentelemetry-collector/images/pipelinez-full-config.png new file mode 100644 index 0000000000..c78e0bc9c7 Binary files /dev/null and b/content/ja/other/opentelemetry-collector/images/pipelinez-full-config.png differ diff --git a/content/ja/other/opentelemetry-collector/images/pipelinez.png b/content/ja/other/opentelemetry-collector/images/pipelinez.png new file mode 100644 index 0000000000..e68533f0ea Binary files /dev/null and b/content/ja/other/opentelemetry-collector/images/pipelinez.png differ diff --git a/content/ja/other/opentelemetry-collector/images/search-dashboards.png b/content/ja/other/opentelemetry-collector/images/search-dashboards.png new file mode 100644 index 0000000000..2bd56e0b7b Binary files /dev/null and b/content/ja/other/opentelemetry-collector/images/search-dashboards.png differ diff --git a/content/ja/other/opentelemetry-collector/images/search-filter.png b/content/ja/other/opentelemetry-collector/images/search-filter.png new file mode 100644 index 0000000000..38a718a884 Binary files /dev/null and b/content/ja/other/opentelemetry-collector/images/search-filter.png differ diff --git a/content/ja/other/opentelemetry-collector/images/select-participant-name.png b/content/ja/other/opentelemetry-collector/images/select-participant-name.png new file mode 100644 index 0000000000..9924208aa1 Binary files /dev/null and b/content/ja/other/opentelemetry-collector/images/select-participant-name.png differ diff --git a/content/ja/other/opentelemetry-collector/images/servicez.png b/content/ja/other/opentelemetry-collector/images/servicez.png new file mode 100644 index 0000000000..8cf28051d4 Binary files /dev/null and b/content/ja/other/opentelemetry-collector/images/servicez.png differ