Skip to content

Commit

Permalink
Helm-Chart updated / Ignore processingTime DP with 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Wiechmann committed Dec 15, 2021
1 parent 3004b9d commit d105f01
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,22 @@ async function processServiceMetrics(params, options) {
var maxProcessed = false;
var minProcessed = false;
for(processingTime of metric.processingTimeAvg) {
// Ignore processingTime 0, as it means, no API-Request has been processed
if(processingTime == 0) continue;
logger.info(`Adding ProcessingTimeAvg ${processingTime} for service: ${metric.name} on gatewayId: ${metric.gatewayId}`);
metrics.axway_api_requests_duration_avg.observe({ gatewayId: metric.gatewayId, service: metric.name }, processingTime);
avgProcessed = true;
}
for(processingTime of metric.processingTimeMax) {
// Ignore processingTime 0, as it means, no API-Request has been processed
if(processingTime == 0) continue;
logger.info(`Adding ProcessingTimeMax ${processingTime} for service: ${metric.name} on gatewayId: ${metric.gatewayId}`);
metrics.axway_api_requests_duration_max.observe({ gatewayId: metric.gatewayId, service: metric.name }, processingTime);
maxProcessed = true;
}
for(processingTime of metric.processingTimeMin) {
// Ignore processingTime 0, as it means, no API-Request has been processed
if(processingTime == 0) continue;
logger.info(`Adding ProcessingTimeMin datapoint: ${processingTime} for service: ${metric.name} on gatewayId: ${metric.gatewayId}`);
metrics.axway_api_requests_duration_min.observe({ gatewayId: metric.gatewayId, service: metric.name }, processingTime);
minProcessed = true;
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1. Get the application URL by running these commands:
1. You can access the metrics on:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
Expand Down
22 changes: 17 additions & 5 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,33 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.global.repository }}/{{ .Values.global.image }}:{{ .Values.global.imageTag }}"
image: "{{ .Values.global.repository }}/{{ .Values.global.image }}:{{ default .Chart.AppVersion .Values.global.imageTag }}"
imagePullPolicy: {{ .Values.global.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
env:
- name: ANM_URL
value: {{ required "Missing .Values.anm.url" .Values.anm.url | quote }}
value: {{ required "Missing .Values.config.anm.url" .Values.config.anm.url | quote }}
- name: ANM_USERNAME
value: {{ required "Missing .Values.anm.username" .Values.anm.username | quote }}
value: {{ required "Missing .Values.config.anm.username" .Values.config.anm.username | quote }}
- name: ANM_PASSWORD
value: {{ required "Missing .Values.anm.password" .Values.anm.password | quote }}
{{- if .Values.config.anm.existingSecret }}
valueFrom:
secretKeyRef:
name: {{ .Values.config.anm.existingSecret | quote }}
key: {{ .Values.config.anm.existingSecretPasswordKey | quote }}
{{- else }}
value: {{ required "Missing .Values.config.anm.password or an existingSecret" .Values.config.anm.password | quote }}
{{- end }}
- name: LOG_LEVEL
value: "debug"
value: {{ default "info" .Values.config.logLevel | quote }}
- name: POLL_SERVICE_METRICS_INTERVAL
value: {{ default "15000" .Values.config.pollServiceMetricsInterval | quote }}
- name: POLL_SUMMARY_METRICS_INTERVAL
value: {{ default "15000" .Values.config.pollSummaryMetricsInterval | quote }}

livenessProbe:
httpGet:
path: /api/metrics
Expand Down
10 changes: 6 additions & 4 deletions helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "axway-apim-prometheus.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if or (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") (.Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress") }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
apiVersion: networking.k8s.io/v1
{{- else }}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
Expand Down Expand Up @@ -38,4 +39,5 @@ spec:
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
20 changes: 20 additions & 0 deletions helm/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.ingress.enabled -}}
{{- if .Capabilities.APIVersions.Has "route.openshift.io/v1/Route" }}
{{- $fullName := include "axway-apim-prometheus.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: {{ $fullName }}
spec:
to:
kind: Service
name: {{ $fullName }}
port:
targetPort: {{ $svcPort }}
tls:
termination: passthrough
insecureEdgeTerminationPolicy: Redirect
wildcardPolicy: None
{{- end }}
{{- end }}
37 changes: 29 additions & 8 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
global:
repository: "cwiechmann"
image: "apibuilder4prometheus"
imageTag: "v0.2.0"
# You may override the default image tag
imageTag: ""
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""

replicas: 1

anm:
url:
username:
password:
config:
# Information used to connect to the Admin-Node-Manager
anm:
# The ANM-URL (e.g. https://anm.customer.com:8090)
url: ""
# Username used by the process to collect metric information. Must have permission to call the REST-API: api/monitoring/metrics/...
username: ""
# Belonging password. You may also use an existing secret that contains the password. See below.
password: ""
# If an existing secret is provided the config.anm.password is ignored and instead this secret is used
existingSecret: ""
# The key in the existing secret that contains the required password
existingSecretPasswordKey: ""

# Controls how often the service metrics, such as API request information or processing times should be obtained from the ANM.
# The smaller the interval, the more granular the exposed information is provided, but has higher load for the admin node manager.
# The default is every 15 seconds. It makes sense to match this value with the Prometheus scraper interval.
pollServiceMetricsInterval: ""
# Controls how often the API gateway system metrics, such as CPU or memory usage, should be obtained from the ANM.
# The smaller the interval, the more granular the exposed information is provided, but has higher load for the admin node manager.
# The default is every 15 seconds. It makes sense to match this value with the Prometheus scraper interval.
pollSummaryMetricsInterval: ""
# The Log-Level of the API-Builder process. Defaults to info.
logLevel: ""


imagePullSecrets: []
nameOverride: ""
Expand Down Expand Up @@ -44,6 +64,7 @@ service:
port: 8080

ingress:
# If enabled, you can access the metrics via this ingress resource (on OpenShift a route is created instead)
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
Expand Down Expand Up @@ -75,7 +96,7 @@ resources: {}
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
maxReplicas: 1
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

Expand Down

0 comments on commit d105f01

Please sign in to comment.