Skip to content

Commit b5678b4

Browse files
committed
Remove telemetry_event table
Remove _timescaledb_catalog.telemetry_event and associated code. This is part of legacy telemetry and not used by our code.
1 parent 19d418b commit b5678b4

12 files changed

Lines changed: 13 additions & 123 deletions

File tree

sql/pre_install/tables.sql

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,6 @@ CREATE TABLE _timescaledb_catalog.metadata (
320320

321321
SELECT pg_catalog.pg_extension_config_dump('_timescaledb_catalog.metadata', $$ WHERE key <> 'uuid' $$);
322322

323-
-- Log with events that will be sent out with the telemetry. The log
324-
-- will be flushed after it has been sent out. We do not save it to
325-
-- backups since it should not contain important data.
326-
CREATE TABLE _timescaledb_catalog.telemetry_event (
327-
created timestamptz NOT NULL DEFAULT current_timestamp,
328-
tag name NOT NULL,
329-
body jsonb NOT NULL
330-
);
331-
332323
CREATE TABLE _timescaledb_catalog.continuous_agg (
333324
mat_hypertable_id integer NOT NULL,
334325
raw_hypertable_id integer NOT NULL,

sql/updates/latest-dev.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,8 @@ ALTER TABLE _timescaledb_catalog.continuous_aggs_jobs_refresh_ranges
270270

271271
ANALYZE _timescaledb_catalog.continuous_agg;
272272
-- end rebuild _timescaledb_catalog.continuous_agg --
273+
274+
-- drop telemetry_event
275+
ALTER EXTENSION timescaledb DROP TABLE _timescaledb_catalog.telemetry_event;
276+
DROP TABLE _timescaledb_catalog.telemetry_event;
277+

sql/updates/reverse-dev.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,3 +274,11 @@ ALTER TABLE _timescaledb_catalog.continuous_aggs_jobs_refresh_ranges
274274
ANALYZE _timescaledb_catalog.continuous_agg;
275275
-- end rebuild _timescaledb_catalog.continuous_agg --
276276

277+
-- restore telemetry_event
278+
CREATE TABLE _timescaledb_catalog.telemetry_event (
279+
created timestamptz NOT NULL DEFAULT current_timestamp,
280+
tag name NOT NULL,
281+
body jsonb NOT NULL
282+
);
283+
GRANT SELECT ON _timescaledb_catalog.telemetry_event TO PUBLIC;
284+

src/telemetry/telemetry.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
#define REQ_NUM_USER_DEFINED_ACTIONS "num_user_defined_actions"
7575
#define REQ_RELATED_EXTENSIONS "related_extensions"
7676
#define REQ_METADATA "db_metadata"
77-
#define REQ_TELEMETRY_EVENT "db_telemetry_events"
7877
#define REQ_LICENSE_EDITION_APACHE "apache_only"
7978
#define REQ_LICENSE_EDITION_COMMUNITY "community"
8079
#define REQ_TS_LAST_TUNE_TIME "last_tuned_time"
@@ -1082,13 +1081,6 @@ build_telemetry_report()
10821081
ts_telemetry_metadata_add_values(parse_state);
10831082
pushJsonbValue(&parse_state, WJB_END_OBJECT, NULL);
10841083

1085-
/* Add telemetry events */
1086-
key.type = jbvString;
1087-
key.val.string.val = REQ_TELEMETRY_EVENT;
1088-
key.val.string.len = strlen(REQ_TELEMETRY_EVENT);
1089-
pushJsonbValue(&parse_state, WJB_KEY, &key);
1090-
ts_telemetry_events_add(parse_state);
1091-
10921084
/* Add function call telemetry */
10931085
key.type = jbvString;
10941086
key.val.string.val = REQ_FUNCTIONS_USED;
@@ -1253,7 +1245,6 @@ ts_telemetry_main(const char *host, const char *path, const char *service)
12531245
}
12541246

12551247
ts_function_telemetry_reset_counts();
1256-
ts_telemetry_event_truncate();
12571248

12581249
/*
12591250
* Do the version-check. Response is the body of a well-formed HTTP

src/telemetry/telemetry_metadata.c

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -17,65 +17,6 @@
1717
#include "ts_catalog/metadata.h"
1818
#include "uuid.h"
1919

20-
void
21-
ts_telemetry_event_truncate(void)
22-
{
23-
RangeVar rv = {
24-
.schemaname = CATALOG_SCHEMA_NAME,
25-
.relname = TELEMETRY_EVENT_TABLE_NAME,
26-
};
27-
ExecuteTruncate(&(TruncateStmt){
28-
.type = T_TruncateStmt,
29-
.relations = list_make1(&rv),
30-
.behavior = DROP_RESTRICT,
31-
});
32-
}
33-
34-
void
35-
ts_telemetry_events_add(JsonbParseState *state)
36-
{
37-
ScanIterator iterator =
38-
ts_scan_iterator_create(TELEMETRY_EVENT, AccessShareLock, CurrentMemoryContext);
39-
pushJsonbValue(&state, WJB_BEGIN_ARRAY, NULL);
40-
ts_scanner_foreach(&iterator)
41-
{
42-
TupleInfo *ti = iterator.tinfo;
43-
TupleDesc tupdesc = ti->slot->tts_tupleDescriptor;
44-
bool created_isnull, tag_isnull, value_isnull;
45-
Datum created = slot_getattr(ti->slot, Anum_telemetry_event_created, &created_isnull);
46-
Datum tag = slot_getattr(ti->slot, Anum_telemetry_event_tag, &tag_isnull);
47-
Datum body = slot_getattr(ti->slot, Anum_telemetry_event_body, &value_isnull);
48-
49-
pushJsonbValue(&state, WJB_BEGIN_OBJECT, NULL);
50-
if (!created_isnull)
51-
{
52-
ts_jsonb_add_str(state,
53-
NameStr(
54-
TupleDescAttr(tupdesc, Anum_telemetry_event_created - 1)->attname),
55-
DatumGetCString(DirectFunctionCall1(timestamptz_out, created)));
56-
}
57-
58-
if (!tag_isnull)
59-
{
60-
ts_jsonb_add_str(state,
61-
NameStr(TupleDescAttr(tupdesc, Anum_telemetry_event_tag - 1)->attname),
62-
pstrdup(NameStr(*DatumGetName(tag))));
63-
}
64-
65-
if (!value_isnull)
66-
{
67-
JsonbValue jsonb_value;
68-
JsonbToJsonbValue(DatumGetJsonbPCopy(body), &jsonb_value);
69-
ts_jsonb_add_value(state,
70-
NameStr(
71-
TupleDescAttr(tupdesc, Anum_telemetry_event_body - 1)->attname),
72-
&jsonb_value);
73-
}
74-
pushJsonbValue(&state, WJB_END_OBJECT, NULL);
75-
}
76-
pushJsonbValue(&state, WJB_END_ARRAY, NULL);
77-
}
78-
7920
/*
8021
* add all entries from _timescaledb_catalog.metadata
8122
*/

src/telemetry/telemetry_metadata.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,3 @@
1111
#include <export.h>
1212

1313
extern void ts_telemetry_metadata_add_values(JsonbParseState *state);
14-
extern void ts_telemetry_events_add(JsonbParseState *state);
15-
extern void ts_telemetry_event_truncate(void);

src/ts_catalog/catalog.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ static const TableInfoDef catalog_table_names[_MAX_CATALOG_TABLES + 1] = {
109109
.schema_name = CATALOG_SCHEMA_NAME,
110110
.table_name = CONTINUOUS_AGGS_WATERMARK_TABLE_NAME,
111111
},
112-
[TELEMETRY_EVENT] = {
113-
.schema_name = CATALOG_SCHEMA_NAME,
114-
.table_name = TELEMETRY_EVENT_TABLE_NAME,
115-
},
116112
[CHUNK_COLUMN_STATS] = {
117113
.schema_name = CATALOG_SCHEMA_NAME,
118114
.table_name = CHUNK_COLUMN_STATS_TABLE_NAME,

src/ts_catalog/catalog.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ typedef enum CatalogTable
5353
COMPRESSION_CHUNK_SIZE,
5454
CONTINUOUS_AGGS_BUCKET_FUNCTION,
5555
CONTINUOUS_AGGS_WATERMARK,
56-
TELEMETRY_EVENT,
5756
CHUNK_COLUMN_STATS,
5857
/* Don't forget updating catalog.c when adding new tables! */
5958
_MAX_CATALOG_TABLES,
@@ -738,22 +737,6 @@ enum
738737
_MAX_METADATA_INDEX,
739738
};
740739

741-
/*
742-
* telemetry_event table definition
743-
*/
744-
745-
#define TELEMETRY_EVENT_TABLE_NAME "telemetry_event"
746-
747-
enum Anum_telemetry_event
748-
{
749-
Anum_telemetry_event_created = 1,
750-
Anum_telemetry_event_tag,
751-
Anum_telemetry_event_body,
752-
_Anum_telemetry_event_max,
753-
};
754-
755-
#define Natts_telemetry_event_max (_Anum_telemetry_event_max - 1)
756-
757740
/****** BGW_POLICY_CHUNK_STATS TABLE definitions */
758741
#define BGW_POLICY_CHUNK_STATS_TABLE_NAME "bgw_policy_chunk_stats"
759742

test/expected/drop_rename_hypertable.out

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ SELECT schema, name FROM test.relation WHERE schema IN ('public', '_timescaledb_
201201
_timescaledb_catalog | hypertable
202202
_timescaledb_catalog | metadata
203203
_timescaledb_catalog | tablespace
204-
_timescaledb_catalog | telemetry_event
205204
_timescaledb_internal | bgw_job_stat
206205
_timescaledb_internal | bgw_job_stat_history
207206
_timescaledb_internal | bgw_policy_chunk_stats

test/expected/pg_dump.out

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass AND
401401
_timescaledb_catalog.chunk_rewrite
402402
_timescaledb_catalog.compression_algorithm
403403
_timescaledb_catalog.tablespace_id_seq
404-
_timescaledb_catalog.telemetry_event
405404
_timescaledb_config.bgw_job
406405
_timescaledb_internal.bgw_job_stat
407406
_timescaledb_internal.bgw_job_stat_history

0 commit comments

Comments
 (0)