Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-sili authored Aug 16, 2024
2 parents 8cabd91 + abed3ab commit 505eef8
Show file tree
Hide file tree
Showing 80 changed files with 1,161 additions and 1,127 deletions.
25 changes: 25 additions & 0 deletions .chloggen/component-remove-reporting-from-struct-2-2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: extensions

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove `StatusWatcher` interface. Use `componentstatus.Watcher` instead.

# One or more tracking issues or pull requests related to the change
issues: [10777]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
25 changes: 25 additions & 0 deletions .chloggen/component-remove-reporting-from-struct-2-3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: component

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Removed Status related types and functions. Use `componentstatus` instead.

# One or more tracking issues or pull requests related to the change
issues: [10777]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
25 changes: 25 additions & 0 deletions .chloggen/component-remove-reporting-from-struct-2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: component

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove `ReportStatus` from `TelemetrySettings`. Use `componentstatus.ReportStatus` instead.

# One or more tracking issues or pull requests related to the change
issues: [10777]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
25 changes: 25 additions & 0 deletions .chloggen/mdatagen-context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: mdatagen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Update generated telemetry template to only include context import when there are async metrics.

# One or more tracking issues or pull requests related to the change
issues: [10883]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ When renaming or removing a configuration option:
- a WARN level message should be logged, with a link to a place within the component's repository where the change is
documented and a migration path is provided
- the option MUST be kept for at least N+1 version and MAY be hidden behind a feature gate in N+2
- the option and the WARN level message MAY be removed after N+2 or 6 months, whichever comes later
- the option and the WARN level message MUST NOT be removed earlier than N+2 or 6 months, whichever comes later

