Skip to content

Commit

Permalink
[processor/resourcedetection] save "name" from Azure metadata in azur…
Browse files Browse the repository at this point in the history
…e.vm.name attr (#12914)

[processor/resourcedetection] save "name" from Azure metadata API in azure.vm.name attribute
  • Loading branch information
pmcollins authored Aug 3, 2022
1 parent eee30b0 commit 456d0c6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions processor/resourcedetectionprocessor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ Queries the [Azure Instance Metadata Service](https://aka.ms/azureimds) to retri
* cloud.account.id (subscription ID)
* host.id (virtual machine ID)
* host.name
* azure.vm.name (same as host.name)
* azure.vm.size (virtual machine size)
* azure.vm.scaleset.name (name of the scale set if any)
* azure.resourcegroup.name (resource group name)
Expand Down
3 changes: 3 additions & 0 deletions processor/resourcedetectionprocessor/internal/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ func (d *Detector) Detect(ctx context.Context) (resource pcommon.Resource, schem
attrs.InsertString(conventions.AttributeCloudRegion, compute.Location)
attrs.InsertString(conventions.AttributeHostID, compute.VMID)
attrs.InsertString(conventions.AttributeCloudAccountID, compute.SubscriptionID)
// Also save compute.Name in "azure.vm.name" as host.id (AttributeHostName) is
// used by system detector.
attrs.InsertString("azure.vm.name", compute.Name)
attrs.InsertString("azure.vm.size", compute.VMSize)
attrs.InsertString("azure.vm.scaleset.name", compute.VMScaleSetName)
attrs.InsertString("azure.resourcegroup.name", compute.ResourceGroupName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func TestDetectAzureAvailable(t *testing.T) {
conventions.AttributeCloudRegion: "location",
conventions.AttributeHostID: "vmID",
conventions.AttributeCloudAccountID: "subscriptionID",
"azure.vm.name": "name",
"azure.vm.size": "vmSize",
"azure.resourcegroup.name": "resourceGroup",
"azure.vm.scaleset.name": "myScaleset",
Expand Down
16 changes: 16 additions & 0 deletions unreleased/fqdn-fix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: resourcedetectionprocessor

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: update Azure resource detector to save "name" from Azure metadata API in azure.vm.name attribute

# One or more tracking issues related to the change
issues: [12779]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

0 comments on commit 456d0c6

Please sign in to comment.