Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sethsamuel committed Oct 3, 2024
1 parent 5f5fa7b commit 52fd49c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions postgres/datadog_checks/postgres/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def report_postgres_metadata(self):
raw=True,
)
self._check.gauge(
"dd.postgres.schema.tables_total",
"dd.postgres.schema.tables_count",
total_tables,
tags=self._check.tags,
hostname=self._check.resolved_hostname,
Expand All @@ -356,7 +356,7 @@ def report_postgres_metadata(self):
)
datadog_agent.emit_agent_telemetry(
"postgres",
"schema_tables_total",
"schema_tables_count",
total_tables,
"gauge"
)
Expand Down
2 changes: 2 additions & 0 deletions postgres/datadog_checks/postgres/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,8 @@ def _collect_metric_autodiscovery(self, instance_tags, scopes, scope_type):
hostname=self.resolved_hostname,
raw=True,
)
telemetry_metric = scope_type.replace("_","",1) # remove the first underscore to match telemetry convention
datadog_agent.emit_agent_telemetry("postgres", f"{telemetry_metric}_ms", elapsed_ms, "histogram")
if elapsed_ms > self._config.min_collection_interval * 1000:
self.record_warning(
DatabaseConfigurationError.autodiscovered_metrics_exceeds_collection_interval,
Expand Down
13 changes: 13 additions & 0 deletions postgres/datadog_checks/postgres/statement_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,19 @@ def _report_check_hist_metrics(self, start_time, row_len, method_name):
hostname=self._check.resolved_hostname,
raw=True,
)
datadog_agent.emit_agent_telemetry(
"postgres",
f"{method_name}_ms",
(time.time() - start_time) * 1000,
"histogram",
)
datadog_agent.emit_agent_telemetry(
"postgres",
f"{method_name}_count",
row_len,
"histogram",
)


def run_job(self):
# do not emit any dd.internal metrics for DBM specific check code
Expand Down

0 comments on commit 52fd49c

Please sign in to comment.