Swiftpack.co - Package - DataDog/dd-sdk-ios
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

Datadog SDK for iOS

Swift and Objective-C libraries to interact with Datadog on iOS.

Getting Started

Log Collection

See the dedicated Datadog iOS Log Collection documentation to learn how to send logs from your iOS application to Datadog.

Datadog iOS Log Collection

Trace Collection

See Datadog iOS Trace Collection documentation to try it out.

Datadog iOS Log Collection

Integrations

Alamofire

If you use Alamofire, review the DatadogAlamofireExtension library to learn how to automatically instrument requests with Datadog SDK.

Contributing

Pull requests are welcome. First, open an issue to discuss what you would like to change. For more information, read the Contributing Guide.

License

Apache License, v2.0

Github

link
Stars: 25

Dependencies

Releases

1.4.1 - 2021-01-19T08:05:55

Bug Fixes

  • Fixed app extension compilation issue for UIApplication.shared symbol (#374), solves #370 (thanks @SimpleApp).

1.5.0-alpha2 - 2021-01-18T10:15:04

IMPORTANT! This is an alpha version: public API is likely to change in the next versions

1.5.0-alpha1 - 2021-01-08T14:21:30

IMPORTANT! This is an alpha version: public API is likely to change in the next versions

1.4.0 - 2020-12-15T20:31:58

This release brings the Real User Monitoring for iOS apps.

Features

  • Added RUM monitoring feature: manual and auto instrumentation for tracking user sessions, interactions, visited UIViewControllers, network resources and errors.
  • Added support for GovCloud endpoints (#235).
  • Added single .set(endpoint:) API to configure all features at once (#322).
  • Added span.setActive() API for indirect referencing Spans (#187).
  • Added Global.sharedTracer.startRootSpan(...) API (#236).
  • Added support for extra user attributes in Datadog.setUserInfo(...) (#315).
  • Added option for logging custom Swift Errors with Logger (#303), solves #276 (thanks @sdejesusF)

Bug Fixes

  • Fixed compilation issue for Mac Catalyst (#277), solves #274 (thanks @Hengyu).
  • Fixed crash with serviceName containing space characters (#317), solves #316 (thanks @philtre).
  • Fixed issue with data being not uploaded when battery status was undefined (#320).

Improvements

  • Tracing auto instrumentation now supports URLSessionTasks created with no completion handler (#262).
  • Extended the allowed characters set for the environment setting (#246).
  • Improved data upload performance (#249).

More in iOS RUM Collection.

1.4.0-beta1 - 2020-10-15T12:55:39

This beta release brings the Real User Monitoring for iOS apps.

Features

  • Added RUM monitoring feature: manual and auto instrumentation for tracking user sessions, interactions, visited UIViewControllers, network resources and errors.
  • Added support for GovCloud endpoints (#235).
  • Added span.setActive() API for indirect referencing Spans (#187).
  • Added Global.sharedTracer.startRootSpan(...) API (#236).

Bug Fixes

  • Fixed compilation issue for Mac Catalyst (#277), solves #274 (thanks @Hengyu).

Improvements

  • Tracing auto instrumentation now supports URLSessionTasks created with no completion handler (#262).
  • Extended the allowed characters set for the environment setting (#246).
  • Improved data upload performance (#249).

More in iOS RUM Collection guide.

1.3.1 - 2020-08-14T11:12:08

Bug fixes

1.3.0 - 2020-08-03T13:12:31

This release brings Distributed Tracing for iOS 🚀.

Features

  • By using a new Tracer API, it is now possible to send traces to Datadog.
// register the Tracer:
Global.sharedTracer = Tracer.initialize(configuration: configuration)

// start the Span:
let span = Global.sharedTracer.startSpan(operationName: "something I measure")

// finish it when the measured operation is done:
span.finish()
  • If you use Datadog instrumentation on the backend, the trace can be propagated across the hosts.

Read more in iOS Trace Collection guide.

1.2.4 - 2020-07-17T12:47:53

Bug Fixes

  • Fixed out-of-memory crash when doing extremely intensive logging (#185), solves #178 (@hyling 🍻)

1.2.3 - 2020-07-15T12:39:41

Bug Fixes

  • Fixed memory leak in logs upload (#180), solves #178 (thanks @hyling)
  • Fixed App Store Connect validation issues for Objective-C SDK (#182), solves #177 (thanks again, @hyling 🚀)

1.3.0-beta3 - 2020-07-08T17:15:55

Features

• Auto-Instrumentation for Tracing 🤖 • Tracing for Objective-C 🧓


How to use auto-instrumentation: Step 1: Set Datadog.Configuration.tracedHosts to your domains Step 2: Set tracingEnabled Step 3: Set Global.sharedTracer to a Datadog.Tracer instance 🚀 Your network requests are automatically traced now!

IMPORTANT! Auto-tracing is disabled by default If auto-tracing is NOT enabled swizzling does not happen Enabling auto-tracing by following the steps above results in swizzling URLSession.dataTaskWithURL:completion: and URLSession.dataTaskWithRequest:completion: methods. You can look at how we swizzle methods here and/or what the new implementations of those methods are here and here.

1.3.0-beta2 - 2020-06-24T16:21:06

This beta brings more to Distributed Tracing for iOS apps 🚀.

Features

  • The span.setBaggageItem(key:value:) is now available (#144). This enables attributes propagation from parent span to its children.

Bug Fixes

  • Fixed a set of NSFileHandle crashes on iOS 13.0 - 13.3 in -beta1 (#152) caused by Apple bug.

Upgrade From 1.3.0-beta1

  • Starting from -beta2, we embed the Open Tracing interfaces in Datadog module (#154). DDTracer is renamed to Tracer:
import Datadog

Global.sharedTracer = Tracer.initialize(...)
  • This (#154) also means less hassle in Podfile as now it only requires pod DatadogSDK.

More in iOS Trace Collection guide.

1.3.0-beta1 - 2020-06-19T14:07:21

Features

  • This release brings the -beta1 version of Distributed Tracing for iOS apps ⭐. From now, you'll be able to send traces to Datadog and let us visualise the timings of your code execution. If you're using Datadog instrumentation on backend, this also includes full-stack trace propagation.

Instantiate DDTracer:

import Datadog
import OpenTracing

Global.sharedTracer = DDTracer.initialize(
    configuration: DDTracer.Configuration(
        sendNetworkInfo: true
    )
)

and start instrumenting your code:

let span = Global.sharedTracer.startSpan(operationName: "something I measure")
// do something you want to measure ...
// ... then, when the operation is finished:
span.finish()

Read more in iOS Trace Collection guide.

Improvements

  • typealias DDLogger = Datadog.Logger is introduced, to help avoiding compiler ambiguity in projects defining their own Logger class (#143), solves #127 and #142 (thanks @krzysztofzablocki , @amyslies)

1.2.2 - 2020-06-12T14:14:19

Bug Fixes

  • Fixes the problem with logs being occasionally malformed when seen at app.datadoghq.com (#133)

1.2.1 - 2020-06-09T08:26:13

Bug Fixes

  • Fixed ISO8601DateFormatter crash on iOS 11.0 and iOS 11.1 - the milliseconds precision won't be available on iOS 11.0 and iOS 11.1 till next regular release (#129), solves #126 (thanks @lgaches, @Britton-Earnin)

1.2.0 - 2020-05-22T10:33:06

Features

  • The serviceName default value is changed to app bundle identifier + can be customized globally (#102)

Bug Fixes

  • Fixed family of NWPathMonitor crashes (#110), solves #110, #70 (thanks @LeffelMania, @00FA9A, @jegnux)

Improvements

  • Milliseconds precision for logs (#96), solves #95 (thanks @flobories)
  • Improved logs delivery for app extensions (#84), solves #52 (thanks @lmramirez)

Other Changes

  • The in-build source value was changed from mobile to ios (#111)
  • Package.swift is updated to link the SDK as dynamic framework (#82)

Upgrade Steps

Datadog.Configuration builder now requires the environment value to be passed along with clientToken:

Datadog.Configuration
    .builderUsing(clientToken: "<client-token>", environment: "<environment>")
See details

What can I use the environment for?

This will enable you to filter data from different environments (staging | production | ...) by using env: filter on app.datadoghq.com. If you don't have diversed environments, "production" might be a good default.

Eventual Breaking Changes in Dashboards and Pipelines

If any of your app.datadoghq.com dashboards or pipelines depends on service or source attribute, you may need to update them.

See details

New default value for service attribute

If you were not using .set(serviceName:) to explicitly set the service for Logger.builder the default value of "ios" was used. In 1.2.0, this default is changed to application bundle identifier. If your dashboards depend on "ios" this might break.

To make it compatible, use either the .set(serviceName:) on individual Logger.builder or set the default service name for all loggers in Datadog.Configuration.builderUsing(...).set(serviceName: "...").

New default value for source attribute

We changed the value of source attribute from mobile to ios. If any of your dashboards or pipelines depends on this, please update them accordingly.

1.1.0 - 2020-04-21T13:09:44

🐛 #80 : missing required module fix ⏲️ #65 : Syncing logs time with server

1.0.1 - 2020-04-07T09:35:01

1.0.0 - 2020-03-31T09:44:45

🚀 1.0.0 release of the logging feature.

Datadog.initialize(...)

let logger = Logger.builder.build()
logger.info("Hello from 1.0.0 👋")

1.0.0-beta3 - 2020-03-30T13:52:39

1.0.0-beta2 - 2020-03-20T13:07:14

1.0.0-beta1 - 2020-03-11T15:11:51

Datadog logging feature.

+ Datadog.podspec
+ DatadogObjc.podspec