Skip to content

Commit

Permalink
split otel operator from the chart
Browse files Browse the repository at this point in the history
  • Loading branch information
8naama committed Dec 3, 2024
1 parent 0ccf633 commit b792e28
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 284 deletions.
6 changes: 0 additions & 6 deletions charts/logzio-apm-collector/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ version: 1.0.0
description: Kubernetes APM agent for Logz.io based on OpenTelemetry Collector
type: application
home: https://logz.io/
dependencies:
- name: opentelemetry-operator
alias: otel-operator
version: ~0.74.2
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
condition: otel-operator.enabled
maintainers:
- name: Naama Bendalak
email: [email protected]
Expand Down
113 changes: 11 additions & 102 deletions charts/logzio-apm-collector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
> Kubernetes APM Collection Agent is still In development
This Helm chart deploys an agent, which leverages the OpenTelemetry Collector, that collects traces and span metrics from Kubernetes clusters and sends them to Logz.io.
It also allows enabling Service graph metrics and supports adding Auto instrumentation to the cluster applications via Opentelemetry Operator.


## Prerequisites
- Kubernetes 1.24+
Expand All @@ -23,15 +23,13 @@ The chart provides options for enabling the following:
1. Traces
2. SPM (Service Performance Monitoring)
3. Service Graph
4. OpenTelemetry Operator (Auto-instrumentation)


```shell
helm install -n monitoring --create-namespace \
--set enabled=true \
--set spm.enabled=true \
--set serviceGraph.enabled=true \
--set otel-operator.enabled=true \
--set secrets.logzioTracesToken="<<LOGZIO_TRACES_TOKEN>>" \
--set secrets.logzioSpmToken="<<LOGZIO_SPM_TOKEN>>" \
--set secrets.logzioRegion="<<LOGZIO_REGION_CODE>>" \
Expand All @@ -40,7 +38,7 @@ logzio-apm-collector logzio-helm/logzio-apm-collector
```

> [!NOTE]
> To disable either one of SPM, Service Graph or OpenTelemetry Operator, remove the relevant `--set XXX.enabled` line from the above command.
> To disable either one of SPM or Service Graph remove the relevant `--set XXX.enabled` line from the above command.
> [!IMPORTANT]
> Values of `<<LOGZIO_TRACES_TOKEN>>`, `<<LOGZIO_SPM_TOKEN>>` and `<<LOGZIO_REGION_CODE>>` can be found in your Logz.io account.
Expand All @@ -50,109 +48,15 @@ logzio-apm-collector logzio-helm/logzio-apm-collector
## Configuration

