osdctl icon indicating copy to clipboard operation
osdctl copied to clipboard

minimal example of working metrics

Open iamkirkbater opened this issue 4 months ago • 4 comments

A minimal working example of metric collection using iamkirkbater/cobra-otel-metrics.

Marking this as a draft as I'd still like to finish adding some functionality to the cobra-otel-metrics package itself around the opt-in data controls. Additionally I'd like to get a working HTTP or GRPC collector working and test this "over the net". This is currently using a stdout exporter, which just creates a bunch of, what would be best considered "noise" to the average person, but here is what the metric would look like for a osdctl cluster context --cluster-id command invocation:

{
  "Resource": [{"Key":"service.name","Value":{"Type":"STRING","Value":"osdctl"}}],
  "ScopeMetrics":[{
    "Scope":{"Name":"cobra-otel-metrics","Version":"","SchemaURL":"","Attributes":null},
    "Metrics":[{
      "Name":"cluster-context",
      "Description":"Command Invocation",
      "Unit":"1",
      "Data":{
        "DataPoints":[{
          "Attributes":[
            {"Key":"cluster-id","Value":{"Type":"INT64","Value":1}},
            {"Key":"tty","Value":{"Type":"BOOL","Value":true}}
          ],
          "StartTime":"2025-08-04T10:15:29.409684-04:00",
          "Time":"2025-08-04T10:15:31.405611-04:00",
          "Value":1
        }],
        "Temporality":"CumulativeTemporality",
        "IsMonotonic":true
      }
    }]
  }]
}

iamkirkbater avatar Aug 04 '25 14:08 iamkirkbater

Skipping CI for Draft Pull Request. If you want CI signal for your change, please convert it to an actual PR. You can still manually trigger a test run with /test all

openshift-ci[bot] avatar Aug 04 '25 14:08 openshift-ci[bot]

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: iamkirkbater

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar Aug 04 '25 14:08 openshift-ci[bot]

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

openshift-merge-robot avatar Aug 08 '25 07:08 openshift-merge-robot

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot avatar Nov 06 '25 09:11 openshift-bot