From 3a6805e9ec1ac5a89368a9cb29d54824de86f8f8 Mon Sep 17 00:00:00 2001 From: ga-ram Date: Mon, 25 Jul 2022 17:48:31 +0900 Subject: [PATCH] [#134] Add profiling sample configurations for agents --- .env | 6 ++++- docker-compose.yml | 6 ++++- pinpoint-agent-attach-example/java/.env | 19 +++++++++++++-- pinpoint-agent/.env | 24 +++++++++++++++++-- .../build/scripts/configure-agent.sh | 6 ++++- pinpoint-agent/docker-compose.yml | 6 ++++- pinpoint-quickstart/.env | 8 +++++-- pinpoint-quickstart/docker-compose.yml | 6 ++++- 8 files changed, 70 insertions(+), 11 deletions(-) diff --git a/.env b/.env index 88771d6..b137103 100644 --- a/.env +++ b/.env @@ -136,7 +136,11 @@ COLLECTOR_STAT_PORT=9995 COLLECTOR_SPAN_PORT=9996 # Set sampling rate. If you set it to N, 1 out of N transaction will be sampled. -PROFILER_SAMPLING_RATE=1 +PROFILER_SAMPLING_TYPE=COUNTING +PROFILER_SAMPLING_COUNTING_SAMPLING_RATE=20 +PROFILER_SAMPLING_PERCENT_SAMPLING_RATE=5 +PROFILER_SAMPLING_NEW_THROUGHPUT=0 +PROFILER_SAMPLING_CONTINUE_THROUGHPUT=0 AGENT_ID=app-in-docker APP_NAME=quickapp diff --git a/docker-compose.yml b/docker-compose.yml index ca73946..23505da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -238,7 +238,11 @@ services: - PROFILER_TRANSPORT_METADATA_COLLECTOR_PORT=${PROFILER_TRANSPORT_METADATA_COLLECTOR_PORT} - PROFILER_TRANSPORT_STAT_COLLECTOR_PORT=${PROFILER_TRANSPORT_STAT_COLLECTOR_PORT} - PROFILER_TRANSPORT_SPAN_COLLECTOR_PORT=${PROFILER_TRANSPORT_SPAN_COLLECTOR_PORT} - - PROFILER_SAMPLING_RATE=${PROFILER_SAMPLING_RATE} + - PROFILER_SAMPLING_TYPE=${PROFILER_SAMPLING_TYPE} + - PROFILER_SAMPLING_COUNTING_SAMPLING_RATE=${PROFILER_SAMPLING_COUNTING_SAMPLING_RATE} + - PROFILER_SAMPLING_PERCENT_SAMPLING_RATE=${PROFILER_SAMPLING_PERCENT_SAMPLING_RATE} + - PROFILER_SAMPLING_NEW_THROUGHPUT=${PROFILER_SAMPLING_NEW_THROUGHPUT} + - PROFILER_SAMPLING_CONTINUE_THROUGHPUT=${PROFILER_SAMPLING_CONTINUE_THROUGHPUT} - DEBUG_LEVEL=${AGENT_DEBUG_LEVEL} - PROFILER_TRANSPORT_MODULE=${PROFILER_TRANSPORT_MODULE} depends_on: diff --git a/pinpoint-agent-attach-example/java/.env b/pinpoint-agent-attach-example/java/.env index 2841815..5d121a4 100644 --- a/pinpoint-agent-attach-example/java/.env +++ b/pinpoint-agent-attach-example/java/.env @@ -1,5 +1,20 @@ ### Pinpoint with Java PINPOINT_VERSION=2.4.0 SPRING_PROFILES=release -AGENT_ID=app-in-docker -APP_NAME=quickapp \ No newline at end of file +AGENT_ID=java-app-in-docker +APP_NAME=JavaAttachExample + + +#collector information required +COLLECTOR_IP= +PROFILER_TRANSPORT_AGENT_COLLECTOR_PORT=9991 +PROFILER_TRANSPORT_METADATA_COLLECTOR_PORT=9991 +PROFILER_TRANSPORT_STAT_COLLECTOR_PORT=9992 +PROFILER_TRANSPORT_SPAN_COLLECTOR_PORT=9993 + +# Sampling configurations +PROFILER_SAMPLING_TYPE=COUNTING +PROFILER_SAMPLING_COUNTING_SAMPLING_RATE=20 +PROFILER_SAMPLING_PERCENT_SAMPLING_RATE=5 +PROFILER_SAMPLING_NEW_THROUGHPUT=0 +PROFILER_SAMPLING_CONTINUE_THROUGHPUT=0 diff --git a/pinpoint-agent/.env b/pinpoint-agent/.env index 99cfb70..e65b103 100644 --- a/pinpoint-agent/.env +++ b/pinpoint-agent/.env @@ -18,8 +18,28 @@ COLLECTOR_TCP_PORT=9994 COLLECTOR_STAT_PORT=9995 COLLECTOR_SPAN_PORT=9996 -# Set sampling rate. If you set it to N, 1 out of N transaction will be sampled. -PROFILER_SAMPLING_RATE=1 +# Profiler Sampling Configurations +# If this value set to COUNTING(default), sampling rate is 1/n. +# If this value set to PERCENT, sampling rate is n%. +PROFILER_SAMPLING_TYPE=COUNTING + +# depend on profiler.samplging.rate.type, + +# if it's COUNTING(the default), then 1 out of n transactions will be sampled where n is the rate. +# eg. 1: 100% 20: 5% 50: 2% 100: 1% +PROFILER_SAMPLING_COUNTING_SAMPLING_RATE=20 + +# if it's PERCENT, then first x transactions out of y transactions will be sampled. +# Support from 100% to 0.01% +# eg. 100: 100% 50: 50% 5: 5% 0.01: 0.01% +PROFILER_SAMPLING_PERCENT_SAMPLING_RATE=5 + +# Permits per second, if throughput is 0, it is unlimited. +# "New" is a transaction that is newly traced. +PROFILER_SAMPLING_NEW_THROUGHPUT=0 +# "Continue" is a transaction that is already being tracked. +PROFILER_SAMPLING_CONTINUE_THROUGHPUT=0 + AGENT_ID=app-in-docker APP_NAME=quickapp diff --git a/pinpoint-agent/build/scripts/configure-agent.sh b/pinpoint-agent/build/scripts/configure-agent.sh index f2429f8..4a6ac1d 100644 --- a/pinpoint-agent/build/scripts/configure-agent.sh +++ b/pinpoint-agent/build/scripts/configure-agent.sh @@ -16,7 +16,11 @@ sed -i "/profiler.transport.grpc.agent.collector.port=/ s/=.*/=${PROFILER_TRANSP sed -i "/profiler.transport.grpc.metadata.collector.port=/ s/=.*/=${PROFILER_TRANSPORT_METADATA_COLLECTOR_PORT}/" /pinpoint-agent/pinpoint-root.config sed -i "/profiler.transport.grpc.stat.collector.port=/ s/=.*/=${PROFILER_TRANSPORT_STAT_COLLECTOR_PORT}/" /pinpoint-agent/pinpoint-root.config sed -i "/profiler.transport.grpc.span.collector.port=/ s/=.*/=${PROFILER_TRANSPORT_SPAN_COLLECTOR_PORT}/" /pinpoint-agent/pinpoint-root.config -sed -i "/profiler.sampling.rate=/ s/=.*/=${PROFILER_SAMPLING_RATE}/" /pinpoint-agent/profiles/${SPRING_PROFILES}/pinpoint.config +sed -i "/profiler.sampling.type=/ s/=.*/=${PROFILER_SAMPLING_TYPE}/" /pinpoint-agent/profiles/${SPRING_PROFILES}/pinpoint.config +sed -i "/profiler.sampling.counting.sampling-rate=/ s/=.*/=${PROFILER_SAMPLING_COUNTING_SAMPLING_RATE}/" /pinpoint-agent/profiles/${SPRING_PROFILES}/pinpoint.config +sed -i "/profiler.sampling.percent.sampling-rate=/ s/=.*/=${PROFILER_SAMPLING_PERCENT_SAMPLING_RATE}/" /pinpoint-agent/profiles/${SPRING_PROFILES}/pinpoint.config +sed -i "/profiler.sampling.new.throughput=/ s/=.*/=${PROFILER_SAMPLING_NEW_THROUGHPUT}/" /pinpoint-agent/profiles/${SPRING_PROFILES}/pinpoint.config +sed -i "/profiler.sampling.continue.throughput=/ s/=.*/=${PROFILER_SAMPLING_CONTINUE_THROUGHPUT}/" /pinpoint-agent/profiles/${SPRING_PROFILES}/pinpoint.config sed -i "/Root level=/ s/=.*/=\"${DEBUG_LEVEL}\">/g" /pinpoint-agent/profiles/${SPRING_PROFILES}/log4j2.xml diff --git a/pinpoint-agent/docker-compose.yml b/pinpoint-agent/docker-compose.yml index 5aca8fd..c24529e 100644 --- a/pinpoint-agent/docker-compose.yml +++ b/pinpoint-agent/docker-compose.yml @@ -22,7 +22,11 @@ services: - PROFILER_TRANSPORT_METADATA_COLLECTOR_PORT=${PROFILER_TRANSPORT_METADATA_COLLECTOR_PORT} - PROFILER_TRANSPORT_STAT_COLLECTOR_PORT=${PROFILER_TRANSPORT_STAT_COLLECTOR_PORT} - PROFILER_TRANSPORT_SPAN_COLLECTOR_PORT=${PROFILER_TRANSPORT_SPAN_COLLECTOR_PORT} - - PROFILER_SAMPLING_RATE=${PROFILER_SAMPLING_RATE} + - PROFILER_SAMPLING_TYPE=${PROFILER_SAMPLING_TYPE} + - PROFILER_SAMPLING_COUNTING_SAMPLING_RATE=${PROFILER_SAMPLING_COUNTING_SAMPLING_RATE} + - PROFILER_SAMPLING_PERCENT_SAMPLING_RATE=${PROFILER_SAMPLING_PERCENT_SAMPLING_RATE} + - PROFILER_SAMPLING_NEW_THROUGHPUT=${PROFILER_SAMPLING_NEW_THROUGHPUT} + - PROFILER_SAMPLING_CONTINUE_THROUGHPUT=${PROFILER_SAMPLING_CONTINUE_THROUGHPUT} - DEBUG_LEVEL=${AGENT_DEBUG_LEVEL} - PROFILER_TRANSPORT_MODULE=${PROFILER_TRANSPORT_MODULE} networks: diff --git a/pinpoint-quickstart/.env b/pinpoint-quickstart/.env index cddf340..06d2775 100644 --- a/pinpoint-quickstart/.env +++ b/pinpoint-quickstart/.env @@ -12,8 +12,12 @@ PROFILER_TRANSPORT_METADATA_COLLECTOR_PORT=9991 PROFILER_TRANSPORT_STAT_COLLECTOR_PORT=9992 PROFILER_TRANSPORT_SPAN_COLLECTOR_PORT=9993 -# Set sampling rate. If you set it to N, 1 out of N transaction will be sampled. -PROFILER_SAMPLING_RATE=1 +# Sampling Configurations +PROFILER_SAMPLING_TYPE=COUNTING +PROFILER_SAMPLING_COUNTING_SAMPLING_RATE=20 +PROFILER_SAMPLING_PERCENT_SAMPLING_RATE=5 +PROFILER_SAMPLING_NEW_THROUGHPUT=0 +PROFILER_SAMPLING_CONTINUE_THROUGHPUT=0 AGENT_ID=app-in-docker APP_NAME=quickapp diff --git a/pinpoint-quickstart/docker-compose.yml b/pinpoint-quickstart/docker-compose.yml index efe1cdb..e324063 100644 --- a/pinpoint-quickstart/docker-compose.yml +++ b/pinpoint-quickstart/docker-compose.yml @@ -40,7 +40,11 @@ services: - COLLECTOR_TCP_PORT=${COLLECTOR_TCP_PORT} - COLLECTOR_STAT_PORT=${COLLECTOR_STAT_PORT} - COLLECTOR_SPAN_PORT=${COLLECTOR_SPAN_PORT} - - PROFILER_SAMPLING_RATE=${PROFILER_SAMPLING_RATE} + - PROFILER_SAMPLING_TYPE=${PROFILER_SAMPLING_TYPE} + - PROFILER_SAMPLING_COUNTING_SAMPLING_RATE=${PROFILER_SAMPLING_COUNTING_SAMPLING_RATE} + - PROFILER_SAMPLING_PERCENT_SAMPLING_RATE=${PROFILER_SAMPLING_PERCENT_SAMPLING_RATE} + - PROFILER_SAMPLING_NEW_THROUGHPUT=${PROFILER_SAMPLING_NEW_THROUGHPUT} + - PROFILER_SAMPLING_CONTINUE_THROUGHPUT=${PROFILER_SAMPLING_CONTINUE_THROUGHPUT} - DEBUG_LEVEL=${AGENT_DEBUG_LEVEL} volumes: