Skip to content

Commit

Permalink
RUMM-833 Add DatadogSDKAlamofireExtension.podspec
Browse files Browse the repository at this point in the history
  • Loading branch information
ncreated committed Dec 17, 2020
1 parent 13e11da commit 8c22098
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
24 changes: 24 additions & 0 deletions DatadogSDKAlamofireExtension.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Pod::Spec.new do |s|
s.name = "DatadogSDKAlamofireExtension"
s.module_name = "DatadogAlamofireExtension"
s.version = "1.0.0"
s.summary = "An Official Extensions of Datadog Swift SDK for Alamofire."

s.homepage = "https://www.datadoghq.com"
s.social_media_url = "https://twitter.com/datadoghq"

s.license = { :type => "Apache", :file => 'LICENSE' }
s.authors = {
"Maciek Grzybowski" => "maciek.grzybowski@datadoghq.com",
"Mert Buran" => "mert.buran@datadoghq.com"
}

s.swift_version = '5.1'
s.ios.deployment_target = '11.0'

s.source = { :git => "https://github.com/DataDog/dd-sdk-ios.git", :tag => s.version.to_s }

s.source_files = ["Sources/DatadogExtensions/Alamofire/**/*.swift"]
s.dependency 'DatadogSDK', '~> 1.4'
s.dependency 'Alamofire', '~> 5.4'
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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 2019-2020 Datadog, Inc.
*/

import class Datadog.URLSessionInterceptor
import Alamofire

public class DDEventMonitor: EventMonitor {
public func request(_ request: Request, didCreateTask task: URLSessionTask) {
URLSessionInterceptor.shared?.taskCreated(task: task)
}

public func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) {
URLSessionInterceptor.shared?.taskMetricsCollected(task: task, metrics: metrics)
}

public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
URLSessionInterceptor.shared?.taskCompleted(task: task, error: error)
}
}

public class DDRequestInterceptor: RequestInterceptor {
public func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {
let instrumentedRequest = URLSessionInterceptor.shared?.modify(request: urlRequest)
completion(.success(instrumentedRequest ?? urlRequest))
}
}
1 change: 1 addition & 0 deletions dependency-manager-tests/cocoapods/Podfile.src
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ platform :ios, '12.0'
target 'CPProject' do
use_frameworks!
pod 'DatadogSDK', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :branch => 'REMOTE_GIT_BRANCH'
pod 'DatadogSDKAlamofireExtension', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :branch => 'REMOTE_GIT_BRANCH'
end

0 comments on commit 8c22098

Please sign in to comment.