mirror of
https://github.com/storytold/terraform-aws-observability-accelerator.git
synced 2026-10-09 00:09:43 +00:00
☕️ Port java collector
This commit is contained in:
@@ -1 +1,65 @@
|
||||
|
||||
locals {
|
||||
name = "adot-collector-java"
|
||||
namespace = try(var.helm_config.namespace, local.name)
|
||||
}
|
||||
|
||||
data "aws_partition" "current" {}
|
||||
|
||||
|
||||
module "helm_addon" {
|
||||
source = "github.com/aws-ia/terraform-aws-eks-blueprints/modules/kubernetes-addons/helm-addon"
|
||||
|
||||
|
||||
helm_config = merge(
|
||||
{
|
||||
name = local.name
|
||||
chart = "${path.module}/otel-config"
|
||||
version = "0.2.0"
|
||||
namespace = local.namespace
|
||||
description = "ADOT helm Chart deployment configuration"
|
||||
},
|
||||
var.helm_config
|
||||
)
|
||||
|
||||
set_values = [
|
||||
{
|
||||
name = "ampurl"
|
||||
value = "${var.amp_endpoint}api/v1/remote_write"
|
||||
},
|
||||
{
|
||||
name = "region"
|
||||
value = var.amp_region
|
||||
},
|
||||
{
|
||||
name = "prometheusMetricsEndpoint"
|
||||
value = "metrics"
|
||||
},
|
||||
{
|
||||
name = "prometheusMetricsPort"
|
||||
value = 8888
|
||||
},
|
||||
{
|
||||
name = "scrapeInterval"
|
||||
value = "15s"
|
||||
},
|
||||
{
|
||||
name = "scrapeTimeout"
|
||||
value = "10s"
|
||||
},
|
||||
{
|
||||
name = "scrapeSampleLimit"
|
||||
value = 1000
|
||||
}
|
||||
]
|
||||
|
||||
irsa_config = {
|
||||
create_kubernetes_namespace = try(var.helm_config["create_namespace"], true)
|
||||
kubernetes_namespace = local.namespace
|
||||
create_kubernetes_service_account = true
|
||||
kubernetes_service_account = try(var.helm_config.service_account, local.name)
|
||||
irsa_iam_policies = ["arn:${data.aws_partition.current.partition}:iam::aws:policy/AmazonPrometheusRemoteWriteAccess"]
|
||||
}
|
||||
|
||||
addon_context = var.addon_context
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: opentelemetry
|
||||
description: A Helm chart to install otel operator
|
||||
type: application
|
||||
version: 0.2.0
|
||||
appVersion: v0.1.0
|
||||
@@ -0,0 +1,29 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: otel-prometheus-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- nodes
|
||||
- nodes/proxy
|
||||
- services
|
||||
- endpoints
|
||||
- pods
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- extensions
|
||||
resources:
|
||||
- ingresses
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- nonResourceURLs:
|
||||
- /metrics
|
||||
verbs:
|
||||
- get
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: otel-prometheus-role-binding
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: otel-prometheus-role
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: adot-collector-java
|
||||
namespace: adot-collector-java
|
||||
@@ -0,0 +1,67 @@
|
||||
apiVersion: opentelemetry.io/v1alpha1
|
||||
kind: OpenTelemetryCollector
|
||||
metadata:
|
||||
name: adot
|
||||
spec:
|
||||
image: public.ecr.aws/aws-observability/aws-otel-collector:latest
|
||||
mode: deployment
|
||||
serviceAccount: adot-collector-java
|
||||
config: |
|
||||
receivers:
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: {{ .Values.scrapeInterval }}
|
||||
scrape_timeout: {{ .Values.scrapeTimeout }}
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'kubernetes-pod-jmx'
|
||||
sample_limit: {{ .Values.scrapeSampleLimit }}
|
||||
metrics_path: /{{ .Values.prometheusMetricsEndpoint }}
|
||||
kubernetes_sd_configs:
|
||||
- role: pod
|
||||
relabel_configs:
|
||||
- source_labels: [ __address__ ]
|
||||
action: keep
|
||||
regex: '.*:9404$'
|
||||
- action: labelmap
|
||||
regex: __meta_kubernetes_pod_label_(.+)
|
||||
- action: replace
|
||||
source_labels: [ __meta_kubernetes_namespace ]
|
||||
target_label: Namespace
|
||||
- source_labels: [ __meta_kubernetes_pod_name ]
|
||||
action: replace
|
||||
target_label: pod_name
|
||||
- action: replace
|
||||
source_labels: [ __meta_kubernetes_pod_container_name ]
|
||||
target_label: container_name
|
||||
- action: replace
|
||||
source_labels: [ __meta_kubernetes_pod_controller_kind ]
|
||||
target_label: pod_controller_kind
|
||||
- action: replace
|
||||
source_labels: [ __meta_kubernetes_pod_phase ]
|
||||
target_label: pod_controller_phase
|
||||
metric_relabel_configs:
|
||||
- source_labels: [ __name__ ]
|
||||
regex: 'jvm_gc_collection_seconds.*'
|
||||
action: drop
|
||||
exporters:
|
||||
awsprometheusremotewrite:
|
||||
endpoint: {{ .Values.ampurl }}
|
||||
aws_auth:
|
||||
region: {{ .Values.region }}
|
||||
service: "aps"
|
||||
logging:
|
||||
loglevel: info
|
||||
extensions:
|
||||
health_check:
|
||||
pprof:
|
||||
endpoint: :1888
|
||||
zpages:
|
||||
endpoint: :55679
|
||||
service:
|
||||
extensions: [pprof, zpages, health_check]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [prometheus]
|
||||
exporters: [logging, awsprometheusremotewrite]
|
||||
@@ -0,0 +1,7 @@
|
||||
ampurl: ${amp_url}
|
||||
region: ${region}
|
||||
prometheusMetricsEndpoint: ${prometheus_metrics_endpoint}
|
||||
prometheusMetricsPort: ${prometheus_metrics_port}
|
||||
scrapeInterval: ${scrape_interval}
|
||||
scrapeTimeout: ${scrape_timeout}
|
||||
scrapeSampleLimit: ${scrape_sample_limit}
|
||||
@@ -6,7 +6,7 @@ variable "java" {
|
||||
}
|
||||
|
||||
variable "amp_endpoint" {
|
||||
description = "Managed Prometheus endpoint"
|
||||
description = "Amazon Managed Prometheus endpoint"
|
||||
type = string
|
||||
}
|
||||
|
||||
@@ -14,3 +14,32 @@ variable "amp_id" {
|
||||
description = "Managed Prometheus workspace id"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "helm_config" {
|
||||
description = "Helm Config for Prometheus"
|
||||
type = any
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "amp_region" {
|
||||
description = "Amazon Managed Prometheus Workspace's Region"
|
||||
type = string
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "addon_context" {
|
||||
description = "Input configuration for the addon"
|
||||
type = object({
|
||||
aws_caller_identity_account_id = string
|
||||
aws_caller_identity_arn = string
|
||||
aws_eks_cluster_endpoint = string
|
||||
aws_partition_id = string
|
||||
aws_region_name = string
|
||||
eks_cluster_id = string
|
||||
eks_oidc_issuer_url = string
|
||||
eks_oidc_provider_arn = string
|
||||
irsa_iam_permissions_boundary = string
|
||||
irsa_iam_role_path = string
|
||||
tags = map(string)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user