Skip to content

Commit

Permalink
Merge branch 'main' into poc-optional-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
mackjmr committed Oct 16, 2024
2 parents e4f34ff + a7d019f commit ef44b31
Show file tree
Hide file tree
Showing 320 changed files with 3,295 additions and 3,179 deletions.
25 changes: 25 additions & 0 deletions .chloggen/GetExportersWithSignal.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: service

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Change Host to not implement GetExportersWithSignal

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

# (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: Use Host.GetExporters if still needed.

# 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]
27 changes: 27 additions & 0 deletions .chloggen/deprecate-extension-name.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

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

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate funcs that repeat extension in name

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

# (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: |
Factory.CreateExtension -> Factory.Create |
Factory.ExtensionStability -> Factory.Stability
# 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_package_gen.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: enhancement

# 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: Added generated_package_name config field to support custom generated package name.

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

# (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: [user]
25 changes: 25 additions & 0 deletions .chloggen/movecomponentprofiles.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: componentprofiles

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Move componentprofiles to pipelineprofiles

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

# (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/rm-deprecated-prochelper.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: processorhelper

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove deprecated funcs/types from processorhelper & componenttest

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

# (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/rm-stable-gate.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: service

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove stable gate component.UseLocalHostAsDefaultHost

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

# (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: [user]
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
uses: github/codeql-action/init@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13
with:
languages: go

- name: Autobuild
uses: github/codeql-action/autobuild@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
uses: github/codeql-action/autobuild@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
uses: github/codeql-action/analyze@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13
4 changes: 2 additions & 2 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@84480863f228bb9747b473957fcc9e309aa96097 # v4.4.2
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
uses: github/codeql-action/upload-sarif@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ linters-settings:

linters:
enable:
- copyloopvar
- depguard
- errcheck
- errorlint
- exportloopref
- gocritic
- gofmt
- goimports
Expand Down
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ check-contrib:
-replace go.opentelemetry.io/collector/client=$(CURDIR)/client \
-replace go.opentelemetry.io/collector/cmd/mdatagen=$(CURDIR)/cmd/mdatagen \
-replace go.opentelemetry.io/collector/component=$(CURDIR)/component \
-replace go.opentelemetry.io/collector/component/componentprofiles=$(CURDIR)/component/componentprofiles \
-replace go.opentelemetry.io/collector/component/componentstatus=$(CURDIR)/component/componentstatus \
-replace go.opentelemetry.io/collector/config/configauth=$(CURDIR)/config/configauth \
-replace go.opentelemetry.io/collector/config/configcompression=$(CURDIR)/config/configcompression \
Expand Down Expand Up @@ -303,14 +302,14 @@ check-contrib:
-replace go.opentelemetry.io/collector/extension/zpagesextension=$(CURDIR)/extension/zpagesextension \
-replace go.opentelemetry.io/collector/featuregate=$(CURDIR)/featuregate \
-replace go.opentelemetry.io/collector/filter=$(CURDIR)/filter \
-replace go.opentelemetry.io/collector/internal/globalgates=$(CURDIR)/internal/globalgates \
-replace go.opentelemetry.io/collector/internal/globalsignal=$(CURDIR)/internal/globalsignal \
-replace go.opentelemetry.io/collector/internal/memorylimiter=$(CURDIR)/internal/memorylimiter \
-replace go.opentelemetry.io/collector/otelcol=$(CURDIR)/otelcol \
-replace go.opentelemetry.io/collector/otelcol/otelcoltest=$(CURDIR)/otelcol/otelcoltest \
-replace go.opentelemetry.io/collector/pdata=$(CURDIR)/pdata \
-replace go.opentelemetry.io/collector/pdata/testdata=$(CURDIR)/pdata/testdata \
-replace go.opentelemetry.io/collector/pdata/pprofile=$(CURDIR)/pdata/pprofile \
-replace go.opentelemetry.io/collector/pipeline=$(CURDIR)/pipeline \
-replace go.opentelemetry.io/collector/pipeline/pipelineprofiles=$(CURDIR)/pipeline/pipelineprofiles \
-replace go.opentelemetry.io/collector/processor=$(CURDIR)/processor \
-replace go.opentelemetry.io/collector/processor/batchprocessor=$(CURDIR)/processor/batchprocessor \
-replace go.opentelemetry.io/collector/processor/memorylimiterprocessor=$(CURDIR)/processor/memorylimiterprocessor \
Expand All @@ -336,7 +335,6 @@ restore-contrib:
-dropreplace go.opentelemetry.io/collector/client \
-dropreplace go.opentelemetry.io/collector/cmd/mdatagen \
-dropreplace go.opentelemetry.io/collector/component \
-dropreplace go.opentelemetry.io/collector/component/componentprofiles \
-dropreplace go.opentelemetry.io/collector/component/componentstatus \
-dropreplace go.opentelemetry.io/collector/config/configauth \
-dropreplace go.opentelemetry.io/collector/config/configcompression \
Expand Down Expand Up @@ -372,14 +370,14 @@ restore-contrib:
-dropreplace go.opentelemetry.io/collector/extension/zpagesextension \
-dropreplace go.opentelemetry.io/collector/featuregate \
-dropreplace go.opentelemetry.io/collector/filter \
-dropreplace go.opentelemetry.io/collector/internal/globalgates \
-dropreplace go.opentelemetry.io/collector/internal/globalsignal \
-dropreplace go.opentelemetry.io/collector/internal/memorylimiter \
-dropreplace go.opentelemetry.io/collector/otelcol \
-dropreplace go.opentelemetry.io/collector/otelcol/otelcoltest \
-dropreplace go.opentelemetry.io/collector/pdata \
-dropreplace go.opentelemetry.io/collector/pdata/testdata \
-dropreplace go.opentelemetry.io/collector/pdata/pprofile \
-dropreplace go.opentelemetry.io/collector/pipeline \
-dropreplace go.opentelemetry.io/collector/pipeline/pipelineprofiles \
-dropreplace go.opentelemetry.io/collector/processor \
-dropreplace go.opentelemetry.io/collector/processor/batchprocessor \
-dropreplace go.opentelemetry.io/collector/processor/memorylimiterprocessor \
Expand Down
7 changes: 3 additions & 4 deletions cmd/builder/internal/builder/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ var (
replaceModules = []string{
"",
"/component",
"/component/componentprofiles",
"/component/componentstatus",
"/client",
"/config/configauth",
Expand Down Expand Up @@ -77,9 +76,10 @@ var (
"/extension/extensioncapabilities",
"/extension/zpagesextension",
"/featuregate",
"/internal/globalgates",
"/internal/globalsignal",
"/internal/memorylimiter",
"/otelcol",
"/pipeline",
"/pipeline/pipelineprofiles",
"/processor",
"/processor/batchprocessor",
"/processor/memorylimiterprocessor",
Expand All @@ -88,7 +88,6 @@ var (
"/receiver/nopreceiver",
"/receiver/otlpreceiver",
"/receiver/receiverprofiles",
"/otelcol",
"/pdata",
"/pdata/testdata",
"/pdata/pprofile",
Expand Down
2 changes: 1 addition & 1 deletion cmd/builder/internal/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func initConfig(flags *flag.FlagSet) error {
if err := k.Load(env.Provider("", ".", func(s string) string {
// Only values from the `dist.` group can be set,
// and the subfields in `dist.` contain `_` in their names.
// All other fields are arrays and the koanf env provider doesn't provide a straightforward way to set arrarys.
// All other fields are arrays and the koanf env provider doesn't provide a straightforward way to set arrays.
return strings.Replace(strings.ToLower(s), "dist_", "dist.", 1)
}), nil); err != nil {
return fmt.Errorf("failed to load environment variables: %w", err)
Expand Down
5 changes: 2 additions & 3 deletions cmd/builder/test/core.builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ replaces:
- go.opentelemetry.io/collector => ${WORKSPACE_DIR}
- 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
Expand Down Expand Up @@ -47,14 +46,14 @@ replaces:
- go.opentelemetry.io/collector/extension/extensioncapabilities => ${WORKSPACE_DIR}/extension/extensioncapabilities
- go.opentelemetry.io/collector/extension/zpagesextension => ${WORKSPACE_DIR}/extension/zpagesextension
- go.opentelemetry.io/collector/featuregate => ${WORKSPACE_DIR}/featuregate
- go.opentelemetry.io/collector/internal/globalgates => ${WORKSPACE_DIR}/internal/globalgates
- go.opentelemetry.io/collector/internal/globalsignal => ${WORKSPACE_DIR}/internal/globalsignal
- go.opentelemetry.io/collector/internal/memorylimiter => ${WORKSPACE_DIR}/internal/memorylimiter
- go.opentelemetry.io/collector/otelcol => ${WORKSPACE_DIR}/otelcol
- go.opentelemetry.io/collector/otelcol/otelcoltest => ${WORKSPACE_DIR}/otelcol/otelcoltest
- go.opentelemetry.io/collector/pdata => ${WORKSPACE_DIR}/pdata
- go.opentelemetry.io/collector/pdata/pprofile => ${WORKSPACE_DIR}/pdata/pprofile
- go.opentelemetry.io/collector/pdata/testdata => ${WORKSPACE_DIR}/pdata/testdata
- go.opentelemetry.io/collector/pipeline => ${WORKSPACE_DIR}/pipeline
- go.opentelemetry.io/collector/pipeline/pipelineprofiles => ${WORKSPACE_DIR}/pipeline/pipelineprofiles
- go.opentelemetry.io/collector/processor => ${WORKSPACE_DIR}/processor
- go.opentelemetry.io/collector/processor/processorprofiles => ${WORKSPACE_DIR}/processor/processorprofiles
- go.opentelemetry.io/collector/receiver => ${WORKSPACE_DIR}/receiver
Expand Down
27 changes: 26 additions & 1 deletion cmd/mdatagen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ An example of how this generated documentation looks can be found in [documentat
## Using the Metadata Generator

In order for a component to benefit from the metadata generator (`mdatagen`) these requirements need to be met:
1. A `metadata.yaml` file containing the metadata needs to be included in the component
1. A yaml file containing the metadata that needs to be included in the component
2. The component should declare a `go:generate mdatagen` directive which tells `mdatagen` what to generate

As an example, here is a minimal `metadata.yaml` for the [OTLP receiver](https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver/otlpreceiver):
Expand Down Expand Up @@ -55,6 +55,31 @@ Below are some more examples that can be used for reference:

You can run `cd cmd/mdatagen && $(GOCMD) install .` to install the `mdatagen` tool in `GOBIN` and then run `mdatagen metadata.yaml` to generate documentation for a specific component or you can run `make generate` to generate documentation for all components.

### Generate multiple metadata packages

By default, `mdatagen` will generate a package called `metadata` in the `internal` directory. If you want to generate a package with a different name, you can use the `generated_package_name` configuration field to provide an alternate name.

```yaml
type: otlp
generated_package_name: customname
status:
class: receiver
stability:
beta: [logs]
stable: [metrics, traces]
```

The most common scenario for this would be making major changes to a receiver's metadata without breaking what exists. In this scenario, `mdatagen` could produce separate packages for different metadata specs in the same receiver:

```go
//go:generate mdatagen metadata.yaml
//go:generate mdatagen custom.yaml
package main
```

With two different packages generated, the behaviour for which metadata is used can be easily controlled via featuregate or a similar mechanism.

## Contributing to the Metadata Generator

The code for generating the documentation can be found in [loader.go](./internal/loader.go) and the templates for rendering the documentation can be found in [templates](./internal/templates).
Expand Down
Loading

0 comments on commit ef44b31

Please sign in to comment.