-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
allow configuring opentelementry callback via config file #4916
allow configuring opentelementry callback via config file #4916
Conversation
e29942f
to
bad4134
Compare
Docs Build 📝Thank you for contribution!✨ This PR has been merged and your docs changes will be incorporated when they are next published. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the contribution!
I didn't know by adding the ini
section in the DOCS will enable this feature, that's really awesome!
Do you think adding an entry in the EXAMPLES
section could help to illustrate how to use the ini
values?
@v1v yeah, I can add an example for |
bad4134
to
4c44a37
Compare
like this? or should we split that in a separate entry so it's clear it's not required? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty much, 💯
@felixfontein do you know why the second docs build didn't include the diff output? I haven't seen that before.. when it's too long it should end up truncated but not gone completely (and I don't think it would be too long in this case anyway). |
4c44a37
to
15ad222
Compare
@felixfontein thanks, updated! |
@briantist I guess it is related to the warnings
here: https://github.com/ansible-collections/community.general/actions/runs/2604656993. It's somewhat confusing since this used to work: #4880 (comment) (and a very recent one: #4912 (comment)). The funny thing is that you can easily look at the diff output in the build output itself, so this is not really protecting it anyway... |
this is especially useful for the `enable_from_environment` option, as this allows to set a default for the whole project, instead of relying on everyone setting the environment variable
15ad222
to
38cae0d
Compare
thanks @felixfontein this was helpful... the only thing I can think of is that maybe you've got a secret set in your repository whose name or value is included in the diff output? I did a diff of the diff outputs before and after triggering this behavior, to see if that helps you figure it out diff of diffs-index 0ad55df..f9536a9 100644
+index 0ad55df..bc567ed 100644
--- a/home/runner/work/community.general/community.general/docsbuild/base/collections/community/general/opentelemetry_callback.html
+++ b/home/runner/work/community.general/community.general/docsbuild/head/collections/community/general/opentelemetry_callback.html
-@@ -187,7 +187,13 @@ To check whether it is installed, run <code class="code docutils literal notrans
+@@ -187,7 +187,14 @@ To check whether it is installed, run <code class="code docutils literal notrans
<p>This is handy when you use Configuration as Code and want to send distributed traces if running in the CI rather when running Ansible locally.</p>
<p>For such, it evaluates the given <em>enable_from_environment</em> value as environment variable and if set to true this plugin will be enabled.</p>
<p class="ansible-option-line"><span class="ansible-option-configuration">Configuration:</span></p>
@@ -13,11 +13,12 @@ index 0ad55df..f9536a9 100644
+<span class="l l-Scalar l-Scalar-Plain">enable_from_environment = None</span><span class="w"></span>
+</pre></div>
+</div>
++<p><span class="ansible-option-versionadded">added in 5.3.0 of community.general</span></p>
+</li>
<li><p>Environment variable: ANSIBLE_OPENTELEMETRY_ENABLE_FROM_ENVIRONMENT</p></li>
</ul>
</div></td>
-@@ -203,7 +209,13 @@ To check whether it is installed, run <code class="code docutils literal notrans
+@@ -203,7 +210,14 @@ To check whether it is installed, run <code class="code docutils literal notrans
<li><p><span class="ansible-option-choices-entry">yes</span></p></li>
</ul>
<p class="ansible-option-line"><span class="ansible-option-configuration">Configuration:</span></p>
@@ -28,11 +29,12 @@ index 0ad55df..f9536a9 100644
+<span class="l l-Scalar l-Scalar-Plain">hide_task_arguments = no</span><span class="w"></span>
+</pre></div>
+</div>
++<p><span class="ansible-option-versionadded">added in 5.3.0 of community.general</span></p>
+</li>
<li><p>Environment variable: ANSIBLE_OPENTELEMETRY_HIDE_TASK_ARGUMENTS</p></li>
</ul>
</div></td>
-@@ -215,7 +227,13 @@ To check whether it is installed, run <code class="code docutils literal notrans
+@@ -215,7 +229,14 @@ To check whether it is installed, run <code class="code docutils literal notrans
<td><div class="ansible-option-cell"><p>The service name resource attribute.</p>
<p class="ansible-option-line"><span class="ansible-option-default-bold">Default:</span> <span class="ansible-option-default">“ansible”</span></p>
<p class="ansible-option-line"><span class="ansible-option-configuration">Configuration:</span></p>
@@ -43,7 +45,22 @@ index 0ad55df..f9536a9 100644
+<span class="l l-Scalar l-Scalar-Plain">otel_service_name = ansible</span><span class="w"></span>
+</pre></div>
+</div>
++<p><span class="ansible-option-versionadded">added in 5.3.0 of community.general</span></p>
+</li>
<li><p>Environment variable: OTEL_SERVICE_NAME</p></li>
</ul>
</div></td>
+@@ -241,11 +262,14 @@ To check whether it is installed, run <code class="code docutils literal notrans
+ <span class="w"> </span><span class="no">Enable the plugin in ansible.cfg:</span><span class="w"></span>
+ <span class="w"> </span><span class="no">[defaults]</span><span class="w"></span>
+ <span class="w"> </span><span class="no">callbacks_enabled = community.general.opentelemetry</span><span class="w"></span>
++<span class="w"> </span><span class="no">[callback_opentelemetry]</span><span class="w"></span>
++<span class="w"> </span><span class="no">enable_from_environment = ANSIBLE_OPENTELEMETRY_ENABLED</span><span class="w"></span>
+ <span class="w"> </span><span class="no">Set the environment variable:</span><span class="w"></span>
+ <span class="w"> </span><span class="no">export OTEL_EXPORTER_OTLP_ENDPOINT=<your endpoint (OTLP/HTTP)></span><span class="w"></span>
+ <span class="w"> </span><span class="no">export OTEL_EXPORTER_OTLP_HEADERS="authorization=***;</span><span class="w"></span>
+ <span class="w"> </span><span class="no">export OTEL_SERVICE_NAME=your_service_name</span><span class="w"></span>
++<span class="w"> </span><span class="no">export ANSIBLE_OPENTELEMETRY_ENABLED=true</span><span class="w"></span>
+ </pre></div>
+ </div>
+ <section id="authors"> I had a terrible possible thought, which is that of a "secret" set in the repo with the value of Probably a longshot... The thing that makes me think maybe it's not value related, is that such a value should get masked in the output automatically, and it isn't. So that makes me wonder if this precaution only kicks in when the name of a secret shows up in output. After all the language in the warning "may contain secret" is not definitive, and it's only affecting job outputs. This seems to have kicked in when docs containing a bunch of uppercase environment variables showed up, and by convention secrets in GitHub are usually set that way too, so maybe this repo has an Care to take a look? |
needs ansible-collections/community.general#4916 to work, but doesn't hurt before that either
SUMMARY
this is especially useful for the
enable_from_environment
option, asthis allows to set a default for the whole project, instead of relying
on everyone setting the environment variable
ISSUE TYPE
COMPONENT NAME
opentelementry callback
ADDITIONAL INFORMATION