-
Notifications
You must be signed in to change notification settings - Fork 584
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
76 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,3 @@ | ||
# Azure VM Resource detector | ||
|
||
The Azure VM resource detector supports detecting attributes specific to Azure VMs. | ||
|
||
## Usage | ||
|
||
```golang | ||
// Instantiate a new Azure VM resource detector | ||
azureVmResourceDetector := azurevm.New() | ||
resource, err := azureVmResourceDetector.Detect(context.Background()) | ||
``` | ||
|
||
## Supported attributes | ||
|
||
According to semantic conventions for | ||
[host](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/resource/host.md), | ||
[cloud](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/resource/cloud.md), | ||
and | ||
[os](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/resource/os.md) | ||
attributes, each of the following attributes is added if it is available: | ||
|
||
* `cloud.provider` | ||
* `cloud.platform` | ||
* `cloud.region` | ||
* `cloud.resource_id` | ||
* `host.id` | ||
* `host.name` | ||
* `host.type` | ||
* `os.type` | ||
* `os.version` | ||
[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/contrib/detectors/azure/azurevm)](https://pkg.go.dev/go.opentelemetry.io/contrib/detectors/azure/azurevm) |
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,24 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
/* | ||
The Azure VM [resource.Detector] supports detecting attributes specific to Azure VMs. | ||
According to semantic conventions for [host], [cloud], and [os] attributes, | ||
each of the following attributes is added if it is available: | ||
- cloud.provider | ||
- cloud.platform | ||
- cloud.region | ||
- cloud.resource_id | ||
- host.id | ||
- host.name | ||
- host.type | ||
- os.type | ||
- os.version | ||
[host]: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/resource/host.md | ||
[cloud]: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/resource/cloud.md | ||
[os]: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/resource/os.md | ||
*/ | ||
package azurevm // import "go.opentelemetry.io/contrib/detectors/azure/azurevm" |
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,20 @@ | ||
package azurevm_test | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"go.opentelemetry.io/contrib/detectors/azure/azurevm" | ||
) | ||
|
||
func ExampleNew() { | ||
azureVmResourceDetector := azurevm.New() | ||
resource, err := azureVmResourceDetector.Detect(context.Background()) | ||
|
||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
// Now, you can use the resource (e.g. pass it to a tracer or meter provider). | ||
fmt.Println(resource.SchemaURL()) | ||
} |
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