Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/cmd/pdatagen/internal/pdata/one_of_field.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

const oneOfAccessorTemplate = `// {{ .typeFuncName }} returns the type of the {{ .lowerOriginFieldName }} for this {{ .structName }}.
// Calling this function on zero-initialized {{ .structName }} will cause a panic.
// Calling this function on zero-initialized {{ .structName }} is invalid and will cause a panic.
func (ms {{ .structName }}) {{ .typeFuncName }}() {{ .typeName }} {
switch ms.{{ .origAccessor }}.{{ .originFieldName }}.(type) {
{{- range .values }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const oneOfMessageAccessorsTemplate = `// {{ .fieldName }} returns the {{ .lower
// Calling this function when {{ .originOneOfTypeFuncName }}() != {{ .typeName }} returns an invalid
// zero-initialized instance of {{ .returnType }}. Note that using such {{ .returnType }} instance can cause panic.
//
// Calling this function on zero-initialized {{ .structName }} will cause a panic.
// Calling this function on zero-initialized {{ .structName }} is invalid and will cause a panic.
func (ms {{ .structName }}) {{ .fieldName }}() {{ .returnType }} {
v, ok := ms.orig.Get{{ .originOneOfFieldName }}().(*internal.{{ .originStructType }})
if !ok {
Expand All @@ -28,7 +28,7 @@ func (ms {{ .structName }}) {{ .fieldName }}() {{ .returnType }} {
//
// After this, {{ .originOneOfTypeFuncName }}() function will return {{ .typeName }}".
//
// Calling this function on zero-initialized {{ .structName }} will cause a panic.
// Calling this function on zero-initialized {{ .structName }} is invalid and will cause a panic.
func (ms {{ .structName }}) SetEmpty{{ .fieldName }}() {{ .returnType }} {
ms.state.AssertMutable()
var ov *internal.{{ .originStructType }}
Expand Down
24 changes: 12 additions & 12 deletions pdata/pcommon/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (v Value) getState() *internal.State {
}

// FromRaw sets the value from the given raw value.
// Calling this function on zero-initialized Value will cause a panic.
// Calling this function on zero-initialized Value is invalid and will cause a panic.
func (v Value) FromRaw(iv any) error {
switch tv := iv.(type) {
case nil:
Expand Down Expand Up @@ -194,7 +194,7 @@ func (v Value) FromRaw(iv any) error {
}

// Type returns the type of the value for this Value.
// Calling this function on zero-initialized Value will cause a panic.
// Calling this function on zero-initialized Value is invalid and will cause a panic.
func (v Value) Type() ValueType {
switch v.getOrig().Value.(type) {
case *internal.AnyValue_StringValue:
Expand Down Expand Up @@ -277,7 +277,7 @@ func (v Value) Bytes() ByteSlice {
// it also changes the type to be ValueTypeStr.
// The shorter name is used instead of SetString to avoid implementing
// fmt.Stringer interface by the corresponding getter method.
// Calling this function on zero-initialized Value will cause a panic.
// Calling this function on zero-initialized Value is invalid and will cause a panic.
func (v Value) SetStr(sv string) {
v.getState().AssertMutable()
// Delete everything but the AnyValue object itself.
Expand All @@ -289,7 +289,7 @@ func (v Value) SetStr(sv string) {

// SetInt replaces the int64 value associated with this Value,
// it also changes the type to be ValueTypeInt.
// Calling this function on zero-initialized Value will cause a panic.
// Calling this function on zero-initialized Value is invalid and will cause a panic.
func (v Value) SetInt(iv int64) {
v.getState().AssertMutable()
// Delete everything but the AnyValue object itself.
Expand All @@ -301,7 +301,7 @@ func (v Value) SetInt(iv int64) {

// SetDouble replaces the float64 value associated with this Value,
// it also changes the type to be ValueTypeDouble.
// Calling this function on zero-initialized Value will cause a panic.
// Calling this function on zero-initialized Value is invalid and will cause a panic.
func (v Value) SetDouble(dv float64) {
v.getState().AssertMutable()
// Delete everything but the AnyValue object itself.
Expand All @@ -313,7 +313,7 @@ func (v Value) SetDouble(dv float64) {

// SetBool replaces the bool value associated with this Value,
// it also changes the type to be ValueTypeBool.
// Calling this function on zero-initialized Value will cause a panic.
// Calling this function on zero-initialized Value is invalid and will cause a panic.
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid unrelated changes

func (v Value) SetBool(bv bool) {
v.getState().AssertMutable()
// Delete everything but the AnyValue object itself.
Expand All @@ -324,7 +324,7 @@ func (v Value) SetBool(bv bool) {
}

// SetEmptyBytes sets value to an empty byte slice and returns it.
// Calling this function on zero-initialized Value will cause a panic.
// Calling this function on zero-initialized Value is invalid and will cause a panic.
func (v Value) SetEmptyBytes() ByteSlice {
v.getState().AssertMutable()
// Delete everything but the AnyValue object itself.
Expand All @@ -335,7 +335,7 @@ func (v Value) SetEmptyBytes() ByteSlice {
}

// SetEmptyMap sets value to an empty map and returns it.
// Calling this function on zero-initialized Value will cause a panic.
// Calling this function on zero-initialized Value is invalid and will cause a panic.
func (v Value) SetEmptyMap() Map {
v.getState().AssertMutable()
// Delete everything but the AnyValue object itself.
Expand All @@ -347,7 +347,7 @@ func (v Value) SetEmptyMap() Map {
}

// SetEmptySlice sets value to an empty slice and returns it.
// Calling this function on zero-initialized Value will cause a panic.
// Calling this function on zero-initialized Value is invalid and will cause a panic.
func (v Value) SetEmptySlice() Slice {
v.getState().AssertMutable()
// Delete everything but the AnyValue object itself.
Expand All @@ -360,7 +360,7 @@ func (v Value) SetEmptySlice() Slice {

// MoveTo moves the Value from current overriding the destination and
// resetting the current instance to empty value.
// Calling this function on zero-initialized Value will cause a panic.
// Calling this function on zero-initialized Value is invalid and will cause a panic.
func (v Value) MoveTo(dest Value) {
v.getState().AssertMutable()
dest.getState().AssertMutable()
Expand All @@ -373,7 +373,7 @@ func (v Value) MoveTo(dest Value) {
}

// CopyTo copies the Value instance overriding the destination.
// Calling this function on zero-initialized Value will cause a panic.
// Calling this function on zero-initialized Value is invalid and will cause a panic.
func (v Value) CopyTo(dest Value) {
dest.getState().AssertMutable()
internal.CopyAnyValue(dest.getOrig(), v.getOrig())
Expand All @@ -382,7 +382,7 @@ func (v Value) CopyTo(dest Value) {
// AsString converts an OTLP Value object of any type to its equivalent string
// representation. This differs from Str which only returns a non-empty value
// if the ValueType is ValueTypeStr.
// Calling this function on zero-initialized Value will cause a panic.
// Calling this function on zero-initialized Value is invalid and will cause a panic.
func (v Value) AsString() string {
switch v.Type() {
case ValueTypeEmpty:
Expand Down
2 changes: 1 addition & 1 deletion pdata/pmetric/generated_exemplar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions pdata/pmetric/generated_metric.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pdata/pmetric/generated_numberdatapoint.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"go.opentelemetry.io/collector/service/internal/proctelemetry"
"go.opentelemetry.io/collector/service/internal/status"
"go.opentelemetry.io/collector/service/telemetry"
"go.opentelemetry.io/collector/service/telemetry/otelconftelemetry"
)

// This feature gate is deprecated and will be removed in 1.40.0. Views can now be configured.
Expand Down Expand Up @@ -234,8 +235,11 @@ func New(ctx context.Context, set Settings, cfg Config) (_ *Service, resultErr e
return nil, err
}

if err := proctelemetry.RegisterProcessMetrics(srv.telemetrySettings); err != nil {
return nil, fmt.Errorf("failed to register process metrics: %w", err)
// Only register process metrics if metrics telemetry is enabled
if telemetryCfg, ok := cfg.Telemetry.(*otelconftelemetry.Config); !ok || telemetryCfg.Metrics.Level != configtelemetry.LevelNone {
if err := proctelemetry.RegisterProcessMetrics(srv.telemetrySettings); err != nil {
return nil, fmt.Errorf("failed to register process metrics: %w", err)
}
}
return srv, nil
}
Expand Down
Loading