Additionally, when removing an option:
- the option MAY be made non-operational already by the same version where it is deprecated
Expand Down
1 change: 1 addition & 0 deletions cmd/builder/internal/builder/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var (
"",
"/component",
"/component/componentprofiles",
"/component/componentstatus",
"/client",
"/config/configauth",
"/config/configcompression",
Expand Down
1 change: 1 addition & 0 deletions cmd/builder/test/core.builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ replaces:
- go.opentelemetry.io/collector/client => ${WORKSPACE_DIR}/client
- go.opentelemetry.io/collector/component => ${WORKSPACE_DIR}/component
- go.opentelemetry.io/collector/component/componentprofiles => ${WORKSPACE_DIR}/component/componentprofiles
- go.opentelemetry.io/collector/component/componentstatus => ${WORKSPACE_DIR}/component/componentstatus
- go.opentelemetry.io/collector/config/configauth => ${WORKSPACE_DIR}/config/configauth
- go.opentelemetry.io/collector/config/configcompression => ${WORKSPACE_DIR}/config/configcompression
- go.opentelemetry.io/collector/config/configgrpc => ${WORKSPACE_DIR}/config/configgrpc
Expand Down
10 changes: 10 additions & 0 deletions cmd/mdatagen/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Metadata Generator

<!-- status autogenerated section -->
| Status | |
| ------------- |-----------|
| Stability | [alpha]: metrics |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Acmd%2Fmdatagen%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Acmd%2Fmdatagen) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Acmd%2Fmdatagen%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Acmd%2Fmdatagen) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@dmitryax](https://www.github.com/dmitryax) |

[alpha]: https://github.com/open-telemetry/opentelemetry-collector#alpha
<!-- end autogenerated section -->

Every component's documentation should include a brief description of the component and guidance on how to use it.
There is also some information about the component (or metadata) that should be included to help end-users understand the current state of the component and whether it is right for their use case.
Examples of this metadata about a component are:
Expand Down
2 changes: 2 additions & 0 deletions cmd/mdatagen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/glo
replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles

replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest

replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus
23 changes: 22 additions & 1 deletion cmd/mdatagen/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func TestRunContents(t *testing.T) {
tests := []struct {
yml string
wantMetricsGenerated bool
wantMetricsContext bool
wantConfigGenerated bool
wantTelemetryGenerated bool
wantStatusGenerated bool
Expand Down Expand Up @@ -98,6 +99,12 @@ func TestRunContents(t *testing.T) {
yml: "invalid_telemetry_missing_value_type_for_histogram.yaml",
wantErr: true,
},
{
yml: "async_metric.yaml",
wantMetricsGenerated: true,
wantConfigGenerated: true,
wantStatusGenerated: true,
},
}
for _, tt := range tests {
t.Run(tt.yml, func(t *testing.T) {
Expand All @@ -120,10 +127,18 @@ foo
}
require.NoError(t, err)

var contents []byte
if tt.wantMetricsGenerated {
require.FileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_metrics.go"))
require.FileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_metrics_test.go"))
require.FileExists(t, filepath.Join(tmpdir, "documentation.md"))
contents, err = os.ReadFile(filepath.Join(tmpdir, "internal/metadata/generated_metrics.go")) // nolint: gosec
require.NoError(t, err)
if tt.wantMetricsContext {
require.Contains(t, string(contents), "\"context\"")
} else {
require.NotContains(t, string(contents), "\"context\"")
}
} else {
require.NoFileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_metrics.go"))
require.NoFileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_metrics_test.go"))
Expand All @@ -141,6 +156,13 @@ foo
require.FileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_telemetry.go"))
require.FileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_telemetry_test.go"))
require.FileExists(t, filepath.Join(tmpdir, "documentation.md"))
contents, err = os.ReadFile(filepath.Join(tmpdir, "internal/metadata/generated_telemetry.go")) // nolint: gosec
require.NoError(t, err)
if tt.wantMetricsContext {
require.Contains(t, string(contents), "\"context\"")
} else {
require.NotContains(t, string(contents), "\"context\"")
}
} else {
require.NoFileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_telemetry.go"))
require.NoFileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_telemetry_test.go"))
Expand All @@ -150,7 +172,6 @@ foo
require.NoFileExists(t, filepath.Join(tmpdir, "documentation.md"))
}

var contents []byte
if tt.wantStatusGenerated {
require.FileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_status.go"))
contents, err = os.ReadFile(filepath.Join(tmpdir, "README.md")) // nolint: gosec
Expand Down
5 changes: 5 additions & 0 deletions cmd/mdatagen/templates/telemetry.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ package {{ .Package }}

import (
{{- if .Telemetry.Metrics }}
{{- range $_, $metric := .Telemetry.Metrics }}
{{- if $metric.Data.Async }}
"context"
{{- break}}
{{- end }}
{{- end }}
"errors"
{{- end }}

Expand Down
24 changes: 24 additions & 0 deletions cmd/mdatagen/testdata/async_metric.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
type: metricreceiver

status:
class: receiver
stability:
development: [logs]
beta: [traces]
stable: [metrics]
distributions: [contrib]
warnings:
- Any additional information that should be brought to the consumer's attention

metrics:
metric:
enabled: true
description: Description.
unit: s
gauge:
value_type: double
async: true

tests:
skip_lifecycle: true
skip_shutdown: true
1 change: 1 addition & 0 deletions cmd/otelcorecol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ replaces:
- go.opentelemetry.io/collector/otelcol => ../../otelcol
- go.opentelemetry.io/collector/component => ../../component
- go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles
- go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus
- go.opentelemetry.io/collector/config/configauth => ../../config/configauth
- go.opentelemetry.io/collector/config/configcompression => ../../config/configcompression
- go.opentelemetry.io/collector/config/configgrpc => ../../config/configgrpc
Expand Down
3 changes: 3 additions & 0 deletions cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ require (
go.opentelemetry.io/collector v0.107.0 // indirect
go.opentelemetry.io/collector/client v1.13.0 // indirect
go.opentelemetry.io/collector/component/componentprofiles v0.107.0 // indirect
go.opentelemetry.io/collector/component/componentstatus v0.107.0 // indirect
go.opentelemetry.io/collector/config/configauth v0.107.0 // indirect
go.opentelemetry.io/collector/config/configcompression v1.13.0 // indirect
go.opentelemetry.io/collector/config/configgrpc v0.107.0 // indirect
Expand Down Expand Up @@ -147,6 +148,8 @@ replace go.opentelemetry.io/collector/component => ../../component

replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles

replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus

replace go.opentelemetry.io/collector/config/configauth => ../../config/configauth

replace go.opentelemetry.io/collector/config/configcompression => ../../config/configcompression
Expand Down
7 changes: 0 additions & 7 deletions component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,3 @@ type CreateDefaultConfigFunc func() Config
func (f CreateDefaultConfigFunc) CreateDefaultConfig() Config {
return f()
}

// InstanceID uniquely identifies a component instance
type InstanceID struct {
ID ID
Kind Kind
PipelineIDs map[ID]struct{}
}
2 changes: 0 additions & 2 deletions component/componenttest/nop_telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@ func NewNopTelemetrySettings() component.TelemetrySettings {
MeterProvider: noopmetric.NewMeterProvider(),
MetricsLevel: configtelemetry.LevelNone,
Resource: pcommon.NewResource(),
ReportStatus: func(*component.StatusEvent) {
},
}
}
Loading

0 comments on commit 505eef8

Please sign in to comment.