Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElasticSearch exporter does not give the possibility to add custom headers (auth headers for instance) #3080

Closed
MaxLeb opened this issue Oct 4, 2024 · 1 comment · Fixed by #3083
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@MaxLeb
Copy link

MaxLeb commented Oct 4, 2024

Describe your environment

Using a manually built version of OpenTelemetry 1.16.1 on macOS with :

-DWITH_EXAMPLES=OFF
-DWITH_OTLP_HTTP=ON
-DBUILD_TESTING=OFF
-DWITH_OTLP_GRPC=OFF
-DWITH_LOGS_PREVIEW=ON
-DOPENTELEMETRY_INSTALL=ON
-DBUILD_SHARED_LIBS=OFF
-DWITH_ASYNC_EXPORT_PREVIEW=ON
-DCMAKE_CXX_STANDARD=17
-DWITH_ELASTICSEARCH=ON

Steps to reproduce

The usage is pretty simple:

First an init of the exporter with a single log record processor:

opentelemetry::exporter::logs::ElasticsearchExporterOptions opts(
,
9200,
"logs",
30,
true);

auto elkExporter = std::make_uniqueopentelemetry::exporter::logs::ElasticsearchLogRecordExporter(opts);

auto elkProcessor = opentelemetry::sdk::logs::SimpleLogRecordProcessorFactory::Create(std::move(elkExporter));

std::shared_ptropentelemetry::logs::LoggerProvider provider = opentelemetry::sdk::logs::LoggerProviderFactory::Create(
std::move(elkProcessor), resource);

opentelemetry::logs::Provider::SetLoggerProvider(provider);

m_Logger = provider->GetLogger("MyLogger", SOURCE_NAME);
Then, when logs needs to be sent a call to m_Logger.EmitLogRecord(xxx)

What is the expected behavior?
Since the ELK endpoint requires a basic auth, the call is rejected with a 401 error as we cannot set any custom headers to the request.

What is the actual behavior?
Add possibility to add custom headers (probably more of a feature request than an actual bug).

@MaxLeb MaxLeb added the bug Something isn't working label Oct 4, 2024
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Oct 4, 2024
@MaxLeb
Copy link
Author

MaxLeb commented Oct 4, 2024

Proposed patch :
0001-EXPORTER-Add-possibility-to-give-custom-HttpHeaders-.patch

ShadowMaxLeb added a commit to Shadow-Official/opentelemetry-cpp that referenced this issue Oct 7, 2024
ShadowMaxLeb added a commit to Shadow-Official/opentelemetry-cpp that referenced this issue Oct 7, 2024
@marcalff marcalff added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants