-
Notifications
You must be signed in to change notification settings - Fork 208
Add azure_monitor to metrics exporter for AKS #4575
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
Open
xiang17
wants to merge
16
commits into
microsoft:main
Choose a base branch
from
xiang17:xiang17/aksMetrics-azure_monitor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+411
−5
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8e759b9
Add azure_monitor to metrics exporter for AKS
xiang17 dac5b9e
Check AKS_ARM_NAMESPACE_ID env var in AiConfigCustomizer
xiang17 4b90df6
modify the AMLE condition to activate on both unset and true
xiang17 ef4951b
Make a copy of OtlpTest.java file
xiang17 bf6a1b1
Modify original OtlpTest to test APPLICATIONINSIGHTS_METRICS_TO_LOGAN…
xiang17 4317532
Add additional JDK+server combos
xiang17 f1cef22
`./gradlew spotlessApply`
xiang17 a2f062a
more of `./gradlew spotlessApply`
xiang17 1412085
extract a couple of methods
trask 71c731a
don't catch the permission exception
xiang17 8c6c78b
rename
xiang17 a19c835
refactor conditions and add unit tests
xiang17 1d5a419
./gradlew spotlessApply
xiang17 68dcbc9
refine with more clear rules
xiang17 0f3e2d6
Avoid overriding entire value. Append as needed.
xiang17 3089554
./gradlew spotlessApply
xiang17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
...st/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizerTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.microsoft.applicationinsights.agent.internal.init; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import java.util.stream.Stream; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.params.ParameterizedTest; | ||
| import org.junit.jupiter.params.provider.Arguments; | ||
| import org.junit.jupiter.params.provider.MethodSource; | ||
|
|
||
| class AiConfigCustomizerTest { | ||
|
|
||
| @Test | ||
| void isAksAttach() { | ||
| assertThat(AiConfigCustomizer.isAksAttach("dummy-aks-namespace")).isTrue(); | ||
|
|
||
| assertThat(AiConfigCustomizer.isAksAttach(null)).isFalse(); | ||
| assertThat(AiConfigCustomizer.isAksAttach("")).isFalse(); | ||
| } | ||
|
|
||
| @Test | ||
| void updateMetricsExporter_ExporterUnset() { | ||
|
|
||
| assertThat(AiConfigCustomizer.updateMetricsExporter(null, null)) | ||
| .isEqualTo("azure_monitor,otlp"); | ||
|
|
||
| assertThat(AiConfigCustomizer.updateMetricsExporter("", null)).isEqualTo("azure_monitor,otlp"); | ||
|
|
||
| assertThat(AiConfigCustomizer.updateMetricsExporter(null, "true")) | ||
| .isEqualTo("azure_monitor,otlp"); | ||
|
|
||
| assertThat(AiConfigCustomizer.updateMetricsExporter(null, "True")) | ||
| .isEqualTo("azure_monitor,otlp"); | ||
| } | ||
|
|
||
| static Stream<Arguments> stringPairs() { | ||
| return Stream.of( | ||
| Arguments.of("none", "none"), | ||
| Arguments.of("azure_monitor", "azure_monitor,otlp"), | ||
| Arguments.of("azure_monitor,otlp", "azure_monitor,otlp"), | ||
| Arguments.of("otlp", "otlp")); | ||
| } | ||
|
|
||
| @ParameterizedTest | ||
| @MethodSource("stringPairs") | ||
| void updateMetricsExporter_ExporterSet_AMLE_Unset( | ||
| String metricsExporter, String expectAzureMonitor) { | ||
| assertThat(AiConfigCustomizer.updateMetricsExporter(metricsExporter, null)) | ||
| .isEqualTo(expectAzureMonitor); | ||
| assertThat(AiConfigCustomizer.updateMetricsExporter(metricsExporter, "")) | ||
| .isEqualTo(expectAzureMonitor); | ||
| } | ||
|
|
||
| static Stream<Arguments> stringPairs2() { | ||
| return Stream.of( | ||
| Arguments.of("none", "azure_monitor,otlp"), | ||
| Arguments.of("azure_monitor", "azure_monitor,otlp"), | ||
| Arguments.of("azure_monitor,otlp", "azure_monitor,otlp"), | ||
| Arguments.of("otlp", "otlp,azure_monitor")); | ||
| } | ||
|
|
||
| @ParameterizedTest | ||
| @MethodSource("stringPairs2") | ||
| void updateMetricsExporter_ExporterSet_AMLE_True( | ||
| String metricsExporter, String expectAzureMonitor) { | ||
| assertThat(AiConfigCustomizer.updateMetricsExporter(metricsExporter, "true")) | ||
| .isEqualTo(expectAzureMonitor); | ||
| assertThat(AiConfigCustomizer.updateMetricsExporter(metricsExporter, "True")) | ||
| .isEqualTo(expectAzureMonitor); | ||
| } | ||
|
|
||
| static Stream<Arguments> stringPairs3() { | ||
| return Stream.of( | ||
| Arguments.of("none", "none"), | ||
| Arguments.of("azure_monitor", "azure_monitor"), | ||
| Arguments.of("azure_monitor,otlp", "azure_monitor"), | ||
| Arguments.of("otlp", "otlp")); | ||
| } | ||
|
|
||
| @ParameterizedTest | ||
| @MethodSource("stringPairs3") | ||
| void updateMetricsExporter_ExporterSet_AMLE_False( | ||
| String metricsExporter, String expectAzureMonitor) { | ||
| assertThat(AiConfigCustomizer.updateMetricsExporter(metricsExporter, "false")) | ||
| .isEqualTo(expectAzureMonitor); | ||
| assertThat(AiConfigCustomizer.updateMetricsExporter(metricsExporter, "False")) | ||
| .isEqualTo(expectAzureMonitor); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
i don't understand why adding
otlphere?