Skip to content

Commit e825809

Browse files
committedOct 31, 2022
drop influxdb python dependency
We haven't used influxdb in a long time, remove the dead code and unused dependency. Some code in experiments/ and kettle/ relied on 'requests' being transitively being pulled in by influxdb, so specify that explicitly.
1 parent ba4b706 commit e825809

File tree

5 files changed

+5
-42
lines changed

5 files changed

+5
-42
lines changed
 

‎images/bigquery/Dockerfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ RUN apt-get update && apt-get install -y \
2424
rm -rf /var/lib/apt/lists/*
2525

2626
ARG CLOUD_SDK_VERSION=390.0.0
27-
ARG INFLUXDB_VERSION=5.2.2
2827
ARG BIGQUERY_LIBRARY_VERSION=0.26.0
2928
ARG RUAMEL_VERSION=0.16
3029

31-
RUN pip3 install --no-cache-dir influxdb=={INFLUXDB_VERSION} google-cloud-bigquery==${BIGQUERY_LIBRARY_VERSION} ruamel.yaml==${RUAMEL_VERSION}}
30+
RUN pip3 install --no-cache-dir google-cloud-bigquery==${BIGQUERY_LIBRARY_VERSION} ruamel.yaml==${RUAMEL_VERSION}}
3231

3332
ENV PATH=/google-cloud-sdk/bin:${PATH} \
3433
CLOUDSDK_CORE_DISABLE_PROMPTS=1

‎kettle/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
3131
&& rm -rf /var/lib/apt/lists/*
3232

3333
RUN pip3 install --no-cache-dir --upgrade pip && \
34-
pip3 install --no-cache-dir requests google-cloud-pubsub==2.3.0 google-cloud-bigquery==2.11.0 influxdb ruamel.yaml==0.16
34+
pip3 install --no-cache-dir requests google-cloud-pubsub==2.3.0 google-cloud-bigquery==2.11.0 ruamel.yaml==0.16
3535

3636
RUN curl -fsSL https://downloads.python.org/pypy/pypy3.6-v7.3.1-linux64.tar.bz2 | tar xj -C opt && \
3737
ln -s /opt/pypy*/bin/pypy3 /usr/bin

‎kettle/monitor.py

+2-32
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@
2020

2121
import argparse
2222
import json
23-
import os
2423
import sys
2524
import time
2625

27-
import influxdb
28-
2926
try:
3027
from google.cloud import bigquery
3128
import google.cloud.exceptions
@@ -35,7 +32,7 @@
3532
traceback.print_exc()
3633

3734

38-
def collect(tables, stale_hours, influx_client):
35+
def collect(tables, stale_hours):
3936
lines = []
4037
stale = False
4138
for table_spec in tables:
@@ -69,47 +66,20 @@ def collect(tables, stale_hours, influx_client):
6966
table.table_id, hours_old, stale_hours))
7067
stale = True
7168

72-
lines.append(influxdb.line_protocol.make_lines({
73-
'tags': {'db': table.table_id},
74-
'points': [{'measurement': 'bigquery', 'fields': fields}]
75-
}))
76-
7769
print('Collected data:')
7870
print(''.join(lines))
7971

80-
if influx_client:
81-
influx_client.write_points(lines, time_precision='ms', protocol='line')
82-
else:
83-
print('Not uploading to influxdb; missing client.')
84-
8572
return int(stale)
8673

8774

88-
def make_influx_client():
89-
"""Make an InfluxDB client from config at path $VELODROME_INFLUXDB_CONFIG"""
90-
if 'VELODROME_INFLUXDB_CONFIG' not in os.environ:
91-
return None
92-
93-
with open(os.environ['VELODROME_INFLUXDB_CONFIG']) as config_file:
94-
config = json.load(config_file)
95-
96-
return influxdb.InfluxDBClient(
97-
host=config['host'],
98-
port=config['port'],
99-
username=config['user'],
100-
password=config['password'],
101-
database='metrics',
102-
)
103-
104-
10575
def main(args):
10676
parser = argparse.ArgumentParser()
10777
parser.add_argument('--table', nargs='+', required=True,
10878
help='List of datasets to return information about.')
10979
parser.add_argument('--stale', type=int,
11080
help='Number of hours to consider stale.')
11181
opts = parser.parse_args(args)
112-
return collect(opts.table, opts.stale, make_influx_client())
82+
return collect(opts.table, opts.stale)
11383

11484

11585
if __name__ == '__main__':

‎metrics/README.md

-6
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ the metric name and persist for a year after their creation. Additionally,
9595
the latest filtered results for a metric are stored in the root of the
9696
k8s-metrics bucket and named with the format `METRICNAME-latest.json`.
9797

98-
If a config specifies the optional jq filter used to create influxdb timeseries
99-
data points, then the job will use the filter to generate timeseries points from
100-
the raw query results.
101-
102-
At one point, these points were uploaded to a system called velodrome, which had an influxdb instance where they can be used to create graphs and tables, but velodrome is no longer in existence. This may be revised in the future.
103-
10498
## Query structure
10599

106100
The `query` is written in `Standard SQL` which is really [BigQuery Standard SQL](https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax) that allows for working with arrays/repeated fields. Each sub-query, from the most indented out, will build a subtable that the outer query runs against. Any one of the sub query blocks can be run independently from the BigQuery console or optionally added to a test query config and run via the same `bigquery.py` line above.

‎requirements3.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ astroid==2.3.3
22
backports.functools_lru_cache==1.6.1
33
configparser==4.0.2
44
chardet==4.0.0
5-
influxdb==5.2.3
65
isort==4.3.21
76
pylint==2.4.4
87
parameterized==0.7.4
98
PyYAML==5.3
9+
requests==2.28.1
1010
ruamel.yaml==0.16.5
1111
setuptools==44.0.0
1212
sh==1.12.14

0 commit comments

Comments
 (0)
Please sign in to comment.