Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Fixes #871 - Metric schema and metadata #872

Merged
merged 11 commits into from
Apr 27, 2016
Merged

Conversation

jcooklin
Copy link
Collaborator

@jcooklin jcooklin commented Apr 22, 2016

Fixes #871 - Metric schema metadata

Summary of changes:

  • Add (long) description to a cataloged metric
  • Add (short) description of namespace elements
  • Add the field 'unit'
  • Remove the field 'source'
  • Add standard tags
  • Replace the field label with the same behavior on the namespace

Testing done:

  • unit
  • functional
  • manual

@intelsdi-x/snap-maintainers

@jcooklin jcooklin changed the title Schema Metric schema and metadata Apr 23, 2016
func validateMetricNamespace(ns []string) error {
name := strings.Join(ns, "")
func validateMetricNamespace(ns core.Namespace) error {
// name := strings.Join(ns, "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove this.

@@ -1035,20 +1035,20 @@ func (r *requestedPlugin) Config() *cdata.ConfigDataNode {
// ------------------- helper struct and function for grouping metrics types ------

// just a tuple of loadedPlugin and metricType slice
type pluginMetricTypes struct {
type metricTypes struct {
Copy link
Contributor

@candysmurf candysmurf Apr 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overloading types here for the different packages. Is it a good practice in Golang? I just noticed that it's local. It's probably fine. Even that it could be confusing.

// NewNamespace takes an array of strings and returns a Namespace. A Namespace
// is an array of NamespaceElements. The provided array of strings is used to
// set the corresponding Value fields in the array of NamespaceElements.
func NewNamespace(ns []string) Namespace {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that only "NamespaceElement.Value" is used now. Would you please elaborate the potential use of Name field?

@candysmurf
Copy link
Contributor

👍 all tests passed. Other than my minor questions, LGTM.

// Reapply standard tags after collection as a precaution. It is common for
// plugin authors to inadvertently overwrite or not pass along the data
// passed to CollectMetrics so we will help them out here.
for i, _ := range m {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gofmt complains about this line on travis. Need to omit the _.

So(m[1].Data(), ShouldResemble, "2")
})

Convey("error on bad corrupt data", func() {
a = []byte{1, 0, 1, 1, 1, 1, 1, 0, 0, 1}
m, e = UnmarshallPluginMetricTypes("snap.gob", a)
m, e = UnmarshallMetricTypes("snap.gob", a)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was from before...but Unmarshal has only one l

@tiffanyfay
Copy link
Contributor

Other than typos that were already there (so could be changed later...) 👍

@jcooklin jcooklin merged commit f598bd1 into intelsdi-x:master Apr 27, 2016
@jcooklin jcooklin changed the title Metric schema and metadata Fixes #871 - Metric schema and metadata Apr 27, 2016
@IzabellaRaulin
Copy link
Contributor

I've just added labels to show that this pull request is a good example of using breaking-change/ labels and status/needs-2nd-review to highlight that specialized and in-depth review was needed

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

Successfully merging this pull request may close these issues.

5 participants