Commit Graph

14 Commits

Author SHA1 Message Date
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
Matthieu MOREL 68d1f93232
[chore]: use testify instead of testing.Fatal or testing.Error (#11896)
### Description

* uses testify instead of testing.Fatal or testing.Error in processor

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-12-16 23:15:33 +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
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
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
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
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
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