Skip to content

Commit

Permalink
Merge pull request #71 from formancehq/feat/add_otel_on_agent
Browse files Browse the repository at this point in the history
feat: add otel on agent
  • Loading branch information
Dav-14 authored Nov 6, 2024
2 parents a1064ad + 3f020ea commit 41fe82a
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 55 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

| Readme | Chart Version | App Version | Description | Hub |
|--------|---------------|-------------|-------------|-----|
| [Agent](./charts/agent/README.md) | v2.1.0 |v2.0.18 | Formance Membership Agent Helm Chart | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/agent)](https://artifacthub.io/packages/search?repo=agent) |
| [Agent](./charts/agent/README.md) | v2.2.0 |v2.0.18 | Formance Membership Agent Helm Chart | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/agent)](https://artifacthub.io/packages/search?repo=agent) |
| [Cloudprem](./charts/cloudprem/README.md) | v2.0.0-beta.37 |v0.35.3 | Formance control-plane | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/cloudprem)](https://artifacthub.io/packages/search?repo=cloudprem) |
| [Console](./charts/console/README.md) | v1.0.0-beta.15 |fccc26c5b568781b86fbd06c651399c0edd67bac | Formance Console | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/console)](https://artifacthub.io/packages/search?repo=console) |
| [Core](./charts/core/README.md) | v1.0.0-beta.9 |latest | Formance Core Library | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/core)](https://artifacthub.io/packages/search?repo=core) |
| [Demo](./charts/demo/README.md) | 2.0.0 |latest | Formance Private Regions Demo | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/demo)](https://artifacthub.io/packages/search?repo=demo) |
| [Membership](./charts/membership/README.md) | v1.0.0-beta.23 |v0.35.3 | Formance Membership API. Manage stacks, organizations, regions, invitations, users, roles, and permissions. | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/membership)](https://artifacthub.io/packages/search?repo=membership) |
| [Portal](./charts/portal/README.md) | v1.0.0-beta.16 |191a441519a65dae56a5b2cf56fe64eee03fc059 | Formance Portal | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/portal)](https://artifacthub.io/packages/search?repo=portal) |
| [Regions](./charts/regions/README.md) | v2.2.0 |latest | Formance Private Regions Helm Chart | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/regions)](https://artifacthub.io/packages/search?repo=regions) |
| [Regions](./charts/regions/README.md) | v2.3.0 |latest | Formance Private Regions Helm Chart | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/regions)](https://artifacthub.io/packages/search?repo=regions) |
| [Stargate](./charts/stargate/README.md) | 0.5.8 |latest | Formance Stargate gRPC Gateway | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/stargate)](https://artifacthub.io/packages/search?repo=stargate) |

## How to contribute
Expand Down
6 changes: 6 additions & 0 deletions charts/agent/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: core
repository: file://../core
version: v1.0.0-beta.9
digest: sha256:01501d00afa1da80340e6a8c941695e4164b74520fc872cc3501054dbcd2c8c0
generated: "2024-11-05T23:19:34.812915+01:00"
7 changes: 6 additions & 1 deletion charts/agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ maintainers:
icon: "https://avatars.githubusercontent.com/u/84325077?s=200&v=4"

type: application
version: v2.1.0
version: v2.2.0

appVersion: "v2.0.18"

dependencies:
- name: core
version: "v1.0.0-beta.9"
repository: file://../core
4 changes: 4 additions & 0 deletions charts/agent/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ schema:

readme:
FROM charts+readme-base
WORKDIR /src/core
COPY --dir (core+dependencies/*) .
WORKDIR /src/agent
COPY --dir (+dependencies/*) .
DO --pass-args charts+README_GENERATOR
Expand All @@ -22,6 +24,8 @@ sources:

dependencies:
FROM +sources
WORKDIR /src/core
COPY --dir (core+dependencies/*) .
WORKDIR /src/agent
DO --pass-args charts+DEPENDENCIES

Expand Down
28 changes: 25 additions & 3 deletions charts/agent/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# agent

![Version: v2.1.0](https://img.shields.io/badge/Version-v2.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.0.18](https://img.shields.io/badge/AppVersion-v2.0.18-informational?style=flat-square)
![Version: v2.2.0](https://img.shields.io/badge/Version-v2.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.0.18](https://img.shields.io/badge/AppVersion-v2.0.18-informational?style=flat-square)

Formance Membership Agent Helm Chart

Expand All @@ -16,10 +16,34 @@ Formance Membership Agent Helm Chart

* <https://github.com/formancehq/agent>

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| file://../core | core | v1.0.0-beta.9 |

## Values

### Global configuration

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| global.monitoring.batch | bool | `false` | Enable otel batching |
| global.monitoring.logs.enabled | bool | `true` | Enable logging |
| global.monitoring.logs.format | string | `"json"` | Format |
| global.monitoring.logs.level | string | `"info"` | Level: Info, Debug, Error |
| global.monitoring.traces.enabled | bool | `false` | Enable otel tracing |
| global.monitoring.traces.endpoint | string | `""` | Endpoint |
| global.monitoring.traces.exporter | string | `"otlp"` | Exporter |
| global.monitoring.traces.insecure | bool | `true` | Insecure |
| global.monitoring.traces.mode | string | `"grpc"` | Mode |
| global.monitoring.traces.port | int | `4317` | Port |

### Other Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| global.serviceName | string | `"agent"` | TORework |
| affinity | object | `{}` | |
| agent.authentication.clientID | string | `""` | |
| agent.authentication.clientSecret | string | `""` | |
Expand All @@ -31,8 +55,6 @@ Formance Membership Agent Helm Chart
| config.monitoring.serviceName | string | `"agent"` | |
| debug | bool | `false` | |
| fullnameOverride | string | `""` | |
| global.monitoring.logs.format | string | `"json"` | |
| global.serviceName | string | `"agent"` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"ghcr.io/formancehq/agent"` | |
| image.tag | string | `""` | |
Expand Down
38 changes: 34 additions & 4 deletions charts/agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,39 @@ app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "agent.monitoring.logs" -}}
{{- if eq .Values.global.monitoring.logs.format "json" }}
- name: JSON_FORMATTING_LOGGER
value: "true"

{{- define "agent.env" -}}
- name: DEBUG
value: "{{.Values.debug}}"
- name: SERVER_ADDRESS
value: "{{.Values.server.address}}"
- name: TLS_ENABLED
value: "{{.Values.server.tls.enabled}}"
- name: TLS_INSECURE_SKIP_VERIFY
value: "{{.Values.server.tls.insecureSkipVerify}}"
- name: TLS_CA_CERT
value: "{{.Values.server.tls.ca}}"
- name: ID
value: "{{.Values.agent.id}}"
- name: TAG
value: "{{range $key, $value := .Values.agent.tags}}{{$key}}={{$value}} {{end}}"
- name: AUTHENTICATION_MODE
value: "{{ .Values.agent.authentication.mode }}"
{{- if eq .Values.agent.authentication.mode "token" }}
- name: AUTHENTICATION_TOKEN
value: "{{ .Values.agent.authentication.token }}"
{{- end }}
{{- if eq .Values.agent.authentication.mode "bearer" }}
- name: AUTHENTICATION_ISSUER
value: "{{ .Values.agent.authentication.issuer }}"
- name: AUTHENTICATION_CLIENT_ID
value: "{{ .Values.agent.authentication.clientID }}"
- name: AUTHENTICATION_CLIENT_SECRET
value: "{{ .Values.agent.authentication.clientSecret }}"
{{- end }}
- name: BASE_URL
value: "{{ .Values.agent.baseUrl }}"
- name: PRODUCTION
value: "{{ .Values.agent.production }}"
{{- include "core.monitoring" . }}
{{- end }}
34 changes: 1 addition & 33 deletions charts/agent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,7 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: DEBUG
value: "{{.Values.debug}}"
- name: SERVER_ADDRESS
value: "{{.Values.server.address}}"
- name: TLS_ENABLED
value: "{{.Values.server.tls.enabled}}"
- name: TLS_INSECURE_SKIP_VERIFY
value: "{{.Values.server.tls.insecureSkipVerify}}"
- name: TLS_CA_CERT
value: "{{.Values.server.tls.ca}}"
- name: ID
value: "{{.Values.agent.id}}"
- name: TAG
value: "{{range $key, $value := .Values.agent.tags}}{{$key}}={{$value}} {{end}}"
- name: AUTHENTICATION_MODE
value: "{{ .Values.agent.authentication.mode }}"
{{- if eq .Values.agent.authentication.mode "token" }}
- name: AUTHENTICATION_TOKEN
value: "{{ .Values.agent.authentication.token }}"
{{- end }}
{{- if eq .Values.agent.authentication.mode "bearer" }}
- name: AUTHENTICATION_ISSUER
value: "{{ .Values.agent.authentication.issuer }}"
- name: AUTHENTICATION_CLIENT_ID
value: "{{ .Values.agent.authentication.clientID }}"
- name: AUTHENTICATION_CLIENT_SECRET
value: "{{ .Values.agent.authentication.clientSecret }}"
{{- end }}
- name: BASE_URL
value: "{{ .Values.agent.baseUrl }}"
- name: PRODUCTION
value: "{{ .Values.agent.production }}"
{{- include "agent.monitoring.logs" . | nindent 12 }}
{{- include "agent.env" . | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down
32 changes: 32 additions & 0 deletions charts/agent/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,42 @@
"properties": {
"monitoring": {
"properties": {
"batch": {
"type": "boolean"
},
"logs": {
"properties": {
"enabled": {
"type": "boolean"
},
"format": {
"type": "string"
},
"level": {
"type": "string"
}
},
"type": "object"
},
"traces": {
"properties": {
"enabled": {
"type": "boolean"
},
"endpoint": {
"type": "string"
},
"exporter": {
"type": "string"
},
"insecure": {
"type": "boolean"
},
"mode": {
"type": "string"
},
"port": {
"type": "integer"
}
},
"type": "object"
Expand Down
36 changes: 33 additions & 3 deletions charts/agent/values.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
global:
# This is not a global value shared over all charts, but a global value shared over all templates in this chart.
# -- TORework
serviceName: agent

monitoring:
# -- Enable otel batching
# @section -- Global configuration
batch: false
traces:
# -- Enable otel tracing
# @section -- Global configuration
enabled: false
# -- Endpoint
# @section -- Global configuration
endpoint: ""
# -- Exporter
# @section -- Global configuration
exporter: "otlp"
# -- Insecure
# @section -- Global configuration
insecure: true
# -- Mode
# @section -- Global configuration
mode: "grpc"
# -- Port
# @section -- Global configuration
port: 4317
logs:
# format:Enum:{json, ""}
format: json
# -- Enable logging
# @section -- Global configuration
enabled: true
# -- Level: Info, Debug, Error
# @section -- Global configuration
level: "info"
# -- Format
# @section -- Global configuration
format: "json"

image:
repository: ghcr.io/formancehq/agent
Expand Down
6 changes: 3 additions & 3 deletions charts/regions/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dependencies:
- name: agent
repository: file://../agent
version: v2.1.0
version: v2.2.0
- name: operator
repository: oci://ghcr.io/formancehq/helm
version: v2.1.0
digest: sha256:6b6101765bc250bce08cb9b17ae4f3539e5a2386080024af6e088eca884d9d5d
generated: "2024-10-25T12:06:10.130490848Z"
digest: sha256:df2f73855644bc00cfa613be65643f3d0808933c6b963d2c25f29740bfa9cf35
generated: "2024-11-05T22:30:28.014102477Z"
4 changes: 2 additions & 2 deletions charts/regions/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ maintainers:
icon: "https://avatars.githubusercontent.com/u/84325077?s=200&v=4"

type: application
version: "v2.2.0"
version: "v2.3.0"
appVersion: "latest"

dependencies:
- name: agent
version: v2.1.0
version: v2.2.0
repository: "file://../agent"
condition: agent.enabled
- name: operator
Expand Down
24 changes: 20 additions & 4 deletions charts/regions/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# regions

![Version: v2.2.0](https://img.shields.io/badge/Version-v2.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)
![Version: v2.3.0](https://img.shields.io/badge/Version-v2.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)

Formance Private Regions Helm Chart

Expand All @@ -21,15 +21,31 @@ Formance Private Regions Helm Chart

| Repository | Name | Version |
|------------|------|---------|
| file://../agent | agent | v2.1.0 |
| file://../agent | agent | v2.2.0 |
| oci://ghcr.io/formancehq/helm | operator | v2.1.0 |

## Values

### Global configuration

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| global.monitoring.batch | bool | `false` | Enable otel batching |
| global.monitoring.logs.enabled | bool | `true` | Enable logging |
| global.monitoring.logs.format | string | `"json"` | Format |
| global.monitoring.logs.level | string | `"info"` | Level: Info, Debug, Error |
| global.monitoring.traces.enabled | bool | `false` | Enable otel tracing |
| global.monitoring.traces.endpoint | string | `""` | Endpoint |
| global.monitoring.traces.exporter | string | `"otlp"` | Exporter |
| global.monitoring.traces.insecure | bool | `true` | Insecure |
| global.monitoring.traces.mode | string | `"grpc"` | Mode |
| global.monitoring.traces.port | int | `4317` | Port |

### Other Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| global.monitoring.logs.format | string | `"json"` | |
| global.serviceName | string | `"agent"` | |
| global.serviceName | string | `"agent"` | TORework |
| agent.agent.authentication.clientID | string | `"REGION_ID"` | |
| agent.agent.authentication.clientSecret | string | `""` | |
| agent.agent.authentication.issuer | string | `"https://app.formance.cloud/api"` | |
Expand Down

0 comments on commit 41fe82a

Please sign in to comment.