Skip to content

Commit

Permalink
Deprecated the azure spring telemetry configuration item and remove t…
Browse files Browse the repository at this point in the history
…he telemetry code usage. (#22200)
  • Loading branch information
Moary Chen authored Jun 18, 2021
1 parent 88b2b2f commit b1dcfcd
Show file tree
Hide file tree
Showing 72 changed files with 102 additions and 1,462 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ the main ServiceBusClientBuilder. -->
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.autoconfigure.jms.ConnectionStringResolver"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.data.cosmos.config.AbstractCosmosConfiguration.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.data.cosmos.core.query.CosmosPageRequest.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.cloud.autoconfigure.telemetry.TelemetryAutoConfiguration.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.cloud.autoconfigure.context.AzureEnvironmentAutoConfiguration.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.cloud.autoconfigure.storage.AzureStorageQueueAutoConfiguration.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.cloud.autoconfigure.storage.AzureStorageAutoConfiguration.java"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2278,23 +2278,14 @@
<!-- Exclude from spring related classes -->
<Match>
<Or>
<Class name="com.azure.spring.utils.GetHashMac"/> <!-- false positive -->
<Class name="com.azure.spring.utils.PropertyLoader"/> <!-- false positive -->
<Class name="com.azure.spring.cloud.telemetry.GetHashMac"/> <!-- false positive -->
</Or>
<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE,
NP_LOAD_OF_KNOWN_NULL_VALUE,
RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE,
RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE"/>
</Match>

<Match>
<Or>
<Class name="com.azure.spring.telemetry.TelemetryEventData$EventData$CustomData"/> <!-- false positive -->
</Or>
<Bug pattern="UPM_UNCALLED_PRIVATE_METHOD"/>
</Match>

<Match>
<Or>
<Class name="com.azure.spring.integration.servicebus.queue.ServiceBusQueueTemplate$QueueMessageHandler"/> <!-- false positive -->
Expand Down
5 changes: 0 additions & 5 deletions eng/jacoco-test-coverage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,6 @@
<artifactId>azure-spring-cloud-context</artifactId>
<version>2.6.0-beta.1</version> <!-- {x-version-update;com.azure.spring:azure-spring-cloud-context;current} -->
</dependency>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>azure-spring-cloud-telemetry</artifactId>
<version>2.6.0-beta.1</version> <!-- {x-version-update;com.azure.spring:azure-spring-cloud-telemetry;current} -->
</dependency>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>azure-spring-integration-core</artifactId>
Expand Down
1 change: 0 additions & 1 deletion eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ com.azure.spring:azure-spring-cloud-stream-binder-servicebus-core;2.5.0;2.6.0-be
com.azure.spring:azure-spring-cloud-stream-binder-servicebus-queue;2.5.0;2.6.0-beta.1
com.azure.spring:azure-spring-cloud-stream-binder-servicebus-topic;2.5.0;2.6.0-beta.1
com.azure.spring:azure-spring-cloud-stream-binder-test;2.5.0;2.6.0-beta.1
com.azure.spring:azure-spring-cloud-telemetry;2.5.0;2.6.0-beta.1
com.azure.spring:azure-spring-integration-core;2.5.0;2.6.0-beta.1
com.azure.spring:azure-spring-integration-eventhubs;2.5.0;2.6.0-beta.1
com.azure.spring:azure-spring-integration-servicebus;2.5.0;2.6.0-beta.1
Expand Down
3 changes: 3 additions & 0 deletions sdk/boms/azure-spring-cloud-dependencies/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release History

## 3.6.0-beta.1 (Unreleased)
### Breaking Changes
- Remove `azure-spring-cloud-telemetry` module dependency.

## 2.5.0 (2021-05-24)

Expand Down
5 changes: 0 additions & 5 deletions sdk/boms/azure-spring-cloud-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,6 @@
<artifactId>spring-cloud-starter-azure-appconfiguration-config</artifactId>
<version>${azure.spring.appconfigure.version}</version>
</dependency>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>azure-spring-cloud-telemetry</artifactId>
<version>${azure.spring.cloud.version}</version>
</dependency>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>azure-identity-spring</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@
<artifactId>azure-spring-cloud-stream-binder-eventhubs</artifactId>
<version>2.6.0-beta.1</version> <!-- {x-version-update;com.azure.spring:azure-spring-cloud-stream-binder-eventhubs;current} -->
</dependency>
<!-- Storage library for provisioning checkpoint storage -->
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>azure-spring-cloud-storage</artifactId>
<version>2.6.0-beta.1</version> <!-- {x-version-update;com.azure.spring:azure-spring-cloud-storage;current} -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Release History

## 3.6.0-beta.1 (Unreleased)

### Breaking Changes
- Deprecated `allowTelemetry` configuration item.

## 3.5.0 (2021-05-24)
### New Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 3.6.0-beta.1 (Unreleased)
### Breaking Changes
- Deprecate aad.group.enable-full-list, use aad.group.allowed-group-ids=all instead.
- Deprecated `allowTelemetry` configuration item.

### New Features
- Support domain_hint in aad-starter.([#21517](https://github.com/Azure/azure-sdk-for-java/issues/21517))
Expand Down
3 changes: 2 additions & 1 deletion sdk/spring/azure-spring-boot-starter-cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Release History

## 3.6.0-beta.1 (Unreleased)

### Breaking Changes
- Deprecated `allowTelemetry` configuration item.

## 3.5.0 (2021-05-24)
### New Features
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Release History

## 3.6.0-beta.1 (Unreleased)

### Breaking Changes
- Deprecated `allowTelemetry` configuration item.

## 3.5.0 (2021-05-24)
### New Features
Expand Down
1 change: 1 addition & 0 deletions sdk/spring/azure-spring-boot/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 3.6.0-beta.1 (Unreleased)
### Breaking Changes
- Deprecate aad.group.enable-full-list, use aad.group.allowed-group-ids=all instead.
- Deprecated `allowTelemetry` configuration item in each module property class.

### New Features
- Support domain_hint in aad-starter.([#21517](https://github.com/Azure/azure-sdk-for-java/issues/21517))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package com.azure.spring.autoconfigure.aad;

import com.azure.spring.aad.AADAuthorizationServerEndpoints;
import com.azure.spring.telemetry.TelemetrySender;
import com.nimbusds.jose.jwk.source.DefaultJWKSetCache;
import com.nimbusds.jose.jwk.source.JWKSetCache;
import com.nimbusds.jose.util.DefaultResourceRetriever;
Expand All @@ -21,16 +20,9 @@
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.ClassUtils;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import static com.azure.spring.telemetry.TelemetryData.SERVICE_NAME;
import static com.azure.spring.telemetry.TelemetryData.getClassPackageSimpleName;

/**
* {@link EnableAutoConfiguration Auto-configuration} for Azure Active Authentication filters.
* <p>
Expand Down Expand Up @@ -111,14 +103,4 @@ public JWKSetCache getJWKSetCache() {
long refreshTime = properties.getJwkSetCacheRefreshTime();
return new DefaultJWKSetCache(lifespan, refreshTime, TimeUnit.MILLISECONDS);
}

@PostConstruct
private void sendTelemetry() {
if (properties.isAllowTelemetry()) {
final Map<String, String> events = new HashMap<>();
final TelemetrySender sender = new TelemetrySender();
events.put(SERVICE_NAME, getClassPackageSimpleName(AADAuthenticationFilterAutoConfiguration.class));
sender.send(ClassUtils.getUserClass(getClass()).getSimpleName(), events);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ public void setPostLogoutRedirectUri(String postLogoutRedirectUri) {
this.postLogoutRedirectUri = postLogoutRedirectUri;
}

@Deprecated
@DeprecatedConfigurationProperty(
reason = "Deprecate the telemetry endpoint and use HTTP header User Agent instead.")
public boolean isAllowTelemetry() {
return allowTelemetry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.
package com.azure.spring.autoconfigure.b2c;

import com.azure.spring.telemetry.TelemetrySender;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnResource;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
Expand All @@ -12,15 +11,6 @@
import org.springframework.context.annotation.Import;
import org.springframework.lang.NonNull;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.util.ClassUtils;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

import static com.azure.spring.telemetry.TelemetryData.SERVICE_NAME;
import static com.azure.spring.telemetry.TelemetryData.TENANT_NAME;
import static com.azure.spring.telemetry.TelemetryData.getClassPackageSimpleName;

/**
* When the configuration matches the {@link AADB2CConditions.CommonCondition.WebAppMode} condition,
Expand Down Expand Up @@ -61,15 +51,4 @@ public AADB2COidcLoginConfigurer b2cLoginConfigurer(AADB2CLogoutSuccessHandler h
AADB2CAuthorizationRequestResolver resolver) {
return new AADB2COidcLoginConfigurer(handler, resolver);
}

@PostConstruct
private void sendTelemetry() {
if (properties.isAllowTelemetry()) {
final Map<String, String> events = new HashMap<>();
final TelemetrySender sender = new TelemetrySender();
events.put(SERVICE_NAME, getClassPackageSimpleName(AADB2CAutoConfiguration.class));
events.put(TENANT_NAME, properties.getTenant());
sender.send(ClassUtils.getUserClass(getClass()).getSimpleName(), events);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ public void setAuthenticateAdditionalParameters(Map<String, Object> authenticate
this.authenticateAdditionalParameters = authenticateAdditionalParameters;
}

@Deprecated
@DeprecatedConfigurationProperty(
reason = "Deprecate the telemetry endpoint and use HTTP header User Agent instead.")
public boolean isAllowTelemetry() {
return allowTelemetry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotEmpty;
Expand Down Expand Up @@ -102,6 +103,9 @@ public void setConsistencyLevel(ConsistencyLevel consistencyLevel) {
this.consistencyLevel = consistencyLevel;
}

@Deprecated
@DeprecatedConfigurationProperty(
reason = "Deprecate the telemetry endpoint and use HTTP header User Agent instead.")
public boolean isAllowTelemetry() {
return allowTelemetry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,20 @@
import com.azure.security.keyvault.secrets.SecretClientBuilder;
import com.azure.security.keyvault.secrets.SecretServiceVersion;
import com.azure.spring.keyvault.KeyVaultProperties.Property;
import com.azure.spring.telemetry.TelemetrySender;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import static com.azure.spring.telemetry.TelemetryData.SERVICE_NAME;
import static com.azure.spring.telemetry.TelemetryData.getClassPackageSimpleName;
import static com.azure.spring.utils.ApplicationId.AZURE_SPRING_KEY_VAULT;
import static com.azure.spring.utils.Constants.AZURE_KEYVAULT_PROPERTYSOURCE_NAME;
import static com.azure.spring.utils.Constants.DEFAULT_REFRESH_INTERVAL_MS;
Expand All @@ -51,8 +45,6 @@ class KeyVaultEnvironmentPostProcessorHelper {
KeyVaultEnvironmentPostProcessorHelper(final ConfigurableEnvironment environment) {
this.environment = environment;
Assert.notNull(environment, "environment must not be null!");
// As @PostConstructor not available when post processor, call it explicitly.
sendTelemetry();
}

/**
Expand Down Expand Up @@ -182,13 +174,6 @@ public TokenCredential getCredentials(String normalizedName) {
return new ManagedIdentityCredentialBuilder().build();
}

private String getPropertyValue(final Property property) {
return Optional.of(property)
.map(KeyVaultProperties::getPropertyName)
.map(environment::getProperty)
.orElse(null);
}

private String getPropertyValue(final String normalizedName, final Property property) {
return getPropertyValue(normalizedName, property, null);
}
Expand All @@ -198,19 +183,4 @@ private String getPropertyValue(final String normalizedName, final Property prop
.map(environment::getProperty)
.orElse(defaultValue);
}

private boolean allowTelemetry() {
return Boolean.parseBoolean(getPropertyValue(Property.ALLOW_TELEMETRY));
}

private void sendTelemetry() {
if (allowTelemetry()) {
final Map<String, String> events = new HashMap<>();
final TelemetrySender sender = new TelemetrySender();

events.put(SERVICE_NAME, getClassPackageSimpleName(KeyVaultEnvironmentPostProcessorHelper.class));

sender.send(ClassUtils.getUserClass(getClass()).getSimpleName(), events);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;

/**
* KeyVaultProperties
Expand Down Expand Up @@ -107,6 +108,9 @@ public void setCaseSensitiveKeys(String caseSensitiveKeys) {
this.caseSensitiveKeys = caseSensitiveKeys;
}

@Deprecated
@DeprecatedConfigurationProperty(
reason = "Deprecate the telemetry endpoint and use HTTP header User Agent instead.")
public String getAllowTelemetry() {
return allowTelemetry;
}
Expand Down Expand Up @@ -139,7 +143,6 @@ public void setAllowTelemetry(String allowTelemetry) {
* enum Property
*/
public enum Property {
ALLOW_TELEMETRY("allow-telemetry"),
CASE_SENSITIVE_KEYS("case-sensitive-keys"),
CERTIFICATE_PASSWORD("certificate-password"),
AUTHORITY_HOST("authority-host"),
Expand Down

This file was deleted.

Loading

0 comments on commit b1dcfcd

Please sign in to comment.