-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Net O11y K8s cluster name retrieval (#648)
* Net O11y K8s cluster name retrieval * replace cluster.name by k8s.cluster.name * Add flow printer node * make linter happy * Fixed EC2 * updated NOTICE * Push vendor files * Fix azure endpoint
- Loading branch information
Showing
877 changed files
with
434,934 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package export | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/mariomac/pipes/pkg/node" | ||
|
||
"github.com/grafana/beyla/pkg/internal/netolly/ebpf" | ||
) | ||
|
||
type FlowPrinterEnabled bool | ||
|
||
func (fpe FlowPrinterEnabled) Enabled() bool { | ||
return bool(fpe) | ||
} | ||
|
||
func FlowPrinterProvider(_ FlowPrinterEnabled) (node.TerminalFunc[[]*ebpf.Record], error) { | ||
return func(in <-chan []*ebpf.Record) { | ||
for flows := range in { | ||
for _, flow := range flows { | ||
printFlow(flow) | ||
} | ||
} | ||
}, nil | ||
} | ||
|
||
func printFlow(f *ebpf.Record) { | ||
sb := strings.Builder{} | ||
sb.WriteString("beyla.ip==") | ||
sb.WriteString(f.Attrs.BeylaIP) | ||
sb.WriteString(" iface=") | ||
sb.WriteString(f.Attrs.Interface) | ||
sb.WriteString(" direction=") | ||
sb.WriteString(fmt.Sprint(f.Id.Direction)) | ||
sb.WriteString(" src.address=") | ||
sb.WriteString(f.Id.SrcIP().IP().String()) | ||
sb.WriteString(" dst.address=") | ||
sb.WriteString(f.Id.DstIP().IP().String()) | ||
sb.WriteString(" src.name=") | ||
sb.WriteString(f.Attrs.SrcName) | ||
sb.WriteString(" src.namespace=") | ||
sb.WriteString(f.Attrs.SrcNamespace) | ||
sb.WriteString(" dst.name=") | ||
sb.WriteString(f.Attrs.DstName) | ||
sb.WriteString(" dst.namespace=") | ||
sb.WriteString(f.Attrs.DstNamespace) | ||
|
||
for k, v := range f.Attrs.Metadata { | ||
sb.WriteString(" ") | ||
sb.WriteString(k) | ||
sb.WriteString("=") | ||
sb.WriteString(v) | ||
} | ||
|
||
fmt.Println("network_flow:", sb.String()) | ||
} |
Oops, something went wrong.