Add Grafana, Prometheus and Jaeger containers.

This commit is contained in:
rahulpa 2018-10-18 13:43:04 -07:00
parent 781b6df8a0
commit e7adfef132
11 changed files with 377 additions and 0 deletions

View file

@ -0,0 +1,78 @@
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: grafana
spec:
template:
metadata:
labels:
app: grafana
spec:
containers:
- name: grafana
image: gcr.io/microservices-demo-app/grafana
ports:
- containerPort: 3000
readinessProbe:
periodSeconds: 5
tcpSocket:
port: 3000
livenessProbe:
periodSeconds: 5
tcpSocket:
port: 3000
volumeMounts:
- mountPath: /var/lib/grafana
name: grafana-data
resources:
limits:
memory: 256Mi
cpu: 125m
requests:
cpu: 70m
memory: 200Mi
volumes:
- name: grafana-data
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: grafana
spec:
type: ClusterIP
selector:
app: grafana
ports:
- name: grafana
port: 3000
targetPort: 3000
# ---
# TODO (rghetia): Grafana-external is disabled until password issue is resolved.
#
# apiVersion: v1
# kind: Service
# metadata:
# name: grafana-external
# spec:
# type: LoadBalancer
# selector:
# app: grafana
# ports:
# - name: http
# port: 3000
# targetPort: 3000

View file

@ -0,0 +1,86 @@
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: jaeger
spec:
template:
metadata:
labels:
app: jaeger
spec:
containers:
- name: jaeger
image: gcr.io/microservices-demo-app/jaeger
ports:
- containerPort: 16686
name: frontend
protocol: TCP
- containerPort: 14268
name: thrift-direct
protocol: TCP
readinessProbe:
periodSeconds: 5
tcpSocket:
port: 16686
livenessProbe:
periodSeconds: 5
tcpSocket:
port: 16686
volumeMounts:
- mountPath: /data
name: jaeger-data
resources:
limits:
memory: 256Mi
cpu: 125m
requests:
cpu: 70m
memory: 200Mi
volumes:
- name: jaeger-data
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: jaeger
spec:
type: ClusterIP
selector:
app: jaeger
ports:
- name: frontend
port: 16686
targetPort: 16686
protocol: TCP
- name: jaeger-thrift-direct
port: 14268
targetPort: 14268
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: jaeger-external
spec:
type: LoadBalancer
selector:
app: jaeger
ports:
- name: http
port: 16686
targetPort: 16686

View file

@ -0,0 +1,63 @@
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: prometheus
spec:
template:
metadata:
labels:
app: prometheus
spec:
containers:
- name: prometheus
image: gcr.io/microservices-demo-app/prometheus
ports:
- containerPort: 9090
readinessProbe:
periodSeconds: 5
tcpSocket:
port: 9090
livenessProbe:
periodSeconds: 5
tcpSocket:
port: 9090
volumeMounts:
- mountPath: /data
name: prometheus-data
resources:
limits:
memory: 256Mi
cpu: 125m
requests:
cpu: 70m
memory: 200Mi
volumes:
- name: prometheus-data
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: prometheus
spec:
type: ClusterIP
selector:
app: prometheus
ports:
- name: prometheus
port: 9090
targetPort: 9090

View file

@ -38,6 +38,12 @@ build:
context: src/loadgenerator
- image: gcr.io/microservices-demo-app/adservice
context: src/adservice
- image: gcr.io/microservices-demo-app/grafana
context: src/grafana
- image: gcr.io/microservices-demo-app/prometheus
context: src/prometheus
- image: gcr.io/microservices-demo-app/jaeger
context: src/jaeger
tagPolicy:
gitCommit: {}
deploy:

9
src/grafana/Dockerfile Normal file
View file

@ -0,0 +1,9 @@
# adsservice
FROM grafana/grafana
RUN grafana-cli plugins install mtanda-histogram-panel
COPY provisioning /etc/grafana/provisioning
WORKDIR /
EXPOSE 3000
ENTRYPOINT ["/run.sh"]

View file

@ -0,0 +1,61 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": null,
"links": [],
"panels": [],
"refresh": false,
"schemaVersion": 16,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-5m",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "",
"title": "Hipstershop Dashboard",
"uid": "FPHI7T0mz",
"version": 1
}

View file

@ -0,0 +1,11 @@
apiVersion: 1
providers:
- name: 'prometheus'
orgId: 1
folder: ''
type: file
disableDeletion: false
updateIntervalSeconds: 3 #how often Grafana will scan for changed dashboards
options:
path: /etc/grafana/provisioning/dashboards/

View file

@ -0,0 +1,18 @@
# config file version
apiVersion: 1
# list of datasources to insert/update depending
# what's available in the database
datasources:
# <string, required> name of the datasource. Required
- name: Prometheus
# <string, required> datasource type. Required
type: prometheus
# <string, required> access mode. proxy or direct (Server or Browser in the UI). Required
access: proxy
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string> url
url: http://prometheus:9090
# <bool> allow users to edit datasources from the UI.
editable: false

1
src/jaeger/Dockerfile Normal file
View file

@ -0,0 +1 @@
FROM jaegertracing/all-in-one:1.6

View file

@ -0,0 +1,3 @@
# prometheus
FROM prom/prometheus
ADD prometheus.yml /etc/prometheus/

View file

@ -0,0 +1,41 @@
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
- job_name: 'adservice'
static_configs:
- targets: ['adservice:9090']
- job_name: 'frontend'
static_configs:
- targets: ['frontend:9090']
- job_name: 'checkoutservice'
static_configs:
- targets: ['checkoutservice:9090']