Skip to content

feat: Add staging OTel log synthesis rule for POSTGRESQLINSTANCE#3074

Open
mraju1 wants to merge 1 commit into
newrelic:mainfrom
mraju1:mr-postgres-add-otel-logs-rule
Open

feat: Add staging OTel log synthesis rule for POSTGRESQLINSTANCE#3074
mraju1 wants to merge 1 commit into
newrelic:mainfrom
mraju1:mr-postgres-add-otel-logs-rule

Conversation

@mraju1

@mraju1 mraju1 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Relevant information

Api Review Board (ARB)

Any pull request with changes to this repository has to be linked with an ARB ticket, which has to be approved before merging.

If you are an external contributor please contact New Relic Support.

If you don't know about the ARB process check this

ARB Jira ticket:
https://new-relic.atlassian.net/browse/NR-XXXX

Checklist

  • I've read the guidelines and understand the acceptance criteria.
  • The value of the attribute marked as identifier will be unique and valid.
  • I've confirmed that my entity type wasn't already defined. If it is I'm providing an explanation above.
  • I've linked an ARB ticket & received approval from API Review Board in order to make these changes

   Adds definition.stg.yml with a new synthesis rule that associates OTel
   log events (db.server.top_query, db.server.query_sample) with the
   existing POSTGRESQLINSTANCE entity. Uses db.system.name: postgresql as
   the discriminator — receiver-agnostic and always present when log events
   are enabled. Identifier is service.instance.id (host:port) to match the
   existing OTel metric rule, ensuring logs resolve to the same entity GUID.

   Also adds tests/Log.json covering both log event types for CI validation.

@entityBot entityBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beep boop bop.

I have found some errors processing these changes:

  • Error VALIDATING domainType: 'INFRA-POSTGRESQLINSTANCE' on synthesis - Exception: No entity matches 'INFRA-POSTGRESQLINSTANCE' synthesis rules for the given test data: 'Log.json file - #1' data point. Please review test data and synthesis rules.
  • Error VALIDATING domainType: 'INFRA-POSTGRESQLINSTANCE' on synthesis - Exception: No entity matches 'INFRA-POSTGRESQLINSTANCE' synthesis rules for the given test data: 'Log.json file - #2' data point. Please review test data and synthesis rules.
  • We don't think these changes require an API Review Board (ARB) review, so it is not required to merge this PR. Note that all API changes do require one: if you believe this PR needs an ARB review, please create the ticket and add the ARB:pending label. Reach #api-review-board in case of doubts.

@entityBot
entityBot requested a review from a team July 22, 2026 05:33
cloud.provider:
cloud.account.id:
cloud.region:
otel.library.name:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mraju1 Can we update the tags for both metrics and logs?

  • Add otel.library.version so we can identify customer collector versions.
  • Remove host.type, cloud.provider, cloud.account.id, and cloud.region since they aren't present in the PostgreSQL receiver's metadata.yaml.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove host.type, cloud.provider, cloud.account.id, and cloud.region since they aren't present

I think these are useful tags.
They are coming from the resourcedetectionprocessor and are all very popular.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nr-ksteinbach Thanks for the clarification!

One thing worth flagging though, resourcedetectionprocessor actually detects the collector's own VM/host, not the database's. It reads from the collector's local environment (EC2/GCP/Azure/system metadata).

So these tags are accurate only when the collector runs on the same VM as Postgres. If it runs on a separate VM (e.g. a centralized collector, or a managed/remote Postgres instance), host.type, cloud.provider, cloud.account.id, and cloud.region would describe the collector's VM, not the DB's - which could be misleading on POSTGRESQLINSTANCE.

Given that's a pretty common setup, I'd lean toward dropping them. Happy to hear your thoughts on this!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if a value for the a tag attribute entry is not present, does it ignore tagging it or creates a tag with empty value?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mraju1 As per the synthesis docs: a tag is only created if the attribute is present on the matching data point. If it's absent, no tag gets written (not an empty-value tag).

So keeping host.type/cloud.provider/etc. in the rule is safe when the attribute is missing - the real risk we were discussing is only when the attribute is present but describes the wrong VM (collector's, not the DB's).

Also, can you please fix the errors thrown by entityBot?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants