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

Entity relationship synthesis with the New Relic eBPF agent #1421

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions entity-types/ebpf-client/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
domain: EBPF
type: CLIENT
synthesis:
rules:
# Client Entity for Client-Captured Spans (kind == client)
- name: local_addr
identifier: local_addr
encodeIdentifierInGUID: true
conditions:
- attribute: instrumentation.provider
value: nr_ebpf_agent
- attribute: kind
value: "client"
tags:
local_addr:
entityTagName: "ip"
11 changes: 11 additions & 0 deletions entity-types/ebpf-client/tests/Span.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"redis.req_cmd": "HMGET",
"instrumentation.provider": "nr_ebpf_agent",
"kind": "client",
"local_addr": "192.xxx.x.xx",
"local_port": "92" ,
"remote_addr": "198.xxx.x.xx",
"remote_port": "98"
}
]
24 changes: 24 additions & 0 deletions entity-types/ebpf-redis_server/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
domain: EBPF
type: REDIS_SERVER
synthesis:
rules:
# Server Entity for Server-Captured Spans (kind == server)
- compositeIdentifier:
separator: ":"
attributes:
- local_addr
- local_port
name: local_addr
encodeIdentifierInGUID: true
conditions:
- attribute: redis.req_cmd
present: true
- attribute: instrumentation.provider
value: "nr_ebpf_agent"
- attribute: kind
value: "server"
tags:
local_addr:
entityTagName: "ip"
local_port:
entityTagName: "port"
11 changes: 11 additions & 0 deletions entity-types/ebpf-redis_server/tests/Span.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"redis.req_cmd": "HMGET",
"instrumentation.provider": "nr_ebpf_agent",
"kind": "server",
"local_addr": "198.xxx.x.xx",
"local_port": "98",
"remote_addr": "192.xxx.x.xx",
"remote_port": "92"
}
]
16 changes: 16 additions & 0 deletions relationships/candidates/EBPFCLIENT.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
category: EBPFCLIENT
lookups:
- entityTypes:
- domain: EBPF
type: CLIENT
tags:
matchingMode: ANY
predicates:
- tagKeys: ["ip"]
field: ip
onMatch:
onMultipleMatches: RELATE_ALL
onMiss:
action: CREATE_UNINSTRUMENTED
uninstrumented:
type: EBPFCLIENT
18 changes: 18 additions & 0 deletions relationships/candidates/EBPFSERVER.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
category: EBPFSERVER
lookups:
- entityTypes:
- domain: EBPF
type: REDIS_SERVER
tags:
matchingMode: ALL
predicates:
- tagKeys: ["ip"]
field: ip
- tagKeys: ["port"]
field: port
onMatch:
onMultipleMatches: RELATE_ALL
onMiss:
action: CREATE_UNINSTRUMENTED
uninstrumented:
type: EBPFSERVER
52 changes: 52 additions & 0 deletions relationships/synthesis/EBPF-CLIENT-to-EBPF_REDIS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
relationships:
- name: clientCallsRedisServerFromServerSpan
version: "1"
origins:
- Distributed Tracing
conditions:
- attribute: eventType
anyOf: [ "Span" ]
- attribute: entity.type
anyOf: [ "REDIS_SERVER" ]
- attribute: kind
value: "server"
relationship:
benkilimnik marked this conversation as resolved.
Show resolved Hide resolved
expires: P75M
relationshipType: CALLS
source:
lookupGuid:
candidateCategory: EBPFCLIENT
fields:
- field: ip
attribute: remote_addr # clientIP from server's perspective
target:
extractGuid:
attribute: entity.guid

- name: clientCallsRedisServerFromClientSpan
version: "1"
origins:
- Distributed Tracing
conditions:
- attribute: eventType
anyOf: [ "Span" ]
- attribute: entity.type
anyOf: [ "EBPF_CLIENT" ]
- attribute: kind
value: "client"
- attribute: redis.req_cmd
benkilimnik marked this conversation as resolved.
Show resolved Hide resolved
present: true
relationship:
expires: P75M
relationshipType: CALLS
source:
extractGuid:
attribute: entity.guid
target:
lookupGuid:
benkilimnik marked this conversation as resolved.
Show resolved Hide resolved
candidateCategory: EBPFSERVER
fields:
- field: ip
attribute: remote_addr # serverIP from client's perspective
- field: port
attribute: remote_port # serverPort from client's perspective
Loading