feat: add standalone server topology view
This commit is contained in:
@@ -16,10 +16,11 @@ import (
|
||||
const rawExportFormatV1 = "logpile.raw-export.v1"
|
||||
|
||||
const (
|
||||
rawExportBundlePackageFile = "raw_export.json"
|
||||
rawExportBundleLogFile = "collect.log"
|
||||
rawExportBundleFieldsFile = "parser_fields.json"
|
||||
rawExportBundlePrivacyFile = "privacy_report.json"
|
||||
rawExportBundlePackageFile = "raw_export.json"
|
||||
rawExportBundleLogFile = "collect.log"
|
||||
rawExportBundleFieldsFile = "parser_fields.json"
|
||||
rawExportBundlePrivacyFile = "privacy_report.json"
|
||||
rawExportBundleTopologyFile = "topology.json"
|
||||
)
|
||||
|
||||
type RawExportPackage struct {
|
||||
@@ -165,6 +166,20 @@ func buildRawExportBundle(pkg *RawExportPackage, result *models.AnalysisResult,
|
||||
}
|
||||
}
|
||||
|
||||
if topologyDoc, topologyErr := currentTopologyDocument(result); topologyErr == nil && len(topologyDoc.Nodes) > 0 {
|
||||
tf, err := zw.Create(rawExportBundleTopologyFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
topologyJSON, err := json.MarshalIndent(topologyDoc, "", " ")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, err := tf.Write(topologyJSON); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if err := zw.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user