Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The property 'labels' exists on multiple object types #8

Open
DennisL68 opened this issue May 29, 2023 · 0 comments
Open

The property 'labels' exists on multiple object types #8

DennisL68 opened this issue May 29, 2023 · 0 comments

Comments

@DennisL68
Copy link

DennisL68 commented May 29, 2023

When trouble shooting the collector I can't display the Labels for the Metrics definition and the Labels property for the actual metric object at the same time.

When trying to list all values in action during a trouble shooting session

$ExampleDescriptor = New-MetricDescriptor `
  -Name "ExampleDescriptor" `
  -Type gauge `
  -Help "Some help" `
  -Labels "Instance"

$Metrics = @(
  New-Metric `
    -MetricDesc $ExampleDescriptor `
    -Value 10 `
    -Labels ("example")
)

examination of the object is possible separately using

C:\> $Metrics

Descriptor Value Labels
---------- ----- ------
MetricDesc    10 {example}

C:\> $Metrics | select -ExpandProperty Descriptor

Name              Help       Type Labels
----              ----       ---- ------
ExampleDescriptor Some help gauge {Instance}

but not using a "combined view"

C:\> $Metrics | select Value, Labels -ExpandProperty Descriptor | ft
Select-Object: The property cannot be processed because the property "Labels" already exists.

Value Name              Help       Type Labels
----- ----              ----       ---- ------
   10 ExampleDescriptor Some help gauge {Instance}

I could of course use a calculated property during output

$Metrics | select Value, @{l='LabelValue'; e={$_.Labels}} -ExpandProperty Descriptor | ft

Value LabelValue Name              Help       Type Labels
----- ---------- ----              ----       ---- ------
   10 example    ExampleDescriptor Some help gauge {Instance}

The property Labels is clearly for different use depending on the object related, and so should have different names to better separate them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant