Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for semantic convention 1_20 and 1_23 #1903

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Sanjalee-NewRelic
Copy link
Contributor

@Sanjalee-NewRelic Sanjalee-NewRelic commented Feb 7, 2025

Relevant information

Modified relationships to support otel semantic conventions version 1.20 and 1.23

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.

github-actions[bot]
github-actions bot previously approved these changes Feb 7, 2025
@Sanjalee-NewRelic Sanjalee-NewRelic changed the title fix: Add support for semantic convention 1_20 and 1_23 <DO NOT MERGE> Add support for semantic convention 1_20 and 1_23 Feb 7, 2025
Comment on lines 37 to 38
- attribute: span.kind
anyOf: [ "producer" ]
Copy link
Member

Choose a reason for hiding this comment

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

With regards to span.kind the conventions state

A producer of a message should set the span kind to PRODUCER unless it synchronously waits for a response: then it should use CLIENT. The processor of the message should set the kind to CONSUMER, unless it always sends back a reply that is directed to the producer of the message (as opposed to e.g., a queue on which the producer happens to listen): then it should use SERVER.

All span.kind conditions should be updated as follows:

For relationshipType=PRODUCES

      - attribute: span.kind
        anyOf: [ "producer", "client" ]

For relationshipType=CONSUMES

      - attribute: span.kind
        anyOf: [ "consumer", "server" ]

Copy link
Member

Choose a reason for hiding this comment

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

Should the name of this file be EXT-SERVICE-to-INFRA-AWSMQBROKER? Or do we anticipate that in the future this file will contain relationship definitions for MQ Brokers other than AWS?

Copy link
Contributor

Choose a reason for hiding this comment

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

Please let's keep it scoped to the domain/types involved, we can create another file if we need to extend beyond of AWS.

Copy link
Member

@alanwest alanwest Feb 10, 2025

Choose a reason for hiding this comment

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

@Sanjalee-NewRelic please rename the file to be specific to AWS EXT-SERVICE-to-INFRA-AWSMQBROKER.yml

Comment on lines 61 to 69
conditions:
- attribute: eventType
anyOf: [ "Span" ]
- attribute: span.kind
anyOf: [ "consumer" ]
- attribute: messaging.system
anyOf: [ "rabbitmq", "activemq" ]
- attribute: server.address
present: true
Copy link
Member

Choose a reason for hiding this comment

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

The conditions for all the rules in this file are not sufficient for constraining them to target only EXT-SERVICE entities.

I suggest we add these additional conditions to all rules similar to what we have done for our infra-host to ext-service relationship:

- attribute: newrelic.source
anyOf: [ "api.traces.otlp" ]
- attribute: entity.type
anyOf: [ "SERVICE" ]

Constraining both on newrelic.source and entity.type give us higher confidence that this rule specifically targets OpenTelemetry instrumented services.

Comment on lines 22 to 27
target:
lookupGuid:
candidateCategory: AWSMQBROKER
fields:
- field: endpoint
attribute: net.peer.name
Copy link
Member

Choose a reason for hiding this comment

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

Currently, this lookup onMiss will create an an uninstrumented MQBROKER entity.

onMiss:
action: CREATE_UNINSTRUMENTED
uninstrumented:
type: MQBROKER

In the future if we add new relationships supporting messaging systems besides AWS (e.g., RabbitMQ hosted elsewhere), will this rule cause us to falsely create uninstrumented relationships?

If so, then we may need to constrain this rule to be AWS specific. Maybe like so?

    conditions:
      - attribute: net.peer.name
         regex: <regex that identifies this is AWS>

Comment on lines 31 to 33
origins:
- Distributed Tracing
- OpenTelemetry
Copy link
Member

Choose a reason for hiding this comment

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

It's not entirely clear what origins should be used here. In reviewing other rules it seems we are inconsistent.

For example, the infra-host to ext-service rule derived from span data only uses an origin of Distributed Tracing:

