mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
allow configuring opentelementry callback via config file (#4916)
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
This commit is contained in:
parent
9a928d5ffb
commit
a5ff53f2ae
2 changed files with 17 additions and 0 deletions
2
changelogs/fragments/4916-opentelemetry-ini-options.yaml
Normal file
2
changelogs/fragments/4916-opentelemetry-ini-options.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- opentelemetry callback plugin - allow configuring opentelementry callback via config file (https://github.com/ansible-collections/community.general/pull/4916).
|
|
@ -24,6 +24,10 @@ DOCUMENTATION = '''
|
||||||
- Hide the arguments for a task.
|
- Hide the arguments for a task.
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_OPENTELEMETRY_HIDE_TASK_ARGUMENTS
|
- name: ANSIBLE_OPENTELEMETRY_HIDE_TASK_ARGUMENTS
|
||||||
|
ini:
|
||||||
|
- section: callback_opentelemetry
|
||||||
|
key: hide_task_arguments
|
||||||
|
version_added: 5.3.0
|
||||||
enable_from_environment:
|
enable_from_environment:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
|
@ -34,6 +38,10 @@ DOCUMENTATION = '''
|
||||||
and if set to true this plugin will be enabled.
|
and if set to true this plugin will be enabled.
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_OPENTELEMETRY_ENABLE_FROM_ENVIRONMENT
|
- name: ANSIBLE_OPENTELEMETRY_ENABLE_FROM_ENVIRONMENT
|
||||||
|
ini:
|
||||||
|
- section: callback_opentelemetry
|
||||||
|
key: enable_from_environment
|
||||||
|
version_added: 5.3.0
|
||||||
version_added: 3.8.0
|
version_added: 3.8.0
|
||||||
otel_service_name:
|
otel_service_name:
|
||||||
default: ansible
|
default: ansible
|
||||||
|
@ -42,6 +50,10 @@ DOCUMENTATION = '''
|
||||||
- The service name resource attribute.
|
- The service name resource attribute.
|
||||||
env:
|
env:
|
||||||
- name: OTEL_SERVICE_NAME
|
- name: OTEL_SERVICE_NAME
|
||||||
|
ini:
|
||||||
|
- section: callback_opentelemetry
|
||||||
|
key: otel_service_name
|
||||||
|
version_added: 5.3.0
|
||||||
traceparent:
|
traceparent:
|
||||||
default: None
|
default: None
|
||||||
type: str
|
type: str
|
||||||
|
@ -61,11 +73,14 @@ examples: |
|
||||||
Enable the plugin in ansible.cfg:
|
Enable the plugin in ansible.cfg:
|
||||||
[defaults]
|
[defaults]
|
||||||
callbacks_enabled = community.general.opentelemetry
|
callbacks_enabled = community.general.opentelemetry
|
||||||
|
[callback_opentelemetry]
|
||||||
|
enable_from_environment = ANSIBLE_OPENTELEMETRY_ENABLED
|
||||||
|
|
||||||
Set the environment variable:
|
Set the environment variable:
|
||||||
export OTEL_EXPORTER_OTLP_ENDPOINT=<your endpoint (OTLP/HTTP)>
|
export OTEL_EXPORTER_OTLP_ENDPOINT=<your endpoint (OTLP/HTTP)>
|
||||||
export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer your_otel_token"
|
export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer your_otel_token"
|
||||||
export OTEL_SERVICE_NAME=your_service_name
|
export OTEL_SERVICE_NAME=your_service_name
|
||||||
|
export ANSIBLE_OPENTELEMETRY_ENABLED=true
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import getpass
|
import getpass
|
||||||
|
|
Loading…
Reference in a new issue