From 9eab4f99b23bd91b6fa1a0d0acb723cd24536000 Mon Sep 17 00:00:00 2001 From: 8naama Date: Wed, 7 Aug 2024 15:14:45 +0300 Subject: [PATCH 1/5] remove hardcoded version in otel conf --- .../localhost/windows/system/telemetry/logs/functions.ps1 | 5 +++++ .../localhost/windows/system/telemetry/metrics/functions.ps1 | 5 +++++ resources-linux/otel/datasource_logs_utils.bash | 5 +++++ resources-linux/otel/datasource_metrics_utils.bash | 5 +++++ resources-mac/otel/datasource_logs_utils.bash | 5 +++++ resources-mac/otel/datasource_metrics_utils.bash | 5 +++++ resources/otel/processors/resource_agent.yaml | 2 +- 7 files changed, 31 insertions(+), 1 deletion(-) diff --git a/datasources/windows/localhost/windows/system/telemetry/logs/functions.ps1 b/datasources/windows/localhost/windows/system/telemetry/logs/functions.ps1 index d3ce30772..f5bdd05e2 100755 --- a/datasources/windows/localhost/windows/system/telemetry/logs/functions.ps1 +++ b/datasources/windows/localhost/windows/system/telemetry/logs/functions.ps1 @@ -504,6 +504,11 @@ function Add-LogsProcessorsToOtelConfig { foreach ($LogsOtelProcessor in $LogsOtelProcessors) { $local:ProcessorName = $LogsOtelProcessor.Replace('_', '/') + if ($ProcessorName -eq 'resource_agent') { + $local:AgentVersion = Get-Content "$env:TEMP\Logzio\version" + $Err = Add-YamlFileFieldValue "$script:OtelResourcesDir\$script:OtelConfigName" '.processors.resource/agent.attributes[0].value' $AgentVersion + } + $Err = Add-YamlFileFieldValue "$script:OtelResourcesDir\$script:OtelConfigName" '.service.pipelines.logs.processors' $ProcessorName if ($Err.Count -ne 0) { $Message = "logs.ps1 ($ExitCode): $($Err[0])" diff --git a/datasources/windows/localhost/windows/system/telemetry/metrics/functions.ps1 b/datasources/windows/localhost/windows/system/telemetry/metrics/functions.ps1 index 0adf307f1..748969334 100755 --- a/datasources/windows/localhost/windows/system/telemetry/metrics/functions.ps1 +++ b/datasources/windows/localhost/windows/system/telemetry/metrics/functions.ps1 @@ -302,6 +302,11 @@ function Add-MetricsProcessorsToOtelConfig { foreach ($MetricsOtelProcessor in $MetricsOtelProcessors) { $local:ProcessorName = $MetricsOtelProcessor.Replace('_', '/') + if ($ProcessorName -eq 'resource_agent') { + $local:AgentVersion = Get-Content "$env:TEMP\Logzio\version" + $Err = Add-YamlFileFieldValue "$script:OtelResourcesDir\$script:OtelConfigName" '.processors.resource/agent.attributes[0].value' $AgentVersion + } + $Err = Add-YamlFileFieldValue "$script:OtelResourcesDir\$script:OtelConfigName" '.service.pipelines.metrics.processors' $ProcessorName if ($Err.Count -ne 0) { $Message = "metrics.ps1 ($ExitCode): $($Err[0])" diff --git a/resources-linux/otel/datasource_logs_utils.bash b/resources-linux/otel/datasource_logs_utils.bash index 3ad6c8253..c7c151b58 100755 --- a/resources-linux/otel/datasource_logs_utils.bash +++ b/resources-linux/otel/datasource_logs_utils.bash @@ -196,6 +196,11 @@ function add_logs_processors_to_otel_config { for logs_otel_processor in "${LOGS_OTEL_PROCESSORS[@]}"; do local processor_name="${logs_otel_processor//_//}" + if [[ $processor_name == 'resource_agent' ]] ; then + AGENT_VERSION=$(cat '/tmp/logzio/version') + add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" + fi + add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.service.pipelines.logs.processors' $processor_name if [[ $? -ne 0 ]]; then message="logs.bash ($EXIT_CODE): $(get_task_error_message)" diff --git a/resources-linux/otel/datasource_metrics_utils.bash b/resources-linux/otel/datasource_metrics_utils.bash index efe5d769f..aae3e996a 100755 --- a/resources-linux/otel/datasource_metrics_utils.bash +++ b/resources-linux/otel/datasource_metrics_utils.bash @@ -217,6 +217,11 @@ function add_metrics_processors_to_otel_config { for metrics_otel_processor in "${METRICS_OTEL_PROCESSORS[@]}"; do local processor_name="${metrics_otel_processor//_//}" + if [[ $processor_name == 'resource_agent' ]] ; then + AGENT_VERSION=$(cat '/tmp/logzio/version') + add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" + fi + add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.service.pipelines.metrics.processors' "$processor_name" if [[ $? -ne 0 ]]; then message="metrics.bash ($EXIT_CODE): $(get_task_error_message)" diff --git a/resources-mac/otel/datasource_logs_utils.bash b/resources-mac/otel/datasource_logs_utils.bash index ff5cd7d13..2ee253fe2 100755 --- a/resources-mac/otel/datasource_logs_utils.bash +++ b/resources-mac/otel/datasource_logs_utils.bash @@ -197,6 +197,11 @@ function add_logs_processors_to_otel_config { for logs_otel_processor in "${LOGS_OTEL_PROCESSORS[@]}"; do local processor_name="${logs_otel_processor//_//}" + if [[ $processor_name == 'resource_agent' ]] ; then + AGENT_VERSION=$(cat '/tmp/logzio/version') + add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" + fi + add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.service.pipelines.logs.processors' $processor_name if [[ $? -ne 0 ]]; then message="logs.bash ($EXIT_CODE): $(get_task_error_message)" diff --git a/resources-mac/otel/datasource_metrics_utils.bash b/resources-mac/otel/datasource_metrics_utils.bash index 0e9d80cce..e4a19ff0c 100755 --- a/resources-mac/otel/datasource_metrics_utils.bash +++ b/resources-mac/otel/datasource_metrics_utils.bash @@ -217,6 +217,11 @@ function add_metrics_processors_to_otel_config { for metrics_otel_processor in "${METRICS_OTEL_PROCESSORS[@]}"; do local processor_name="${metrics_otel_processor//_//}" + if [[ $processor_name == 'resource_agent' ]] ; then + AGENT_VERSION=$(cat '/tmp/logzio/version') + add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" + fi + add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.service.pipelines.metrics.processors' "$processor_name" if [[ $? -ne 0 ]]; then message="metrics.bash ($EXIT_CODE): $(get_task_error_message)" diff --git a/resources/otel/processors/resource_agent.yaml b/resources/otel/processors/resource_agent.yaml index 5e660048b..94f022f2c 100644 --- a/resources/otel/processors/resource_agent.yaml +++ b/resources/otel/processors/resource_agent.yaml @@ -1,5 +1,5 @@ resource/agent: attributes: - key: logzio_agent_version - value: v1.1.34 + value: action: upsert \ No newline at end of file From 5ecfcd4ddc09d3a2435556605c8abde666413574 Mon Sep 17 00:00:00 2001 From: 8naama Date: Thu, 8 Aug 2024 10:45:16 +0300 Subject: [PATCH 2/5] update version --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index 8f0dbd415..ef5570bfb 100644 --- a/version +++ b/version @@ -1 +1 @@ -v1.1.37 +v1.1.38 From f7c503d2af2ba43c173765d79df88693c75671f2 Mon Sep 17 00:00:00 2001 From: 8naama Date: Thu, 8 Aug 2024 17:34:44 +0300 Subject: [PATCH 3/5] changes following test --- .../windows/system/telemetry/logs/functions.ps1 | 11 ++++++----- .../windows/system/telemetry/metrics/functions.ps1 | 10 +++++----- resources-linux/otel/datasource_logs_utils.bash | 10 +++++----- resources-linux/otel/datasource_metrics_utils.bash | 10 +++++----- resources-mac/otel/datasource_logs_utils.bash | 10 +++++----- resources-mac/otel/datasource_metrics_utils.bash | 11 ++++++----- 6 files changed, 32 insertions(+), 30 deletions(-) diff --git a/datasources/windows/localhost/windows/system/telemetry/logs/functions.ps1 b/datasources/windows/localhost/windows/system/telemetry/logs/functions.ps1 index f5bdd05e2..6f1b13fde 100755 --- a/datasources/windows/localhost/windows/system/telemetry/logs/functions.ps1 +++ b/datasources/windows/localhost/windows/system/telemetry/logs/functions.ps1 @@ -504,11 +504,6 @@ function Add-LogsProcessorsToOtelConfig { foreach ($LogsOtelProcessor in $LogsOtelProcessors) { $local:ProcessorName = $LogsOtelProcessor.Replace('_', '/') - if ($ProcessorName -eq 'resource_agent') { - $local:AgentVersion = Get-Content "$env:TEMP\Logzio\version" - $Err = Add-YamlFileFieldValue "$script:OtelResourcesDir\$script:OtelConfigName" '.processors.resource/agent.attributes[0].value' $AgentVersion - } - $Err = Add-YamlFileFieldValue "$script:OtelResourcesDir\$script:OtelConfigName" '.service.pipelines.logs.processors' $ProcessorName if ($Err.Count -ne 0) { $Message = "logs.ps1 ($ExitCode): $($Err[0])" @@ -541,6 +536,12 @@ function Add-LogsProcessorsToOtelConfig { return $ExitCode } + + if ($ProcessorName -eq 'resource/agent') { + $local:AgentVersion = Get-Content "$env:TEMP\Logzio\version" + $Err = Add-YamlFileFieldValue "$script:OtelResourcesDir\$script:OtelConfigName" '.processors.resource/agent.attributes[0].value' $AgentVersion + } + } } diff --git a/datasources/windows/localhost/windows/system/telemetry/metrics/functions.ps1 b/datasources/windows/localhost/windows/system/telemetry/metrics/functions.ps1 index 748969334..bac252741 100755 --- a/datasources/windows/localhost/windows/system/telemetry/metrics/functions.ps1 +++ b/datasources/windows/localhost/windows/system/telemetry/metrics/functions.ps1 @@ -302,11 +302,6 @@ function Add-MetricsProcessorsToOtelConfig { foreach ($MetricsOtelProcessor in $MetricsOtelProcessors) { $local:ProcessorName = $MetricsOtelProcessor.Replace('_', '/') - if ($ProcessorName -eq 'resource_agent') { - $local:AgentVersion = Get-Content "$env:TEMP\Logzio\version" - $Err = Add-YamlFileFieldValue "$script:OtelResourcesDir\$script:OtelConfigName" '.processors.resource/agent.attributes[0].value' $AgentVersion - } - $Err = Add-YamlFileFieldValue "$script:OtelResourcesDir\$script:OtelConfigName" '.service.pipelines.metrics.processors' $ProcessorName if ($Err.Count -ne 0) { $Message = "metrics.ps1 ($ExitCode): $($Err[0])" @@ -339,6 +334,11 @@ function Add-MetricsProcessorsToOtelConfig { return $ExitCode } + + if ($ProcessorName -eq 'resource/agent') { + $local:AgentVersion = Get-Content "$env:TEMP\Logzio\version" + $Err = Add-YamlFileFieldValue "$script:OtelResourcesDir\$script:OtelConfigName" '.processors.resource/agent.attributes[0].value' $AgentVersion + } } } diff --git a/resources-linux/otel/datasource_logs_utils.bash b/resources-linux/otel/datasource_logs_utils.bash index c7c151b58..e09f9fa69 100755 --- a/resources-linux/otel/datasource_logs_utils.bash +++ b/resources-linux/otel/datasource_logs_utils.bash @@ -196,11 +196,6 @@ function add_logs_processors_to_otel_config { for logs_otel_processor in "${LOGS_OTEL_PROCESSORS[@]}"; do local processor_name="${logs_otel_processor//_//}" - if [[ $processor_name == 'resource_agent' ]] ; then - AGENT_VERSION=$(cat '/tmp/logzio/version') - add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" - fi - add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.service.pipelines.logs.processors' $processor_name if [[ $? -ne 0 ]]; then message="logs.bash ($EXIT_CODE): $(get_task_error_message)" @@ -233,6 +228,11 @@ function add_logs_processors_to_otel_config { return $EXIT_CODE fi + + if [[ $processor_name == 'resource/agent' ]] ; then + AGENT_VERSION=$(cat '/tmp/logzio/version') + add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" + fi done } diff --git a/resources-linux/otel/datasource_metrics_utils.bash b/resources-linux/otel/datasource_metrics_utils.bash index aae3e996a..791dbd0b4 100755 --- a/resources-linux/otel/datasource_metrics_utils.bash +++ b/resources-linux/otel/datasource_metrics_utils.bash @@ -217,11 +217,6 @@ function add_metrics_processors_to_otel_config { for metrics_otel_processor in "${METRICS_OTEL_PROCESSORS[@]}"; do local processor_name="${metrics_otel_processor//_//}" - if [[ $processor_name == 'resource_agent' ]] ; then - AGENT_VERSION=$(cat '/tmp/logzio/version') - add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" - fi - add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.service.pipelines.metrics.processors' "$processor_name" if [[ $? -ne 0 ]]; then message="metrics.bash ($EXIT_CODE): $(get_task_error_message)" @@ -254,6 +249,11 @@ function add_metrics_processors_to_otel_config { return $EXIT_CODE fi + + if [[ $processor_name == 'resource/agent' ]] ; then + AGENT_VERSION=$(cat '/tmp/logzio/version') + add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" + fi done } diff --git a/resources-mac/otel/datasource_logs_utils.bash b/resources-mac/otel/datasource_logs_utils.bash index 2ee253fe2..de2ea799b 100755 --- a/resources-mac/otel/datasource_logs_utils.bash +++ b/resources-mac/otel/datasource_logs_utils.bash @@ -197,11 +197,6 @@ function add_logs_processors_to_otel_config { for logs_otel_processor in "${LOGS_OTEL_PROCESSORS[@]}"; do local processor_name="${logs_otel_processor//_//}" - if [[ $processor_name == 'resource_agent' ]] ; then - AGENT_VERSION=$(cat '/tmp/logzio/version') - add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" - fi - add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.service.pipelines.logs.processors' $processor_name if [[ $? -ne 0 ]]; then message="logs.bash ($EXIT_CODE): $(get_task_error_message)" @@ -234,6 +229,11 @@ function add_logs_processors_to_otel_config { return $EXIT_CODE fi + + if [[ $processor_name == 'resource/agent' ]] ; then + AGENT_VERSION=$(cat '/tmp/logzio/version') + add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" + fi done } diff --git a/resources-mac/otel/datasource_metrics_utils.bash b/resources-mac/otel/datasource_metrics_utils.bash index e4a19ff0c..a7a764b41 100755 --- a/resources-mac/otel/datasource_metrics_utils.bash +++ b/resources-mac/otel/datasource_metrics_utils.bash @@ -217,11 +217,6 @@ function add_metrics_processors_to_otel_config { for metrics_otel_processor in "${METRICS_OTEL_PROCESSORS[@]}"; do local processor_name="${metrics_otel_processor//_//}" - if [[ $processor_name == 'resource_agent' ]] ; then - AGENT_VERSION=$(cat '/tmp/logzio/version') - add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" - fi - add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.service.pipelines.metrics.processors' "$processor_name" if [[ $? -ne 0 ]]; then message="metrics.bash ($EXIT_CODE): $(get_task_error_message)" @@ -254,6 +249,12 @@ function add_metrics_processors_to_otel_config { return $EXIT_CODE fi + + if [[ $processor_name == 'resource/agent' ]] ; then + AGENT_VERSION=$(cat '/tmp/logzio/version') + add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" + fi + done } From 8cf482b7648416a21cef95dd86ef836e7bb3db57 Mon Sep 17 00:00:00 2001 From: 8naama Date: Thu, 8 Aug 2024 18:38:06 +0300 Subject: [PATCH 4/5] change branch name --- .../localhost/windows/system/telemetry/logs/functions.ps1 | 1 - resources-mac/otel/datasource_metrics_utils.bash | 1 - 2 files changed, 2 deletions(-) diff --git a/datasources/windows/localhost/windows/system/telemetry/logs/functions.ps1 b/datasources/windows/localhost/windows/system/telemetry/logs/functions.ps1 index 6f1b13fde..a91fbc5e1 100755 --- a/datasources/windows/localhost/windows/system/telemetry/logs/functions.ps1 +++ b/datasources/windows/localhost/windows/system/telemetry/logs/functions.ps1 @@ -541,7 +541,6 @@ function Add-LogsProcessorsToOtelConfig { $local:AgentVersion = Get-Content "$env:TEMP\Logzio\version" $Err = Add-YamlFileFieldValue "$script:OtelResourcesDir\$script:OtelConfigName" '.processors.resource/agent.attributes[0].value' $AgentVersion } - } } diff --git a/resources-mac/otel/datasource_metrics_utils.bash b/resources-mac/otel/datasource_metrics_utils.bash index a7a764b41..5c214a0bd 100755 --- a/resources-mac/otel/datasource_metrics_utils.bash +++ b/resources-mac/otel/datasource_metrics_utils.bash @@ -254,7 +254,6 @@ function add_metrics_processors_to_otel_config { AGENT_VERSION=$(cat '/tmp/logzio/version') add_yaml_file_field_value "$OTEL_RESOURCES_DIR/$OTEL_CONFIG_NAME" '.processors.resource/agent.attributes[0].value' "$AGENT_VERSION" fi - done } From 474eacd9a9759f9896bb87e2c3b54ef74fbe2dd5 Mon Sep 17 00:00:00 2001 From: 8naama Date: Sun, 11 Aug 2024 11:39:15 +0300 Subject: [PATCH 5/5] update version --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index ef5570bfb..8f0dbd415 100644 --- a/version +++ b/version @@ -1 +1 @@ -v1.1.38 +v1.1.37