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

Rename otel/label -> otel/attribute #1541

Merged
merged 11 commits into from
Feb 18, 2021
Merged

Conversation

punya
Copy link
Member

@punya punya commented Feb 16, 2021

Fixes #1069.

Leave the imported name alone, to avoid a large diff and conflicts
CHANGELOG.md Outdated Show resolved Hide resolved
attr/doc.go Outdated Show resolved Hide resolved
punya and others added 2 commits February 16, 2021 21:44
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Copy link
Member

@XSAM XSAM left a comment

Choose a reason for hiding this comment

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

Should we use attribute as the package name instead of attr?

attr is short and elegant, but there is no naming in Specification called attr; I'm worried about this inconsistency might confuse end-users.

@punya punya changed the title Rename otel/label -> otel/attr Rename otel/label -> otel/attribute Feb 17, 2021
Copy link
Member

@Aneurysm9 Aneurysm9 left a comment

Choose a reason for hiding this comment

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

I appreciate the desire to minimize the changes to review in this diff, but it seems that using import renaming to avoid changing all references from label to attribute results in go doc continuing to reference label in exported function and type signatures. I worry that this could lead to confusion when users look to import a label package but don't find one.

@codecov
Copy link

codecov bot commented Feb 17, 2021

Codecov Report

Merging #1541 (4ee7baf) into main (1b5b662) will increase coverage by 0.1%.
The diff coverage is 85.7%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #1541     +/-   ##
=======================================
+ Coverage   77.9%   78.0%   +0.1%     
=======================================
  Files        127     127             
  Lines       6582    6582             
=======================================
+ Hits        5128    5136      +8     
+ Misses      1209    1201      -8     
  Partials     245     245             
Impacted Files Coverage Δ
attribute/encoder.go 85.1% <ø> (ø)
attribute/iterator.go 82.9% <ø> (ø)
attribute/key.go 100.0% <ø> (ø)
attribute/kv.go 82.1% <ø> (ø)
attribute/set.go 57.1% <ø> (ø)
attribute/type_string.go 10.0% <ø> (ø)
attribute/value.go 90.9% <ø> (ø)
bridge/opentracing/internal/mock.go 74.3% <0.0%> (ø)
exporters/stdout/config.go 70.0% <ø> (ø)
exporters/trace/zipkin/model.go 98.6% <ø> (ø)
... and 46 more

@punya
Copy link
Member Author

punya commented Feb 17, 2021

Note that after this change, we still have some public identifiers that mention "label". Should any of these be changed too?

10 results - 4 files

exporters/otlp/internal/opentelemetry-proto-gen/metrics/v1/metrics.pb.go:
   850  	// The set of labels that uniquely identify this timeseries.
   851: 	Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"`
   852  	// start_time_unix_nano is the last time when the aggregation value was reset

   951  	// The set of labels that uniquely identify this timeseries.
   952: 	Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"`
   953  	// start_time_unix_nano is the last time when the aggregation value was reset

  1054  	// The set of labels that uniquely identify this timeseries.
  1055: 	Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"`
  1056  	// start_time_unix_nano is the last time when the aggregation value was reset

  1207  	// The set of labels that uniquely identify this timeseries.
  1208: 	Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"`
  1209  	// start_time_unix_nano is the last time when the aggregation value was reset

exporters/stdout/config.go:
   46  	// LabelEncoder encodes the labels.
   47: 	LabelEncoder attribute.Encoder
   48  

  119  type labelEncoderOption struct {
  120: 	LabelEncoder attribute.Encoder
  121  }

oteltest/meter.go:
   31  		Instrument *Sync
   32: 		Labels     []attribute.KeyValue
   33  	}

   38  		Ctx          context.Context
   39: 		Labels       []attribute.KeyValue
   40  		LibraryName  string

  201  	InstrumentationVersion string
  202: 	Labels                 map[attribute.Key]attribute.Value
  203  	Number                 number.Number

sdk/metric/processor/reducer/reducer.go:
  32  	// specific Filter to an instrument.
  33: 	LabelFilterSelector interface {
  34  		LabelFilterFor(descriptor *metric.Descriptor) attribute.Filter

@Aneurysm9
Copy link
Member

Note that after this change, we still have some public identifiers that mention "label". Should any of these be changed too?

Other than the ones in the protobuf, which should probably be addressed via OTLP changes, yeah I would think those should change to Attribute as well. Thoughts @MrAlias?

@punya
Copy link
Member Author

punya commented Feb 18, 2021

@Aneurysm9 @XSAM can we leave those for future PRs? Some of them are related to metrics (not trace) and the change should probably cover names, comments, docs, etc. The package rename should suffice to unblock the trace release.

I can file an issue to track getting rid of the concept of "labels" more broadly.

Copy link
Member

@Aneurysm9 Aneurysm9 left a comment

Choose a reason for hiding this comment

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

Going to merge this as-is to avoid keeping a large PR hanging out there for too long then I'll create a new issue for 1.0.0 to address the public API pieces still referencing Label.

@@ -55,7 +55,7 @@ func (i *Iterator) Attribute() KeyValue {
return i.Label()
}

// IndexedLabel returns current index and label. Must be called only
// IndexedLabel returns current index and attribute. Must be called only
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// IndexedLabel returns current index and attribute. Must be called only
// IndexedAttribute returns current index and attribute. Must be called only

Also the Label() method should be changed to Attribute(). Since these are public API changes I don't think we can defer them.

@Aneurysm9 Aneurysm9 merged commit ecf65d7 into open-telemetry:main Feb 18, 2021
@punya punya deleted the label-to-attr branch February 18, 2021 18:04
This was referenced Mar 11, 2021
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

Successfully merging this pull request may close these issues.

Unify Attributes and Labels
5 participants