- [All configuration options](./VALUES.md)
- [Enable Auto-instrumentation](#enable-auto-instrumentation)
- [Multi-container pods](#multi-container-pods)
- [Customize Auto-instrumentation](#customize-auto-instrumentation)
- [Customize Propagator](#customize-propagator)
- [Add a custom Sampler](#add-a-custom-sampler)
- [Distribute namespaces](#distribute-namespaces)
- [TLS certificate Requirements](#tls-certificate-requirements)
- [Manual Instrumentation](#manual-instrumentation)
- [Instrumentation](#instrumentation)
- [Custom Trace Sampling rules](#custom-trace-sampling-rules)

## Enable Auto-instrumentation
- **Step 1:** Make sure to enable the OpenTelemetry operator in the chart:
```shell
--set otel-operator.enabled=true \
```

- **Step 2**: Add annotations to your relevant Kubernetes object (Deployment, StatefulSet, Namespace, Daemonset, or Pod)
```yaml
instrumentation.opentelemetry.io/inject-<APP_LANGUAGE>": "monitoring/logzio-apm-collector"
```
> [!TIP]
> `<APP_LANGUAGE>` can be one of `apache-httpd`, `dotnet`, `go`, `java`, `nginx`, `nodejs` or `python`.


### Multi-container pods
By default, in multi-container pods, instrumentation is performed on the first container available in the pod spec.
To fine tune which containers to instrument, add the below annotations to your pod:
```yaml
instrumentation.opentelemetry.io/inject-<APP_LANGUAGE>": "monitoring/logzio-apm-collector"
instrumentation.opentelemetry.io/<APP_LANGUAGE>-container-names: "myapp,myapp2"
instrumentation.opentelemetry.io/inject-<APP_LANGUAGE_2>": "monitoring/logzio-apm-collector"
instrumentation.opentelemetry.io/<APP_LANGUAGE_2>-container-names: "myapp3"
```

> [!TIP]
> `<APP_LANGUAGE>`, `<APP_LANGUAGE_2>` can be one of `apache-httpd`, `dotnet`, `go`, `java`, `nginx`, `nodejs` or `python`.


## Customize Auto-instrumentation
Below you can find multiple ways in which you can customize the OpenTelemetry Operator Auto-instrumentation.

### Customize Propagator
The propagator specifies how context is injected into and extracted from carriers for distributed tracing.
By default, the propagators `tracecontext` (W3C Trace Context) and `baggage` (W3C Correlation Context) are enabled.
You can customize this to include other formats ([full list here](https://opentelemetry.io/docs/languages/sdk-configuration/general/#otel_propagators)) or set it to "none" to disable automatic propagation.
```shell
--set instrumentation.propagator={tracecontext, baggage, b3}
```

### Add a custom Sampler
You can specify a sampler to be used by the instrumentor. You'll need to specify the below:
- Sampler used to sample the traces ([available options](https://opentelemetry.io/docs/languages/sdk-configuration/general/#otel_traces_sampler))
- Sampler arguments ([Sampler type expected input](https://opentelemetry.io/docs/languages/sdk-configuration/general/#otel_traces_sampler_arg))

Example:
```shell
--set instrumentation.sampler.type="parentbased_always_on" \
--set instrumentation.sampler.argument="0.25"
```

### Distribute namespaces
For intensive applications, to reduce the performance impact of the operator, you can define multiple namespaces to deploy the instrumentor resource at, which can help distribute the load in larger clusters.
To do so, specify which namespaces to deploy the instrumentor at:
```shell
--set includeNamespaces="ns1,ns2,ns3"
```

For resources in the namespaces where you configured the instrumentation, you need to add annotation in this format:
```yaml
instrumentation.opentelemetry.io/inject-<APP_LANGUAGE>": "true"
```

> [!TIP]
> `<APP_LANGUAGE>` can be one of `apache-httpd`, `dotnet`, `go`, `java`, `nginx`, `nodejs` or `python`.

### TLS certificate Requirements
Openteleemtry operator requires a TLS certificate. For more details, refer to [OpenTelemetry documentation](https://github.com/open-telemetry/opentelemetry-helm-charts/tree/main/charts/opentelemetry-operator#tls-certificate-requirement).

There are 3 TLS certificate options, by default this chart is using option 2.

1. If you have `cert-manager` installed on your cluster, you can set `otel-operator.admissionWebhooks.certManager.enabled` to true and the cert-manager will generate a self-signed certificate for the otel-operator automatically.
## Instrumentation
If you're using manual instrumentation or an instrumentation agent, configure it to export data to the Logz.io APM collector by setting the export/output address as follows:

```shell
--set otel-operator.admissionWebhooks.certManager.enabled=true \
```

2. Helm will automatically create a self-signed cert and secret for you. (Enabled by default by this chart)

3. Use your own self-signed certificate, To enable this option, set `otel-operator.admissionWebhooks.autoGenerateCert.enabled` to `false` and provide the necessary `certFile`, `keyFile` and `caFile`.

```shell
--set otel-operator.admissionWebhooks.autoGenerateCert.enabled=false \
--set otel-operator.admissionWebhooks.certFile="<<PEM_CERT_PATH>>" \
--set otel-operator.admissionWebhooks.keyFile="<<PEM_KEY_PATH>>" \
--set otel-operator.admissionWebhooks.caFile="<<CA_CERT_PATH>>" \
```

## Manual Instrumentation
If you're using manual instrumentation or a custom instrumentation agent, configure it to export data to the Logz.io APM collector by setting the export/output address as follows:

```
logzio-monitoring-otel-collector.monitoring.svc.cluster.local:<<PORT>>
logzio-apm-collector.monitoring.svc.cluster.local:<<PORT>>
```

> [!IMPORTANT]
Expand All @@ -162,6 +66,11 @@ logzio-monitoring-otel-collector.monitoring.svc.cluster.local:<<PORT>>
>
> For a complete list, see `values.yaml` >> `traceConfig` >> `receivers`.
> [!WARNING]
> If you're deploying the chart as a sub chart of the `logzio-monitoring` chart, replace:
> `logzio-apm-collector` >> `logzio-monitoring-otel-collector`

## Custom trace sampling rules
To customize the Traces Sampling rules in the OpenTelemetry Collector, you can follow the below steps:

Expand Down
18 changes: 0 additions & 18 deletions charts/logzio-apm-collector/VALUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,6 @@ Below you can find a complete list of settings in `values.yaml`.
| enabled | Toggle for enabling the Helm chart deployment | `false` |
| spm.enabled | Toggle for enabling SPM Collection | `false` |
| serviceGraph.enabled | Toggle for enabling Service Graph metrics Collection | `false` |
| otel-operator.enabled | Toggle for enabling Auto instrumentation with [OpenTelemetry Operator](https://github.com/open-telemetry/opentelemetry-operator) | `false` |
| otel-operator.admissionWebhooks.certManager.enabled | If you have cert-manager installed on your cluster, set to true and the cert-manager will generate a self-signed certificate for the otel-operator | `false` |
| otel-operator.admissionWebhooks.certManager.issuerRef | Provide the issuer kind and name to do the cert auth job. By default, OpenTelemetry Operator will use self-signer issuer. | `{}` |
| otel-operator.admissionWebhooks.certManager.kind | Provide the issuer kind and name to do the cert auth job. By default, OpenTelemetry Operator will use self-signer issuer. | `""` |
| otel-operator.admissionWebhooks.certManager.name | Provide the issuer kind and name to do the cert auth job. By default, OpenTelemetry Operator will use self-signer issuer. | `""` |
| otel-operator.admissionWebhooks.certManager.certificateAnnotations | Annotations for the certificate if cert-manager is enabled. | `{}` |
| otel-operator.admissionWebhooks.certManager.issuerAnnotations | Annotations for the issuer if cert-manager is enabled. | `{}` |
| otel-operator.admissionWebhooks.certManager.duration | `duration` must be specified by a Go time.Duration. | `""` |
| otel-operator.admissionWebhooks.certManager.renewBefore | `renewBefore` must be specified by a Go time.Duration. | `""` |
| otel-operator.admissionWebhooks.autoGenerateCert.enabled | If you have Helm will automatically create a self-signed certificate and secret for you. | `true` |
| otel-operator.admissionWebhooks.autoGenerateCert.recreate | If set to true, new webhook key/certificate is generated on helm upgrade. | `true` |
| otel-operator.admissionWebhooks.autoGenerateCert.certPeriodDays | Automatically generated certificate period time in days. | `365` |
| otel-operator.admissionWebhooks.certFile | To use your own self-signed certificate, add path to your own PEM-encoded certificate. | `""` |
| otel-operator.admissionWebhooks.keyFile | To use your own self-signed certificate, add path to your own PEM-encoded private key. | `""` |
| otel-operator.admissionWebhooks.caFile | To use your own self-signed certificate, add path to your own CA certificate. | `""` |
| nameOverride | Override the default name for the deployment. | `""` |
| fullnameOverride | Override the default name for the deployment. | `""` |
| namespaceOverride | Override the namespace into which the resources will be deployed. | `""` |
Expand All @@ -46,9 +31,6 @@ Below you can find a complete list of settings in `values.yaml`.
| imagePullSecrets | Specifies image pull secrets. | `[]` |
| command.name | OpenTelemetry Collector executable. | `"otelcol-contrib"` |
| command.extraArgs | Additional arguments for the command. | `[]` |
| instrumentation.includeNamespaces | Specifies namespaces to deploy the instrumentor resource at. By default, it's created only at the chart's other resources namespace. | `""` |
| instrumentation.propagators | Choose propagator to specify the method of injecting and extracting context from carriers. | `[tracecontext, baggage]` |
| instrumentation.sampler | Specifies the Sampler used to sample traces by the SDK. | `{}` |
| configMap.create | Specifies whether a configMap should be created. | `true` |
| serviceAccount.create | Specifies whether a service account should be created. | `true` |
| serviceAccount.annotations | Specifies annotations for the service account. | `{}` |
Expand Down
6 changes: 0 additions & 6 deletions charts/logzio-apm-collector/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,3 @@ Get secret value either from the global section (parent chart is running) or the
{{- $fallback -}}
{{- end -}}
{{- end -}}

{{/* Helm hooks annotations for otel operator */}}
{{- define "apm-collector.otelOpAnnotations" -}}
helm.sh/hook: "post-install, post-upgrade"
helm.sh/hook-delete-policy: "before-hook-creation, hook-succeeded"
{{- end -}}
48 changes: 0 additions & 48 deletions charts/logzio-apm-collector/templates/instrumentation.yaml

This file was deleted.

Loading

0 comments on commit b792e28

Please sign in to comment.