Skip to content
Draft
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 @@ -40,7 +40,7 @@ data class Version(
}

object Snapshot : Type() {
override val suffix: String = "-SNAPSHOT"
override val suffix: String = "-CRONET-SNAPSHOT"
}
}

Expand Down
1 change: 1 addition & 0 deletions ci/pipelines/default-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ publish:release-all:
only:
- tags
- develop
- tvaleev/feature/cronet-apm-snapshot
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
Expand Down
36 changes: 36 additions & 0 deletions dd-sdk-android-core/api/apiSurface
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ interface com.datadog.android.api.InternalLogger
fun logApiUsage(Float = DEFAULT_API_USAGE_TELEMETRY_SAMPLING_RATE, () -> com.datadog.android.internal.telemetry.InternalTelemetryEvent.ApiUsage)
companion object
val UNBOUND: InternalLogger
fun InternalLogger.logToUser(InternalLogger.Level, Boolean = false, () -> String)
interface com.datadog.android.api.SdkCore
val name: String
val time: com.datadog.android.api.context.TimeInfo
Expand Down Expand Up @@ -152,18 +153,29 @@ interface com.datadog.android.api.feature.StorageBackedFeature : Feature
interface com.datadog.android.api.instrumentation.network.ExtendedRequestInfo
fun <T> tag(Class<T>): T?
fun <T> HttpRequestInfo.tag(Class<T>): T?
interface com.datadog.android.api.instrumentation.network.HttpRequestBody
interface com.datadog.android.api.instrumentation.network.HttpRequestInfo
val url: String
val headers: Map<String, List<String>>
val contentType: String?
val method: String
fun contentLength(): Long?
interface com.datadog.android.api.instrumentation.network.HttpRequestInfoBuilder
fun setUrl(String): HttpRequestInfoBuilder
fun addHeader(String, String): HttpRequestInfoBuilder
fun removeHeader(String): HttpRequestInfoBuilder
fun replaceHeader(String, String): HttpRequestInfoBuilder
fun <T> addTag(Class<T>, T?): HttpRequestInfoBuilder
fun setMethod(String, HttpRequestBody? = null): HttpRequestInfoBuilder
fun build(): HttpRequestInfo
interface com.datadog.android.api.instrumentation.network.HttpResponseInfo
val url: String
val statusCode: Int
val headers: Map<String, List<String>>
val contentType: String?
val contentLength: Long?
interface com.datadog.android.api.instrumentation.network.MutableHttpRequestInfo
fun newBuilder(): HttpRequestInfoBuilder
data class com.datadog.android.api.net.Request
constructor(String, String, String, Map<String, String>, ByteArray, String? = null)
data class com.datadog.android.api.net.RequestExecutionContext
Expand Down Expand Up @@ -321,11 +333,35 @@ object com.datadog.android.core.internal.net.HttpSpec
const val OPTIONS: String
const val CONNECT: String
fun values()
fun isMethodWithBody(String)
object Headers
const val CONTENT_TYPE: String
const val CONTENT_LENGTH: String
const val LOCATION: String
const val RETRY_AFTER: String
const val WEBSOCKET_ACCEPT_HEADER: String
object StatusCodes
const val OK: Int
const val MOVED_PERMANENTLY: Int
const val FOUND: Int
const val SEE_OTHER: Int
const val TEMPORARY_REDIRECT: Int
const val PERMANENT_REDIRECT: Int
const val BAD_REQUEST: Int
const val UNAUTHORIZED: Int
const val FORBIDDEN: Int
const val NOT_FOUND: Int
const val METHOD_NOT_ALLOWED: Int
const val REQUEST_TIMEOUT: Int
const val TOO_MANY_REQUESTS: Int
const val INTERNAL_ERROR: Int
const val BAD_GATEWAY: Int
const val SERVICE_UNAVAILABLE: Int
const val GATEWAY_TIMEOUT: Int
fun clientErrors()
fun serverErrors()
object ContentType
const val APPLICATION_JSON: String
const val TEXT_PLAIN: String
const val TEXT_EVENT_STREAM: String
const val APPLICATION_GRPC: String
Expand Down
54 changes: 54 additions & 0 deletions dd-sdk-android-core/api/dd-sdk-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ public final class com/datadog/android/api/InternalLogger$Target : java/lang/Enu
public static fun values ()[Lcom/datadog/android/api/InternalLogger$Target;
}

public final class com/datadog/android/api/InternalLoggerKt {
public static final fun logToUser (Lcom/datadog/android/api/InternalLogger;Lcom/datadog/android/api/InternalLogger$Level;ZLkotlin/jvm/functions/Function0;)V
public static synthetic fun logToUser$default (Lcom/datadog/android/api/InternalLogger;Lcom/datadog/android/api/InternalLogger$Level;ZLkotlin/jvm/functions/Function0;ILjava/lang/Object;)V
}

