Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC][DO NOT MERGE] JMX Receiver POC #5242

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ stages:
- manaul-jobs
- build
- push
- kafka-poc-deploy
- staging-deploy
- prod-deploy

Expand Down Expand Up @@ -81,6 +82,22 @@ build-ci-image:
# # For debugging
# - aws sts get-caller-identity
- bash $SCRIPT $NAMESPACE $VALUES
kafka-poc-deploy:
stage: kafka-poc-deploy
tags: ["runner:docker", "size:large"]
image: $CI_IMAGE
dependencies:
- push-image-staging
rules:
- if: '$CI_COMMIT_REF_NAME =~ /-kafka-poc$/'
script:
- >-
TEMP_AWS_ACCESS_KEY_ID=$(aws ssm get-parameter --region us-east-1 --name ci.opentelemetry-collector-contrib.sand-eks-deploy-api-key --with-decryption --query Parameter.Value --out text)
- >-
TEMP_AWS_SECRET_ACCESS_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.opentelemetry-collector-contrib.sand-eks-deploy-access-key --with-decryption --query Parameter.Value --out text)
- export AWS_ACCESS_KEY_ID=$TEMP_AWS_ACCESS_KEY_ID
- export AWS_SECRET_ACCESS_KEY=$TEMP_AWS_SECRET_ACCESS_KEY
- bash ./ci/scripts/kafka-poc.sh
staging-deploy-demo-eks:
!!merge <<: *staging-deploy
variables:
Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN clean-apt install make \
RUN apt-get update && \
apt-get -y install default-jre-headless

ADD https://github.com/open-telemetry/opentelemetry-java-contrib/releases/download/v1.27.0/opentelemetry-jmx-metrics.jar /opt/opentelemetry-jmx-metrics.jar
ADD ./ci/opentelemetry-jmx-metrics-1.33.0-alpha-SNAPSHOT.jar /opt/opentelemetry-jmx-metrics.jar

COPY --from=build /src/bin/otelcontribcol_* /otelcol-contrib
USER 1001
Expand Down
Binary file not shown.
49 changes: 49 additions & 0 deletions ci/scripts/kafka-poc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

# This script is used to deploy collector on demo account cluster

set -euo pipefail
IFS=$'\n\t'
set -x

install_collector() {
release_name="opentelemetry-collector"

# if repo already exists, helm 3+ will skip
helm --debug repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo update open-telemetry
# --install will run `helm install` if not already present.
helm --debug upgrade "${release_name}" -n "kafka-poc" open-telemetry/opentelemetry-collector --install \
-f ./ci/values.yaml \
-f "./ci/values-kafka-poc.yaml" \
--set-string image.tag="otelcolcontrib-v$CI_COMMIT_SHORT_SHA" \
--set-string image.repository="601427279990.dkr.ecr.us-east-1.amazonaws.com/otel-collector-contrib"
helm list --all-namespaces

install_deployment
}

install_deployment() {
release_name_deployment="opentelemetry-collector-deployment"

# --install collector that fetches jmx metrics. The jmx receiver cannot be used in the daemonset deployment
# as this would lead to duplicate metrics.
helm --debug upgrade "${release_name_deployment}" -n "kafka-poc" open-telemetry/opentelemetry-collector --install \
-f ./ci/values-jmx.yaml \
--set-string image.tag="otelcolcontrib-v$CI_COMMIT_SHORT_SHA" \
--set-string image.repository="601427279990.dkr.ecr.us-east-1.amazonaws.com/otel-collector-contrib" \
--set nodeSelector.alpha\\.eksctl\\.io/nodegroup-name=kafka-poc-ng

}

###########################################################################################################
clusterName="dd-otel"
clusterArn="arn:aws:eks:us-east-1:601427279990:cluster/${clusterName}"

aws eks --region us-east-1 update-kubeconfig --name "${clusterName}"
kubectl config use-context "${clusterArn}"

install_collector
2 changes: 1 addition & 1 deletion ci/values-jmx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extraEnvs:
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://$(OTEL_COLLECTOR_NAME):4317
- name: OTEL_RESOURCE_ATTRIBUTES
value: kafka_source=deploymentcol
value: kafka_source=otelcol
config:
receivers:
jmx:
Expand Down
6 changes: 6 additions & 0 deletions ci/values-kafka-poc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
nodeSelector:
alpha.eksctl.io/nodegroup-name: kafka-poc-ng
clusterRole:
name: "opentelemetry-collector-kafka"
clusterRoleBinding:
name: opentelemetry-collector-kafka
41 changes: 30 additions & 11 deletions ci/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,27 +90,46 @@ config:
attributes:
actions:
- key: log.file.path
pattern: \/var\/log\/pods\/otel_opentelemetry-demo-(?P<service_name>.*?)-.*
pattern: \/var\/log\/pods\/${env:OTEL_K8S_NAMESPACE}_opentelemetry-demo-(?P<service_name>.*?)-.*
action: extract
- key: log.file.path
pattern: \/var\/log\/pods\/otel_opentelemetry-demo-(?P<source>.*?)-.*
pattern: \/var\/log\/pods\/${env:OTEL_K8S_NAMESPACE}_opentelemetry-demo-(?P<source>.*?)-.*
action: extract
- key: service
from_attribute: service_name
action: upsert
attributes/kafkasrc:
include:
match_type: regexp
match_type: strict
attributes:
- {key: "source", value: 'kafka|frauddetectionservice|orderproducer'}
- key: "source"
value: 'kafka'
actions:
# this makes sure the source for logs that come from kafka|frauddetectionservice|orderproducer is
# set to kafka. The OOTB box kafka dashboard filters logs on source:kafka. This will still not work
# as it will be a log attribute and can only be searched by @source:kafka. We would need to support
# attributes_as_tags or find another solution for this to work.
- key: source
action: update
value: "kafka"
# set to kafka. The OOTB box kafka dashboard filters logs on source:kafka.
- key: ddtags
action: upsert
value: "source:kafka"
attributes/producer:
include:
match_type: strict
attributes:
- key: "source"
value: 'orderproducer'
actions:
- key: ddtags
action: upsert
value: "source:kafka"
attributes/consumer:
include:
match_type: strict
attributes:
- key: "source"
value: 'frauddetectionservice'
actions:
- key: ddtags
action: upsert
value: "source:kafka"
memory_limiter:
check_interval: 1s
limit_mib: 500
Expand Down Expand Up @@ -192,5 +211,5 @@ config:
processors: [resourcedetection, k8sattributes, batch]
exporters: [datadog]
logs:
processors: [memory_limiter, resourcedetection, k8sattributes, attributes, attributes/kafkasrc, batch]
processors: [memory_limiter, resourcedetection, k8sattributes, batch, attributes, attributes/kafkasrc, attributes/producer, attributes/consumer]
exporters: [datadog]
5 changes: 3 additions & 2 deletions cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,9 @@ require (
github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.8.1 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.8.3 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/logs v0.8.3 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.8.1 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.8.1 // indirect
// https://github.com/DataDog/opentelemetry-mapping-go/pull/217
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.8.4-0.20231214134201-f0bd121d625d // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.8.3 // indirect
github.com/DataDog/sketches-go v1.4.3 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 // indirect
Expand Down
10 changes: 5 additions & 5 deletions cmd/otelcontribcol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions receiver/jmxreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ func (c *Config) validateJar(supportedJarDetails map[string]supportedJar, jar st
return fmt.Errorf("error hashing file: %w", err)
}

// Skip hash validation for POC.
return nil

jarDetails, ok := supportedJarDetails[hash]
if !ok {
return errors.New("jar hash does not match known versions")
Expand Down