Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into mx-psi/strict-typing-…
Browse files Browse the repository at this point in the history
…stable
  • Loading branch information
mx-psi committed Aug 19, 2024
2 parents 7325c66 + d2ed276 commit cfb6b27
Show file tree
Hide file tree
Showing 101 changed files with 1,604 additions and 1,334 deletions.
25 changes: 25 additions & 0 deletions .chloggen/add-batching-option-to-otlp-exporter.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: exporter/otlp

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Add batching option to otlp exporter"

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

# (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/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: []
25 changes: 25 additions & 0 deletions .chloggen/mdatagen-usage.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: Updates mdatagen's usage to output a complete command line example, including the metadata.yaml file.

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

# (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: []
25 changes: 25 additions & 0 deletions .chloggen/mx-psi_preserve-internal-repr.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: otelcol

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Preserve internal representation when unmarshaling component configs

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

# (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: []
4 changes: 2 additions & 2 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ jobs:
- name: Render .chloggen changelog entries
run: make chlog-preview > changelog_preview.md
- name: Install markdown-link-check
run: npm install -g markdown-link-check
run: npm install
- name: Run markdown-link-check
run: |
markdown-link-check \
npx --no -- markdown-link-check \
--verbose \
--config .github/workflows/check_links_config.json \
changelog_preview.md \
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check-links.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: check-links
on:
push:
branches: [ main ]
branches: [main]
pull_request:

concurrency:
Expand Down Expand Up @@ -39,11 +39,11 @@ jobs:
fetch-depth: 0

- name: Install markdown-link-check
run: npm install -g [email protected]
run: npm install

- name: Run markdown-link-check
run: |
markdown-link-check \
npx --no -- markdown-link-check \
--verbose \
--config .github/workflows/check_links_config.json \
${{needs.changedfiles.outputs.md}} \
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ benchmarks.txt

# golang
go.work*

# npm (used for markdown-link-check)
node_modules/*
package-lock.json

2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ linters-settings:
desc: "Use 'errors' or 'fmt' instead of github.com/pkg/errors"
- pkg: github.com/hashicorp/go-multierror
desc: "Use go.uber.org/multierr instead of github.com/hashicorp/go-multierror"
- pkg: "math/rand$"
desc: "Use the newer 'math/rand/v2' instead of math/rand"
# Add a different guard rule so that we can ignore tests.
ignore-in-test:
deny:
Expand Down
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
13 changes: 5 additions & 8 deletions cmd/builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,21 @@ This program generates a custom OpenTelemetry Collector binary based on a given
## TL;DR

```console
$ go install go.opentelemetry.io/collector/cmd/builder@latest
$ go install go.opentelemetry.io/collector/cmd/builder@v0.107.0
$ cat > otelcol-builder.yaml <<EOF
dist:
name: otelcol-custom
description: Local OpenTelemetry Collector binary
output_path: /tmp/dist
exporters:
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/alibabacloudlogserviceexporter v0.99.0
- gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.99.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/alibabacloudlogserviceexporter v0.107.0
- gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.107.0

receivers:
- gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.99.0
- gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.107.0

processors:
- gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.99.0

providers:
- gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v0.99.0
- gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.107.0

EOF
$ builder --config=otelcol-builder.yaml
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 @@ -95,3 +95,5 @@ replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
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
4 changes: 4 additions & 0 deletions cmd/mdatagen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const (
)

func main() {
flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s metadata.yaml\n", os.Args[0])
flag.PrintDefaults()
}
flag.Parse()
yml := flag.Arg(0)
if err := run(yml); err != nil {
Expand Down
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
Loading

0 comments on commit cfb6b27

Please sign in to comment.