This commit is contained in:
parent
eb9193451e
commit
b4c7d2b12d
@ -8,10 +8,8 @@ class Config:
|
|||||||
RELEASE_ID = os.environ.get("RELEASE_ID", "test")
|
RELEASE_ID = os.environ.get("RELEASE_ID", "test")
|
||||||
RELEASEMODE = os.environ.get("RELEASEMODE", "dev")
|
RELEASEMODE = os.environ.get("RELEASEMODE", "dev")
|
||||||
|
|
||||||
INFLUXDB_HOST = os.environ['INFLUXDB_HOST']
|
INFLUXDB_V2_URL = os.environ['INFLUXDB_URL']
|
||||||
INFLUXDB_PORT = os.environ['INFLUXDB_PORT']
|
INFLUXDB_V2_TOKEN = os.environ['INFLUXDB_TOKEN']
|
||||||
INFLUXDB_USER = os.environ['INFLUXDB_USER']
|
INFLUXDB_V2_ORG = os.environ['INFLUXDB_ORG']
|
||||||
INFLUXDB_PASSWORD = os.environ['INFLUXDB_PASSWORD']
|
|
||||||
INFLUXDB_DATABASE = os.environ['INFLUXDB_DATABASE']
|
|
||||||
|
|
||||||
INFLUXDB_TIMEOUT = 30
|
INFLUXDB_TIMEOUT = 30
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from flask_influxdb import InfluxDB
|
from flask_influxdb2 import InfluxDB2
|
||||||
|
|
||||||
influxdb_instance = InfluxDB()
|
influxdb_instance = InfluxDB2()
|
||||||
|
@ -1,7 +1,26 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from flask import jsonify, request, abort, current_app, Response
|
from flask import jsonify, request, abort, current_app, Response
|
||||||
from flask_classful import FlaskView
|
from flask_classful import FlaskView
|
||||||
|
from utils import json_required, influxdb_instance
|
||||||
|
from influxdb_client import Point
|
||||||
|
|
||||||
|
|
||||||
class ReportView(FlaskView):
|
class ReportView(FlaskView):
|
||||||
pass
|
|
||||||
|
@json_required
|
||||||
|
def post(self):
|
||||||
|
data = request.json
|
||||||
|
|
||||||
|
points = []
|
||||||
|
|
||||||
|
for type_ in ['latency', 'queue', 'rate']:
|
||||||
|
if type_ in data['measurements']:
|
||||||
|
points.append(
|
||||||
|
Point(type_)
|
||||||
|
.tag("client", data['client'])
|
||||||
|
.tag("cloud", data['cloud'])
|
||||||
|
.field("latency", data['measurements'][type_])
|
||||||
|
)
|
||||||
|
|
||||||
|
influxdb_instance.connection.write_api().write("alma", "alma", points)
|
||||||
|
return Response(status=201)
|
||||||
|
@ -9,4 +9,6 @@ data:
|
|||||||
SENTRY_DSN:
|
SENTRY_DSN:
|
||||||
RELEASE_ID: kmlabz-k8s
|
RELEASE_ID: kmlabz-k8s
|
||||||
RELEASEMODE: release
|
RELEASEMODE: release
|
||||||
|
INFLUXDB_URL: http://birb-latency-influxdb:8086
|
||||||
|
INFLUXDB_TOKEN: my-super-secret-auth-token
|
||||||
|
INFLUXDB_ORG: alma
|
||||||
|
62
k8s/influxdb.yaml
Normal file
62
k8s/influxdb.yaml
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: birb-latency-influxdb
|
||||||
|
namespace: birbnetes
|
||||||
|
labels:
|
||||||
|
app: birb-latency-influxdb
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: birb-latency-influxdb
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: birb-latency-influxdb
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: "influxdb:2.1"
|
||||||
|
imagePullPolicy: Always
|
||||||
|
name: birb-latency-influxdb
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: birb-latency-influxdb
|
||||||
|
ports:
|
||||||
|
- containerPort: 8086
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: birb-latency-influxdb
|
||||||
|
namespace: birbnetes
|
||||||
|
labels:
|
||||||
|
app: birb-latency-influxdb
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: birb-latency-influxdb
|
||||||
|
port: 8086
|
||||||
|
targetPort: 8086
|
||||||
|
protocol: TCP
|
||||||
|
selector:
|
||||||
|
app: birb-latency-influxdb
|
||||||
|
type: ClusterIP
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: birb-latency-influxdb
|
||||||
|
labels:
|
||||||
|
app: birb-latency-influxdb
|
||||||
|
namespace: birbnetes
|
||||||
|
data:
|
||||||
|
DOCKER_INFLUXDB_INIT_USERNAME: admin
|
||||||
|
DOCKER_INFLUXDB_INIT_PASSWORD: adminadmin
|
||||||
|
DOCKER_INFLUXDB_INIT_ORG: alma
|
||||||
|
DOCKER_INFLUXDB_INIT_BUCKET: alma
|
||||||
|
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: my-super-secret-auth-token
|
||||||
|
|
@ -9,7 +9,7 @@ sentry_sdk
|
|||||||
flask_minio
|
flask_minio
|
||||||
py-healthcheck
|
py-healthcheck
|
||||||
|
|
||||||
Flask-InfluxDB~=0.3.3
|
Flask-InfluxDB2~=0.3
|
||||||
|
|
||||||
jaeger-client
|
jaeger-client
|
||||||
Flask-Opentracing
|
Flask-Opentracing
|
||||||
|
Loading…
Reference in New Issue
Block a user