sigs.k8s.io/cluster-api-provider-azure@v1.14.3/hack/observability/opentelemetry/chart/README.md (about)

     1  # OpenTelemetry Collector Helm Chart
     2  
     3  The helm chart installs [OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector)
     4  in kubernetes cluster.
     5  
     6  ## Prerequisites
     7  
     8  - Helm 3.0+
     9  
    10  ## Installing the Chart
    11  
    12  Add OpenTelemetry Helm repository:
    13  
    14  ```console
    15  helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
    16  ```
    17  
    18  To install the chart with the release name my-opentelemetry-collector, run the following command:
    19  
    20  ```console
    21  helm install my-opentelemetry-collector open-telemetry/opentelemetry-collector
    22  ```
    23  
    24  ## Configuration
    25  
    26  ### Default configuration
    27  
    28  By default this chart will deploy an OpenTelemetry Collector as daemonset with three pipelines (logs, metrics and traces)
    29  and logging exporter enabled by default. Besides daemonset (agent), it can be also installed as standalone deployment.
    30  Both modes can be enabled together, in that case logs, metrics and traces will be flowing from agents to standalone collectors.
    31  
    32  *Example*: Install collector as a standalone deployment, and do not run it as an agent.
    33  
    34  ```yaml
    35  agentCollector:
    36    enabled: false
    37  standaloneCollector:
    38    enabled: true
    39  ```
    40  
    41  By default collector has the following receivers enabled:
    42  
    43  - **metrics**: OTLP and prometheus. Prometheus is configured only for scraping collector's own metrics.
    44  - **traces**: OTLP, zipkin and jaeger (thrift and grpc).
    45  - **logs**: OTLP (to enable container logs, see [Configuration for Kubernetes container logs](#configuration-for-kubernetes-container-logs)).
    46  
    47  There are two ways to configure collector pipelines, which can be used together as well.
    48  
    49  ### Basic top level configuration
    50  
    51  *Example*: Disable metrics pipeline and send traces to zipkin exporter:
    52  
    53  ```yaml
    54  config:
    55    exporters:
    56      zipkin:
    57        endpoint: zipkin-all-in-one:14250
    58    service:
    59      pipelines:
    60        metrics: null
    61        traces:
    62          exporters:
    63            - zipkin
    64  ```
    65  
    66  ### Configuration with `agentCollector` and `standaloneCollector` properties
    67  
    68  `agentCollector` and `standaloneCollector` properties allow to override collector configurations
    69  and default parameters applied on the k8s pods.
    70  
    71  `agentCollector(standaloneCollector).configOverride` property allows to provide an extra
    72  configuration that will be merged into the default configuration.
    73  
    74  *Example*: Enable host metrics receiver on the agents:
    75  
    76  ```yaml
    77  agentCollector:
    78    configOverride:
    79      receivers:
    80        hostmetrics:
    81          scrapers:
    82            cpu:
    83            load:
    84            memory:
    85            disk:
    86      service:
    87        pipelines:
    88          metrics:
    89            receivers: [prometheus, hostmetrics]
    90    extraEnvs:
    91    - name: HOST_PROC
    92      value: /hostfs/proc
    93    - name: HOST_SYS
    94      value: /hostfs/sys
    95    - name: HOST_ETC
    96      value: /hostfs/etc
    97    - name: HOST_VAR
    98      value: /hostfs/var
    99    - name: HOST_RUN
   100      value: /hostfs/run
   101    - name: HOST_DEV
   102      value: /hostfs/dev
   103    extraHostPathMounts:
   104    - name: hostfs
   105      hostPath: /
   106      mountPath: /hostfs
   107      readOnly: true
   108      mountPropagation: HostToContainer
   109  ```
   110  
   111  ### Configuration for Kubernetes container logs
   112  
   113  The collector can be used to collect logs sent to standard output by Kubernetes containers.
   114  This feature is disabled by default. It has the following requirements:
   115  
   116  - It needs agent collector to be deployed, which means it will not work if only standalone collector is enabled.
   117  - It requires the [contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib) version
   118  of the collector image.
   119  
   120  To enable this feature, set the  `agentCollector.containerLogs.enabled` property to `true` and replace the collector image.
   121  Here is an example `values.yaml`:
   122  
   123  ```yaml
   124  agentCollector:
   125    containerLogs:
   126      enabled: true
   127  
   128  image:
   129    repository: otel/opentelemetry-collector-contrib
   130  
   131  command:
   132    name: otelcol-contrib
   133  ```
   134  
   135  The way this feature works is it adds a `filelog` receiver on the `logs` pipeline. This receiver is preconfigured
   136  to read the files where Kubernetes container runtime writes all containers' console output to.
   137  
   138  #### :warning: Warning: Risk of looping the exported logs back into the receiver, causing "log explosion"
   139  
   140  The container logs pipeline uses the `logging` console exporter by default.
   141  Paired with the default `filelog` receiver that receives all containers' console output,
   142  it is easy to accidentally feed the exported logs back into the receiver.
   143  
   144  Also note that using the `--log-level=debug` option for the `logging` exporter causes it to output
   145  multiple lines per single received log, which when looped, would amplify the logs exponentially.
   146  
   147  To prevent the looping, the default configuration of the receiver excludes logs from the collector's containers.
   148  
   149  If you want to include the collector's logs, make sure to replace the `logging` exporter
   150  with an exporter that does not send logs to collector's standard output.
   151  
   152  Here's an example `values.yaml` file that replaces the default `logging` exporter on the `logs` pipeline
   153  with an `otlphttp` exporter that sends the container logs to `https://example.com:55681` endpoint.
   154  It also clears the `filelog` receiver's `exclude` property, for collector logs to be included in the pipeline.
   155  
   156  ```yaml
   157  agentCollector:
   158    containerLogs:
   159      enabled: true
   160  
   161    configOverride:
   162      exporters:
   163        otlphttp:
   164          endpoint: https://example.com:55681
   165      receivers:
   166        filelog:
   167          exclude: []
   168      service:
   169        pipelines:
   170          logs:
   171            exporters:
   172              - otlphttp
   173  
   174  image:
   175    repository: otel/opentelemetry-collector-contrib
   176  
   177  command:
   178    name: otelcol-contrib
   179  ```
   180  
   181  ### Other configuration options
   182  
   183  The [values.yaml](./values.yaml) file contains information about all other configuration
   184  options for this chart.