Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3736#discussion_r112390997
  
    --- Diff: 
flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpClient.java
 ---
    @@ -0,0 +1,83 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.metrics.datadog;
    +
    +import okhttp3.MediaType;
    +import okhttp3.OkHttpClient;
    +import okhttp3.Request;
    +import okhttp3.Response;
    +import okhttp3.RequestBody;
    +
    +import java.io.IOException;
    +import java.util.concurrent.TimeUnit;
    +
    +/**
    + * Http client talking to Datadog
    + * */
    +public class DatadogHttpClient{
    +   private static final String SERIES_URL_FORMAT = 
"https://app.datadoghq.com/api/v1/series?api_key=%s";;
    +   private static final String VALIDATE_URL_FORMAT = 
"https://app.datadoghq.com/api/v1/validate?api_key=%s";;
    +   private static final MediaType MEDIA_TYPE = 
MediaType.parse("application/json; charset=utf-8");
    +   private static final int TIMEOUT = 5;
    +
    +   private final String seriesUrl;
    +   private final String validateUrl;
    +   private final OkHttpClient client;
    --- End diff --
    
    The documentation states "The threads and connections that are held will be 
released automatically if they remain idle.
    But if you are writing a application that needs to aggressively release 
unused resources you may do so."
    
    Since there is no harm in releasing the resources earlier, let's do that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to