Whereas the the infra-host to ext-service rule derived from metric data only uses an origin of OpenTelemetry:

I can see the following origins being relevant to the rules in this PR:

  • Distributed Tracing because these rules target span data.
  • OpenTelemetry because these rules are meant to target OpenTelemetry instrumented services
  • AWS Integration because these rules target our AWS Metric Streams integration

Copy link
Member

Choose a reason for hiding this comment

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

@otaviocarvalho can you provide some guidance here? From what I can tell these origins have been inconsistently applied across other relationship rules, so it doesn't seem like they're very important.

All three origins are relevant to the domain of these rules. Is the practice that we should list all relevant origins? Or does it not really matter?

Comment on lines +63 to +64
- field: topic
attribute: messaging.destination.name
Copy link
Member

Choose a reason for hiding this comment

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

messaging.destination.name is not guaranteed to exist. If these rules require it be present then it should be added to the conditions

    conditions:
      ...
      - attribute: messaging.destination.name
         present: true

Comment on lines +25 to +26
attribute: net.peer.name
regex: "^[^\\.]+\\.([^\\.]+)\\.[^\\.]+\\.[^\\.]+\\.kafka\\.[^\\.]+\\.amazonaws\\.com:[0-9]+.*"
Copy link
Member

Choose a reason for hiding this comment

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

Similar to my question above, should this rule be constrained by adding a condition that makes it specific to AWS?

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably being too pragmatic, but if the domain includes amazonaws...com there is no way it will not be specific to AWS. Alternatively, you can add and check a specific tag for this purpose.

otaviocarvalho
otaviocarvalho previously approved these changes Feb 10, 2025
Copy link
Contributor

@otaviocarvalho otaviocarvalho left a comment

Choose a reason for hiding this comment

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

LGTM. This PR needs detailed attention from Entity Platform, to make sure we are disabling all sub-rules before it goes into production (to avoid enabling it automatically by mistake).

github-actions[bot]
github-actions bot previously approved these changes Feb 10, 2025
github-actions[bot]
github-actions bot previously approved these changes Feb 10, 2025
Comment on lines 35 to 43
conditions:
- attribute: eventType
anyOf: [ "Span" ]
- attribute: db.system
anyOf: [ "memcached" ]
- attribute: net.peer.name
present: true
- attribute: net.peer.port
present: false
Copy link
Member

Choose a reason for hiding this comment

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

@Sanjalee-NewRelic These rules for memcached should also be constrained by entity.type and newrelic.source

- attribute: newrelic.source
anyOf: [ "api.traces.otlp" ]
- attribute: entity.type
anyOf: [ "SERVICE" ]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the conditions @alanwest

github-actions[bot]
github-actions bot previously approved these changes Feb 10, 2025
Copy link
Member

@alanwest alanwest left a comment

Choose a reason for hiding this comment

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

This PR looks good now. @Sanjalee-NewRelic please handle this last piece of feedback #1903 (comment)

github-actions[bot]
github-actions bot previously approved these changes Feb 11, 2025
@Sanjalee-NewRelic Sanjalee-NewRelic changed the title <DO NOT MERGE> Add support for semantic convention 1_20 and 1_23 Add support for semantic convention 1_20 and 1_23 Feb 11, 2025
Comment on lines +110 to +111
- attribute: db.system
anyOf: [ "memcached" ]
Copy link
Member

@alanwest alanwest Feb 12, 2025

Choose a reason for hiding this comment

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

@Sanjalee-NewRelic After reviewing the rules for redis, it looks like they are restricted to AWS.

See: https://github.com/newrelic/entity-definitions/pull/1904/files#diff-f8b949e2507623f79e34ed7186ae981c06082c0e27013bce60088e0d0de9beb2R52

I think it makes sense to do the same for memcached, right?

Something like

- attribute: server.address
   regex: <regex constraining this to AWS>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, This can be done. Made the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants