Skip to content
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

refactor(retrofit): replace OkClient with Ok3Client #1453

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static retrofit.Endpoints.newFixedEndpoint;

import com.jakewharton.retrofit.Ok3Client;
import com.netflix.spinnaker.echo.jackson.EchoObjectMapper;
import com.netflix.spinnaker.echo.jira.JiraProperties;
import com.netflix.spinnaker.echo.jira.JiraService;
Expand All @@ -32,7 +33,6 @@
import org.springframework.context.annotation.Configuration;
import retrofit.RestAdapter;
import retrofit.client.Client;
import retrofit.client.OkClient;
import retrofit.converter.JacksonConverter;

@Configuration
Expand All @@ -42,7 +42,7 @@ public class JiraConfig {
private static Logger LOGGER = LoggerFactory.getLogger(JiraConfig.class);

@Autowired(required = false)
private OkClient x509ConfiguredClient;
private Ok3Client x509ConfiguredClient;

@Bean
JiraService jiraService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import com.netflix.spinnaker.echo.scheduler.actions.pipeline.QuartzDiscoveryActi
import com.netflix.spinnaker.echo.scheduler.actions.pipeline.TriggerConverter
import com.netflix.spinnaker.echo.scheduler.actions.pipeline.TriggerListener
import com.netflix.spinnaker.kork.sql.config.DefaultSqlConfiguration
import com.squareup.okhttp.OkHttpClient
import org.quartz.JobDetail
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
Expand All @@ -34,8 +33,6 @@ import org.springframework.context.annotation.Import
import org.springframework.scheduling.quartz.JobDetailFactoryBean
import org.springframework.scheduling.quartz.SchedulerFactoryBean
import org.springframework.scheduling.quartz.SimpleTriggerFactoryBean
import retrofit.client.Client
import retrofit.client.OkClient

import javax.sql.DataSource
import java.util.concurrent.TimeUnit
Expand Down
1 change: 1 addition & 0 deletions echo-telemetry/echo-telemetry.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies {
implementation "io.spinnaker.kork:kork-proto"
implementation "io.spinnaker.kork:kork-security"
implementation 'io.spinnaker.kork:kork-web'
implementation 'com.jakewharton.retrofit:retrofit1-okhttp3-client'
implementation 'com.squareup.retrofit:retrofit'
implementation 'com.squareup.retrofit:converter-jackson'
implementation 'de.huxhorn.sulky:de.huxhorn.sulky.ulid'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
*/
package com.netflix.spinnaker.echo.config

import com.jakewharton.retrofit.Ok3Client
import com.netflix.spinnaker.echo.config.TelemetryConfig.TelemetryConfigProps
import com.netflix.spinnaker.echo.telemetry.TelemetryService
import com.netflix.spinnaker.retrofit.RetrofitConfigurationProperties
import com.netflix.spinnaker.retrofit.Slf4jRetrofitLogger
import com.squareup.okhttp.OkHttpClient
import de.huxhorn.sulky.ulid.ULID
import java.util.concurrent.TimeUnit
import okhttp3.OkHttpClient
import org.slf4j.LoggerFactory
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import retrofit.RestAdapter
import retrofit.client.OkClient
import retrofit.converter.JacksonConverter

@Configuration
Expand Down Expand Up @@ -57,11 +57,12 @@ open class TelemetryConfig {
.create(TelemetryService::class.java)
}

private fun telemetryOkClient(configProps: TelemetryConfigProps): OkClient {
val httpClient = OkHttpClient()
httpClient.setConnectTimeout(configProps.connectionTimeoutMillis.toLong(), TimeUnit.MILLISECONDS)
httpClient.setReadTimeout(configProps.readTimeoutMillis.toLong(), TimeUnit.MILLISECONDS)
return OkClient(httpClient)
private fun telemetryOkClient(configProps: TelemetryConfigProps): Ok3Client {
val httpClient = OkHttpClient.Builder()
.connectTimeout(configProps.connectionTimeoutMillis.toLong(), TimeUnit.MILLISECONDS)
.readTimeout(configProps.readTimeoutMillis.toLong(), TimeUnit.MILLISECONDS)
.build()
return Ok3Client(httpClient)
}

@ConfigurationProperties(prefix = "stats")
Expand Down