public abstract interface class com/datadog/android/api/SdkCore {
public abstract fun addAccountExtraInfo (Ljava/util/Map;)V
public abstract fun addUserProperties (Ljava/util/Map;)V
Expand Down Expand Up @@ -454,6 +459,9 @@ public final class com/datadog/android/api/instrumentation/network/ExtendedReque
public static final fun tag (Lcom/datadog/android/api/instrumentation/network/HttpRequestInfo;Ljava/lang/Class;)Ljava/lang/Object;
}

public abstract interface class com/datadog/android/api/instrumentation/network/HttpRequestBody {
}

public abstract interface class com/datadog/android/api/instrumentation/network/HttpRequestInfo {
public abstract fun contentLength ()Ljava/lang/Long;
public abstract fun getContentType ()Ljava/lang/String;
Expand All @@ -462,6 +470,21 @@ public abstract interface class com/datadog/android/api/instrumentation/network/
public abstract fun getUrl ()Ljava/lang/String;
}

public abstract interface class com/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder {
public abstract fun addHeader (Ljava/lang/String;[Ljava/lang/String;)Lcom/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder;
public abstract fun addTag (Ljava/lang/Class;Ljava/lang/Object;)Lcom/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder;
public abstract fun build ()Lcom/datadog/android/api/instrumentation/network/HttpRequestInfo;
public abstract fun removeHeader (Ljava/lang/String;)Lcom/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder;
public abstract fun replaceHeader (Ljava/lang/String;Ljava/lang/String;)Lcom/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder;
public abstract fun setMethod (Ljava/lang/String;Lcom/datadog/android/api/instrumentation/network/HttpRequestBody;)Lcom/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder;
public abstract fun setUrl (Ljava/lang/String;)Lcom/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder;
}

public final class com/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder$DefaultImpls {
public static fun replaceHeader (Lcom/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder;Ljava/lang/String;Ljava/lang/String;)Lcom/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder;
public static synthetic fun setMethod$default (Lcom/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder;Ljava/lang/String;Lcom/datadog/android/api/instrumentation/network/HttpRequestBody;ILjava/lang/Object;)Lcom/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder;
}

public abstract interface class com/datadog/android/api/instrumentation/network/HttpResponseInfo {
public abstract fun getContentLength ()Ljava/lang/Long;
public abstract fun getContentType ()Ljava/lang/String;
Expand All @@ -470,6 +493,10 @@ public abstract interface class com/datadog/android/api/instrumentation/network/
public abstract fun getUrl ()Ljava/lang/String;
}

public abstract interface class com/datadog/android/api/instrumentation/network/MutableHttpRequestInfo {
public abstract fun newBuilder ()Lcom/datadog/android/api/instrumentation/network/HttpRequestInfoBuilder;
}

public final class com/datadog/android/api/net/Request {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;[BLjava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;[BLjava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
Expand Down Expand Up @@ -834,6 +861,7 @@ public final class com/datadog/android/core/internal/net/HttpSpec$ContentType {
public static final field APPLICATION_GRPC Ljava/lang/String;
public static final field APPLICATION_GRPC_JSON Ljava/lang/String;
public static final field APPLICATION_GRPC_PROTO Ljava/lang/String;
public static final field APPLICATION_JSON Ljava/lang/String;
public static final field INSTANCE Lcom/datadog/android/core/internal/net/HttpSpec$ContentType;
public static final field TEXT_EVENT_STREAM Ljava/lang/String;
public static final field TEXT_PLAIN Ljava/lang/String;
Expand All @@ -844,6 +872,8 @@ public final class com/datadog/android/core/internal/net/HttpSpec$Headers {
public static final field CONTENT_LENGTH Ljava/lang/String;
public static final field CONTENT_TYPE Ljava/lang/String;
public static final field INSTANCE Lcom/datadog/android/core/internal/net/HttpSpec$Headers;
public static final field LOCATION Ljava/lang/String;
public static final field RETRY_AFTER Ljava/lang/String;
public static final field WEBSOCKET_ACCEPT_HEADER Ljava/lang/String;
}

Expand All @@ -858,9 +888,33 @@ public final class com/datadog/android/core/internal/net/HttpSpec$Method {
public static final field POST Ljava/lang/String;
public static final field PUT Ljava/lang/String;
public static final field TRACE Ljava/lang/String;
public final fun isMethodWithBody (Ljava/lang/String;)Z
public final fun values ()Ljava/util/List;
}

public final class com/datadog/android/core/internal/net/HttpSpec$StatusCodes {
public static final field BAD_GATEWAY I
public static final field BAD_REQUEST I
public static final field FORBIDDEN I
public static final field FOUND I
public static final field GATEWAY_TIMEOUT I
public static final field INSTANCE Lcom/datadog/android/core/internal/net/HttpSpec$StatusCodes;
public static final field INTERNAL_ERROR I
public static final field METHOD_NOT_ALLOWED I
public static final field MOVED_PERMANENTLY I
public static final field NOT_FOUND I
public static final field OK I
public static final field PERMANENT_REDIRECT I
public static final field REQUEST_TIMEOUT I
public static final field SEE_OTHER I
public static final field SERVICE_UNAVAILABLE I
public static final field TEMPORARY_REDIRECT I
public static final field TOO_MANY_REQUESTS I
public static final field UNAUTHORIZED I
public final fun clientErrors ()Ljava/util/List;
public final fun serverErrors ()Ljava/util/List;
}

public abstract interface class com/datadog/android/core/internal/persistence/Deserializer {
public abstract fun deserialize (Ljava/lang/Object;)Ljava/lang/Object;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,17 @@ interface InternalLogger {
val UNBOUND: InternalLogger = SdkInternalLogger(null)
}
}

/**
* Convenience extension function to log a message directly to the user via Logcat.
* This is equivalent to calling [InternalLogger.log] with [InternalLogger.Target.USER].
*
* @param level the severity level of the log.
* @param onlyOnce whether only one instance of the message should be sent per lifetime of the logger.
* @param messageBuilder the lambda building the log message.
*/
fun InternalLogger.logToUser(
level: InternalLogger.Level,
onlyOnce: Boolean = false,
messageBuilder: () -> String
) = log(level, InternalLogger.Target.USER, messageBuilder, onlyOnce = onlyOnce)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2016-Present Datadog, Inc.
*/
package com.datadog.android.api.instrumentation.network

/**
* Represents the body of an HTTP request.
* This marker interface is used to identify request body implementations
* for network instrumentation purposes.
*/
interface HttpRequestBody
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2016-Present Datadog, Inc.
*/

package com.datadog.android.api.instrumentation.network

import com.datadog.android.lint.InternalApi

/**
* For internal usage only.
*
* A builder interface for modifying [com.datadog.android.api.instrumentation.network.HttpRequestInfo] instances.
* This interface allows to build new [com.datadog.android.api.instrumentation.network.HttpRequestInfo] with
* modified HTTP request properties such as URL, headers, and tags.
*
* Use [com.datadog.android.api.instrumentation.network.MutableHttpRequestInfo.newBuilder] to obtain a builder instance.
*/
@InternalApi
interface HttpRequestInfoBuilder {

/**
* Sets the URL for this request.
* @param url the new URL to set.
* @return this modifier for chaining.
*/
fun setUrl(url: String): HttpRequestInfoBuilder

/**
* Adds a header with the specified key and values.
* If a header with the same key already exists, the new values are appended.
* @param key the header name.
* @param values the header values.
* @return this modifier for chaining.
*/
fun addHeader(key: String, vararg values: String): HttpRequestInfoBuilder

/**
* Removes a header with the specified key.
* @param key the header name to remove.
* @return this modifier for chaining.
*/
fun removeHeader(key: String): HttpRequestInfoBuilder

/**
* Replaces a header with the specified key and value.
* This is equivalent to removing the existing header and adding a new one.
* @param key the header name.
* @param value the new header value.
* @return this modifier for chaining.
*/
fun replaceHeader(key: String, value: String): HttpRequestInfoBuilder = apply {
removeHeader(key)
addHeader(key, value)
}

/**
* Adds a tag of the specified type to this request.
* Tags can be used to attach arbitrary metadata to requests for later retrieval.
* @param T the type of the tag.
* @param type the class representing the tag type.
* @param tag the tag value, or null to remove the tag.
* @return this modifier for chaining.
*/
fun <T> addTag(type: Class<in T>, tag: T?): HttpRequestInfoBuilder

/**
* Sets the HTTP method for this request.
* @param method the HTTP method to set (e.g., "GET", "POST").
* @param body the optional request body, typically used with POST, PUT, or PATCH methods.
* @return this modifier for chaining.
*/
fun setMethod(method: String, body: HttpRequestBody? = null): HttpRequestInfoBuilder

/**
* Builds and returns the modified [com.datadog.android.api.instrumentation.network.HttpRequestInfo].
* @return the resulting [com.datadog.android.api.instrumentation.network.HttpRequestInfo] with all modifications applied.
*/
fun build(): HttpRequestInfo
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2016-Present Datadog, Inc.
*/

package com.datadog.android.api.instrumentation.network

import com.datadog.android.lint.InternalApi

/**
* For internal usage only.
*
* Represents an HTTP request info that can be modified.
*
* This interface allows instrumentation components to create a modified copy
* of the request info (e.g., to add tracing headers) while preserving the
* original request data.
*/
@InternalApi
interface MutableHttpRequestInfo {
/**
* Creates a modifier to modify this request info.
* @return a new [com.datadog.android.api.instrumentation.network.HttpRequestInfoBuilder]
* initialized with this request's data.
*/
fun newBuilder(): HttpRequestInfoBuilder
}
Loading
Loading