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

Simplify HTTP headers injection #12

Open
manikmagar opened this issue Jan 21, 2022 · 3 comments
Open

Simplify HTTP headers injection #12

manikmagar opened this issue Jan 21, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@manikmagar
Copy link
Contributor

While auto-injection isn't supported (see Limitations ), the HTTP Request Context Injection
approach requires users to be aware of what header entries need to be added.

<http:request-config name="HTTP_Request_configuration_App2" doc:name="HTTP Request configuration" doc:id="23878620-099a-4c33-8a3a-31cdc4f912d1">
    <http:request-connection host="localhost" port="8082" />
    <http:default-headers >
      <http:default-header key="traceparent" value="#[(vars.OTEL_TRACE_CONTEXT.traceparent as String) default '']" /> 
    </http:default-headers>
  </http:request-config>

Depending on the propagators configured, the list of header entries could vary. This need for explicit entries needs to be avoided.

We could provide a dataweave module function ,eg otel.getHttpHeaders() which returns HTTP default headers compatible map, that users could add in default headers -

<http:request-config name="HTTP_Request_configuration_App2" doc:name="HTTP Request configuration"defaultHeaders="#[otel.getHttpHeaders()]">
		<http:request-connection host="localhost" port="8082" />
	</http:request-config>
@manikmagar manikmagar added the enhancement New feature or request label Jan 21, 2022
@manikmagar
Copy link
Contributor Author

This doesn't seem to be feasible. The RequestHeader representing the default header entries, does not have a public constructor or setters.

@zedwards14276
Copy link

zedwards14276 commented Mar 8, 2024

Hi @manikmagar I was trying to set the traceparent as a logging variable but Anypoint Studio isn't able to find the properties for OTEL_TRACE_CONTEXT.

I was trying to follow the instructions here: https://medium.com/@jromasanta/part-2-integrating-dynatrace-using-mulesoft-4-22da37c24d58

I've tried using 1.5.0 and 2.0.0-M3 but neither one is working. What am I doing wrong here?

image

@manikmagar
Copy link
Contributor Author

Hi @zedwards14276, I assume this is a warning in the Anypoint Studio only. You can safely ignore that since that variable is inserted by the module at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants