File: example_new_test.go

package info (click to toggle)
golang-opentelemetry-contrib 0.56.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,884 kB
  • sloc: makefile: 278; sh: 211; sed: 1
file content (22 lines) | stat: -rw-r--r-- 471 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

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())
}