Commit Graph

42 Commits

Author SHA1 Message Date
Antoine Toulme b5f3b1dea2
[builder] Remove undocumented handling of `DIST_*` environment variables replacements (#13493)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Remove undocumented handling of `DIST_*` environment variables
replacements

<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes #13335
2025-07-26 22:57:37 +00:00
renovate[bot] 1d377cd3ca
Update module github.com/knadh/koanf/providers/env to v2 (#13304)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/knadh/koanf/providers/env](https://redirect.github.com/knadh/koanf)
| `v1.1.0` -> `v2.0.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fknadh%2fkoanf%2fproviders%2fenv/v2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fknadh%2fkoanf%2fproviders%2fenv/v2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fknadh%2fkoanf%2fproviders%2fenv/v1.1.0/v2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fknadh%2fkoanf%2fproviders%2fenv/v1.1.0/v2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

⚠️ MAJOR VERSION UPDATE ⚠️ - please manually update this
package

---

### Release Notes

<details>
<summary>knadh/koanf (github.com/knadh/koanf/providers/env)</summary>

###
[`v2.0.0`](https://redirect.github.com/knadh/koanf/releases/tag/v2.0.0)

[Compare
Source](https://redirect.github.com/knadh/koanf/compare/v1.1.0...v2.0.0)

This is a major breaking change that ends koanf v1 (v1.5.0) and moves to
v2. Continued usage of v1 is unaffected. While koanf does not bundle
external dependencies into its core thereby avoiding them in the build,
a `go get` would still pull them and go.mod, bringing in unnecessary
references as all the providers and parsers were "sub" packages of the
main module.

This PR upgrades koanf to v2 and separates every single provider and
parser package into its own module, go.mod, and release tag (eg:
`providers/yaml/v0.1.0`). That is, one-repository, many modules. This
removes references to all indirect dependencies in the main koanf
package significantly de-cluttering it.

##### What changes?

- Going forward, koanf references should change to
`github.com/knadh/koanf/v2`.
- The required parsers and providers should be installed explicitly as
they do not come bundled with the main koanf package anymore. Eg: `go
get github.com/knadh/koanf/providers/s3`, `go get
github.com/knadh/koanf/parsers/json` etc.
- That's all. There is no change in functionality.

**Full Changelog**:
https://github.com/knadh/koanf/compare/v1.5.0...v2.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC42Mi4xIiwidXBkYXRlZEluVmVyIjoiNDAuNjIuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jeS1tYWpvci11cGRhdGUiXX0=-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jade Guiton <jade.guiton@datadoghq.com>
2025-07-02 20:27:23 +00:00
Oussama Ben Ghorbel (Dainerx) 24da249cce
[chore] Ability to provide custom ld and gc flags (#11996)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

The primary purpose of this PR is to provide greater flexibility in how
OTEL binaries are built, enabling the inclusion of debugging symbols
when needed, without always stripping them by default.

Currently, debugging symbols are only retained when
debug_compilation=true. However, this approach also disables all
compiler inlining and optimizations (gcflags=all=-N -l) to ensure an
exact match between written and executed code, resulting in a
significant increase in CPU consumption. There are scenarios where we
want binaries with debugging symbols and DWARF information while still
allowing the compiler to optimize and inline. This PR addresses that
need by introducing configurable GCFlags.

`ocb --ldflags="" --gcflags="" --config=builder-config.yaml`

<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes
[#58](https://github.com/open-telemetry/opentelemetry-collector-releases/issues/58)

<!--Describe what testing was performed and which tests were added.-->
#### Testing

Manual 

Override LDflags: 


![image](https://github.com/user-attachments/assets/6bcb0f7b-492a-45fb-a232-9c337afb5f5e)


Override both


![image](https://github.com/user-attachments/assets/00bc6c5f-37f0-438d-b4e1-f7a2d5833ec9)


<!--Describe the documentation added.-->
#### Documentation

README file updated.

-- 

Backward compatibility concerns: 
- As of today, passing cfg.LDFlags will append to LD flags that are by
default to `-s -w`.

Questions: 
- Should we deprecate DebugCompilation property? 
<!--Please delete paragraphs that you did not use before submitting.-->
2025-01-21 10:40:45 +00:00
Bogdan Drutu 084aa63173
Update builder default providers to lastest stable (#11566)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-11-04 16:10:12 -08:00
Bogdan Drutu 27bcaf6129
Apply default values before we unmarshal the config, allows not using pointers (#11596)
Skip changelog since this is not visible to our users.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-11-04 15:19:12 -08:00
Bogdan Drutu 9ae29a8309
Remove builder support to build old version, and the otelcol_version config (#11588)
Fixes
https://github.com/open-telemetry/opentelemetry-collector/issues/11405

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-11-04 10:25:32 -08:00
Bogdan Drutu 3df7c320d2
[chore] Remove unnecessary overwrites for flag only values (#11589)
This is a no-op, because the file config cannot set the "skip"
properties since they have `mapstructure:"-"`

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-11-04 09:01:00 -08:00
Bogdan Drutu cd6bfbb121
Remove reprecated flags from Builder (#11576)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-10-31 12:16:08 -07:00
Bogdan Drutu 8265197794
[chore] Remove unused version checks in builder config (#11568)
Updates
https://github.com/open-telemetry/opentelemetry-collector/issues/11405

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-10-30 10:01:09 -07:00
Nathan Baulch 42e6304f65
Fix typos (#11348)
Just thought I'd contribute some typo fixes I stumbled upon. Nothing
controversial (hopefully), just 72 simple fixes.

Use the following command to get a quick and dirty summary of the
specific corrections made:
```shell
git diff HEAD^! --word-diff-regex='\w+' -U0 \
  | grep -E '\[\-.*\-\]\{\+.*\+\}' \
  | sed -r 's/.*\[\-(.*)\-\]\{\+(.*)\+\}.*/\1 \2/' \
  | sort | uniq -c | sort -n
```

FWIW, the top typos are:
* invokable (16)
* subsciption (15)
* decison (7)
* reques (3)
* dissallow (3)
* documenation (3)
* locahost (3)
* prerequistes (2)
* assinged (2)
* extenions (2)

---------

Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-10-09 15:43:52 -07:00
Peter Deng 396ae85e9d
Honor build_tags in config (#11156)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes #

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->
2024-09-19 10:10:43 +02:00
Pablo Baeyens 5102a1ec65
[cmd/builder] Disable strict version check (#11168)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Disable strict version check. The `--skip-strict-version-check` is kept
but is now a no-op.

This fixes #11152.

<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes #11152
2024-09-13 17:29:43 +02:00
Alex Boten 79bef21ac9
Revert "[builder] Support for --skip-new-go-module (#10098)" (#10978)
This reverts commit a0331ed86c.
2024-08-27 07:07:45 -07:00
Kristina Pathak a0331ed86c
[builder] Support for --skip-new-go-module (#10098)
A continuation of
https://github.com/open-telemetry/opentelemetry-collector/pull/9253 and
https://github.com/open-telemetry/opentelemetry-collector/pull/9631

Description: Adds a `--skip-new-go-module` flag to the OTC builder. This
enables users working in an existing go module environment (say, a
"monorepo") to update the module they have, vs forcing the use of a new
module.

With the new support inside an existing Go module, a collector main
package can be generated using a go:generate directive. For example, in
the directory where I want my collector built, the file generate.go has
this line:

//go:generate builder --skip-new-go-module --skip-compilation
--strict-versioning --config=./build-config.yaml
In the same directory, the build-config.yaml describes the collector to
build. The builder generates the other files in the same directory. At
this point, normal Go workflows can be used to update indirect
dependencies.

Link to tracking Issue:
https://github.com/open-telemetry/opentelemetry-collector/issues/9252

Testing: Will add unit tests in the next few days.

Documentation: Yes.

---------

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
2024-08-22 10:52:55 +02:00
Antoine Toulme b53f57dc89
[chore] delete code to set a version and date, as it it not used (#10715) 2024-07-30 11:22:06 -07:00
Tyler Helmuth d136b6d186
[cmd/builder] Allow setting DefaultScheme in builder config (#10296)
#### Description

Allows configuring `DefaultScheme` via the builder config.

#### Link to tracking issue
Related to
https://github.com/open-telemetry/opentelemetry-collector/pull/10259
Related to
https://github.com/open-telemetry/opentelemetry-collector/issues/10290

#### Testing
Local testing and unit tests

---------

Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-06-04 13:57:59 -07:00
Evan Bradley 256c7c3536
[cmd/builder] Allow configuring confmap providers (#9513)
**Description:**

Allow configuring confmap providers in the builder's config. If the
field isn't set, the default set of providers is used.

**Link to tracking Issue:**

Resolves
https://github.com/open-telemetry/opentelemetry-collector/issues/4759.

**Testing:**

Extended unit tests.

**Documentation:**

Updated the readme to include the new options in the example manifest
file.

cc @mx-psi

---------

Co-authored-by: Evan Bradley <evan-bradley@users.noreply.github.com>
Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
2024-04-22 09:23:21 +02:00
Kristina Pathak e9b432dcea
[builder] Add strict versioning (#9897)
**Description:** <Describe what has changed.>
Adds strict version checking in the builder. This enables users to
ensure that the versions specified in the builder config are the
versions used in the go.mod when building the collector binary. This can
be disabled with --skip-strict-versioning.

**Link to tracking Issue:** #9896

**Testing:** Added unit tests

**Documentation:** Added to builder README

---------

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
2024-04-18 12:25:05 +02:00
Alex Boten 4688461318
[chore] fix unused params (#9578)
Related to #9577

Signed-off-by: Alex Boten <aboten@lightstep.com>
2024-02-13 11:04:48 -08:00
Pablo Baeyens 00c6dec741
[cmd/builder] Add `--verbose` flag to log go subcommands output (#8715)
**Description:** 

Log output from `go` subcommands being ran as part of an ocb build if passing the `--verbose` flag
2023-11-06 14:08:31 +01:00
Pablo Baeyens 7c33b71f36
[cmd/builder] Fix otelcol_version being ignored (#8713)
Adds `go.opentelemetry.io/collector/otelcol` to `go.mod` template for
the builder. This fixes #8692.

Since #8443, the `otelcol` folder is its own component. Before this
change, `otelcol_version` was enforced by the `collector` module
dependency:

287b98f697/cmd/builder/internal/builder/templates/go.mod.tmpl (L23)

After this change, the `go mod tidy` step here:

287b98f697/cmd/builder/internal/builder/main.go (L115)

will add the latest available version for the `otelcol` module since
none of the components actually depend on it. For example, with the
`v0.86.0` builder config the output is as follows:

```
❯ go mod tidy -v -compat=1.20
go: finding module for package go.opentelemetry.io/collector/otelcol
go: found go.opentelemetry.io/collector/otelcol in go.opentelemetry.io/collector/otelcol v0.87.0
```

Explicitly adding `otelcol` makes it so the `otelcol_version` is
correctly honored.

**Link to tracking Issue:** Fixes #8692
2023-10-20 07:40:07 -07:00
Sean Liao 2ebe1e501f
fix builder config from env (#8401)
**Description:** partially fix loading builder config from the env. This
moves the env option from unusable (wrong parsing of nested keys), to
usable for the `dist.*` settings, but not for any of the
components/modules, which will require more complex parsing for arrays.

**Link to tracking Issue:** #8239

**Testing:** try running it locally
2023-09-14 10:22:44 -07:00
Dan Bason 50c94c9419
Update koanf to v2 (#7997)
This PR updates the koanf dependency to v2
2023-06-29 16:41:29 -07:00
François JACQUES 479a3284e6
[cmd/builder] Add option to skip generating sources (#7542)
This option makes the builder skip generating sources.

**Link to tracking Issue:** #7541

**Testing:** Unit tests

**Documentation:** as part of the CLI help menu

Signed-off-by: Francois JACQUES <hypnoce@donarproject.org>
2023-06-22 14:33:08 -07:00
Alex Boten 80d704deb4
[chore] use license shortform (#7694)
* [chore] use license shortform

To remain consistent w/ contrib repo, see https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/22052

Signed-off-by: Alex Boten <aboten@lightstep.com>

* make goporto

Signed-off-by: Alex Boten <aboten@lightstep.com>

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-05-18 13:11:17 -07:00
Kristina Pathak c0a08e3068
add ldflags builder cmd option (#6946)
* add ldflags builder cmd option

* add changelog info

* add a unit test

* add back log

* string addition
2023-02-01 10:53:04 -08:00
Daniel Jaglowski c251f3d168
Add support for connector configurations (#6789)
* Add connectors to configuration of collector

* changelog
2023-01-17 16:16:11 -08:00
Adam Kuboń cae176bccb
add remote debug option for otel-collector to builder (#6148)
Co-authored-by: Juraci Paixão Kröhling <juraci.github@kroehling.de>

Co-authored-by: Juraci Paixão Kröhling <juraci.github@kroehling.de>
2023-01-17 13:22:44 -08:00
Sakshi Patle db0c250c83
[chore]: dont set path for go in validate (#6273)
* fix: dont set path for go in validate

Signed-off-by: sakshi1215 <sakshi.patle121@gmail.com>

* test

Signed-off-by: sakshi1215 <sakshi.patle121@gmail.com>

* fix

Signed-off-by: sakshi1215 <sakshi.patle121@gmail.com>

* add changelog entry

Signed-off-by: sakshi1215 <sakshi.patle121@gmail.com>

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update cmd/builder/internal/builder/config.go

Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>

* fix

Signed-off-by: Sakshi Patle <sakshi.patle121@gmail.com>

* fix

Signed-off-by: Sakshi Patle <sakshi.patle121@gmail.com>

Signed-off-by: sakshi1215 <sakshi.patle121@gmail.com>
Signed-off-by: Sakshi Patle <sakshi.patle121@gmail.com>
Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
2022-10-25 08:08:44 -07:00
James Peach 9f14f5e13c
Add a default build configuration to ocb. (#5752)
Embed the build configuration that is used to build otelcorecol into ocb
so that end users can easily generate a useful collector. This makes the
`--config` flag optional again.

Signed-off-by: James Peach <jpeach@cloudflare.com>

Signed-off-by: James Peach <jpeach@cloudflare.com>
2022-09-13 09:15:59 -07:00
Foad Nosrati Habibi 271491a82f
Add skip-get-modules flag to support isolated envs (#6009) 2022-09-02 08:59:01 -07:00
Bogdan Drutu 7545a294c9
Remove unnecessary posflag provider load (#5951)
This is unnecessary because:
1. It happens before flags are loaded, so will initialize things with default values, which already happens during flags initialization. See flags.StringVar for example.
2. The load using posflag provider, as defined right now (with current flags name) produce this config:
```
k := map[string]interface{} {
	"config": ""
	"description": "Custom OpenTelemetry Collector distribution"
	"go": ""
	"module": "go.opentelemetry.io/collector/cmd/builder"
	"name": "otelcol-custom otelcol-version:0.58.0"
	"output-path": "/var/folders/5c/5p_3jmvd6qx0rsvmb9j7c_s00000gn/T/otelcol-distribution1155391158"
	"skip-compilation": false
	"version": "1.0.0"
}
```
As you can see, this will whole be ignored, since all the configs (except the config flag) are sub-configs under "dist" anyway.
Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-08-25 08:56:54 -07:00
Bogdan Drutu 07de5b29b6
Mark custom distribution flags as deprecated (#5946)
Signed-off-by: Bogdan <bogdandrutu@gmail.com>

Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-08-22 13:48:10 -07:00
Tyler Helmuth 76698c110e
[cmd/builder] Update builder flags precedence (#5726)
This PR updates the builder's config initialization so that flags always take precedence over configuration files or default values.

I opted not to use the collector's resolvers/converter approach as it felt overkill for this command. This approach takes advantage of the command's existing use of global vars, which isn't the best, but is at least consistent.
2022-07-26 10:59:41 -07:00
James Peach 993010478c
Fail when the builder can't load its configuration. (#5731)
If the builder can't load its build configuration file, it logs an error
and continues. This results in building a collector that is not the one
the user specified. Exit with a fatal error instead.

Signed-off-by: James Peach <jpeach@cloudflare.com>
2022-07-25 08:13:25 -07:00
James Peach 3e14ee97d8
Update the builder to use a consistent binary name. (#5651)
Update the builder to consistently use "ocb" in the name of the command,
version. Since the builder does not expand environment variables in the
config file pathname, the default value for `--config` does not work,
so we can make this flag required so that users don't silently build an
inoperative collector.

This fixes #5581.

Signed-off-by: James Peach <jpeach@cloudflare.com>
2022-07-22 07:30:52 -07:00
Ryan Leung 78e9640760
Replace viper with koanf in builder (#4757)
* replace viper with koanf in builder

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* resolve the conflicts

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* Update go.sum

Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Bogdan Drutu <lazy@splunk.com>
2022-02-23 11:26:15 -08:00
Sean Marciniak d5656d6bb2
Updating methods to reflect the contribution guide's recommendations (#4865) 2022-02-18 11:12:40 -08:00
Bogdan Drutu f5fb458ed0
[Builder]: Enable unmarshal exact to help finding hard to find typos (#4644)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-01-06 15:07:42 -08:00
Bogdan Drutu 2d4b2394a6
builder: Remove deprecated include-core flag (#4616)
* builder: Remove deprecated include-core flag

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Further cleanup of include core

Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>

* make genpdata

Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>

* Fix indentation in components.go.tmpl

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Co-authored-by: Juraci Paixão Kröhling <juraci@kroehling.de>
2022-01-03 09:41:12 -08:00
James 29db3d3425
Remove reference to `defaultcomponents` in core and deprecate `include_core` flag (#4087)
* remove defaultComponents from core and make it internal for tests

* remove package-lock.json file

* remove checkdoc from GitHub actions workflow

* add CHANGELOG entry

* add checkdoc to github workflow

* testing lint check

* remove-default-components-from-core

* add import statement

* fix Makefile

* add changelog entry

* lint check

* fix lint test

* run integration tests

* fix lint

* Modify changelog entry

* deprecate include_core flag

* modify include_core flag comment

* deprecate include_core flag revised

* deprecate include_core flag revised with log messages

* commit initial test for codecov

* fixed test

* add changelog entry
2021-12-08 10:03:43 -08:00
Bogdan Drutu 02187dfeb2
Nit: remove more global state from the Builder (#4448)
* Nit: remove more global state from the Builder

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update version.go
2021-11-18 09:44:12 -08:00