Add node name to early boot logging (#323)

Signed-off-by: Fabian Kammel <fk@edgeless.systems>
This commit is contained in:
Fabian Kammel 2022-08-01 12:32:28 +02:00 committed by GitHub
parent 050e8fdc4a
commit 19b731b5f7

View File

@ -39,9 +39,16 @@ func NewLogger(ctx context.Context, metadata *Metadata) (*Logger, error) {
if resp.Properties == nil || resp.Properties.InstrumentationKey == nil {
return nil, errors.New("unable to get instrumentation key")
}
client := appinsights.NewTelemetryClient(*resp.Properties.InstrumentationKey)
instance, err := metadata.GetInstance(ctx, providerID)
if err != nil {
return nil, err
}
client.Context().CommonProperties["instance-name"] = instance.Name
return &Logger{
client: appinsights.NewTelemetryClient(*resp.Properties.InstrumentationKey),
client: client,
}, nil
}