{"id":18767793,"url":"https://github.com/lightstep/lightstep-tracer-android","last_synced_at":"2025-04-13T06:32:34.178Z","repository":{"id":22170465,"uuid":"95490843","full_name":"lightstep/lightstep-tracer-android","owner":"lightstep","description":"The Lightstep distributed tracing library for Android.","archived":false,"fork":false,"pushed_at":"2023-09-15T21:05:45.000Z","size":40895,"stargazers_count":8,"open_issues_count":6,"forks_count":1,"subscribers_count":65,"default_branch":"master","last_synced_at":"2025-03-26T23:21:56.052Z","etag":null,"topics":["opentracing"],"latest_commit_sha":null,"homepage":"https://lightstep.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lightstep.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-26T21:25:51.000Z","updated_at":"2023-08-06T20:11:35.000Z","dependencies_parsed_at":"2022-07-25T09:02:07.669Z","dependency_job_id":null,"html_url":"https://github.com/lightstep/lightstep-tracer-android","commit_stats":null,"previous_names":[],"tags_count":104,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightstep%2Flightstep-tracer-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightstep%2Flightstep-tracer-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightstep%2Flightstep-tracer-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightstep%2Flightstep-tracer-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lightstep","download_url":"https://codeload.github.com/lightstep/lightstep-tracer-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248674678,"owners_count":21143760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["opentracing"],"created_at":"2024-11-07T19:08:35.998Z","updated_at":"2025-04-13T06:32:29.147Z","avatar_url":"https://github.com/lightstep.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lightstep-tracer-android\n\n[ ![Download](https://api.bintray.com/packages/lightstep/maven/lightstep-tracer-android/images/download.svg) ](https://bintray.com/lightstep/maven/) [![Circle CI](https://circleci.com/gh/lightstep/lightstep-tracer-android.svg?style=shield)](https://circleci.com/gh/lightstep/lightstep-tracer-android) [![MIT license](http://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)\n\nThe LightStep distributed tracing library for Android.\n\n* [Getting Started](#getting-started)\n  * [Android](#getting-started-android)\n* [API documentation](#apidocs)\n* [Options](#options)\n\n\u003ca name=\"#getting-started\"\u003e\u003c/a\u003e\n\u003ca name=\"#getting-started-android\"\u003e\u003c/a\u003e\n\n## Getting started: Android\n\nThe Android library is hosted on Bintray, jcenter, and Maven Central. The Bintray [lightstep-tracer-android](https://bintray.com/lightstep/maven/lightstep-tracer-android/view) project contains additional installation and setup information for using the library with various build systems such as Ivy and Maven.\n\n### Gradle\n\nIn most cases, modifying your `build.gradle` with the below is all that is required:\n\n```\nrepositories {\n    jcenter() // OR mavenCentral()\n}\ndependencies {\n    compile 'com.lightstep.tracer:lightstep-tracer-android:VERSION'\n}\n```\n\n* If using the `grpc` transport, use the **0.3x.x** version family.\n* If using the `okhttp` transport, use the **0.2x.x** version family. **This is the recommended deployment**.\n\nSee more in the [Maven](#maven) section and Gradle sections.\n\n### Update your AndroidManifest.xml\n\nEnsure the app's `AndroidManifest.xml` has the following (under the `\u003cmanifest\u003e` tag):\n\n```xml\n\u003c!-- Permissions required to make http calls --\u003e\n\u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\n\u003cuses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /\u003e\n```\n\n### Initializing the LightStep Tracer\n\n\n```java\n// Import the OpenTracing interfaces\nimport io.opentracing.Span;\nimport io.opentracing.Tracer;\n\n// ...\n\nprotected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n\n    // Initialize LightStep tracer implementation in the main activity\n    // (or anywhere with a valid android.content.Context).\n    this.tracer = new com.lightstep.tracer.android.Tracer(\n         this,\n         new com.lightstep.tracer.shared.Options.OptionsBuilder()\n            .withAccessToken(\"{your_access_token}\")\n            .build()\n    );\n\n    // Start and finish a Span\n    Span span = this.tracer.buildSpan(\"my_span\").start();\n    this.doSomeWorkHere();\n    span.finish();\n```\n\n\u003ca name=\"apidocs\"\u003e\u003c/a\u003e\n## API Documentation\n\nTracing instrumentation should use the OpenTracing APIs to stay portable and in sync with the standard:\n\n* [OpenTracing API (javadoc)](http://javadoc.io/doc/io.opentracing/opentracing-api)\n\n\nFor reference, the generated LightStep documentation is also available:\n\n* [lightstep-tracer-android (javadoc)](http://javadoc.io/doc/com.lightstep.tracer/lightstep-tracer-android)\n\n## Options\n\n### Setting a custom component name\n\nTo set the name used in the LightStep UI for this instance of the Tracer, call `withComponentName()` on the `OptionsBuilder` object:\n\n```java\noptions = new com.lightstep.tracer.shared.Options.OptionsBuilder()\n                      .withAccessToken(\"{your_access_token}\")\n                      .withComponentName(\"your_custom_name\")\n                      .build();\n\n```\n\n### Disabling the reporting loop\n\nBy default, the Java library does a report of any buffered data on a fairly regular interval. To disable this behavior and rely only on explicit calls to `flush()` to report data, initialize with:\n\n```java\noptions = new com.lightstep.tracer.shared.Options.OptionsBuilder()\n                      .withAccessToken(\"{your_access_token}\")\n                      .withDisableReportingLoop(true)\n                      .build();\n```\n\nTo then manually flush by using the LightStep tracer object directly:\n\n```java\n// Flush any buffered tracing data\n((com.lightstep.tracer.android.Tracer)tracer).flush();\n```\n\n### Flushing the report at exit\n\nIn order to send a final flush of the data prior to exit, clients should manually flush by using the LightStep tracer object as described above.\n\n### Disabling default clock correction\n\nBy default, the Java library performs clock correction based on timestamp information provided in the spans. To disable this behavior, initialize with: \n\n```java\noptions = new com.lightstep.tracer.shared.Options.OptionsBuilder()\n                      .withAccessToken(\"{your_access_token}\")\n                      .withClockSkewCorrection(false)\n                      .build();\n```\n\n### Advanced Option: Transport and Serialization Protocols\n\nBy following the above configuration, the tracer will send information to LightStep using HTTP and Protocol Buffers which is the recommended configuration. If there are no specific transport protocol needs you have, there is no need to change this default.\n\nThere are two options for transport protocols:\n\n- [Protocol Buffers](https://developers.google.com/protocol-buffers/) over HTTP using [OkHttp 3](http://square.github.io/okhttp/) - The recommended and default solution. Supported in the 0.25.x version family, as OkHttp 3 runs under the supported Android versions.\n- [Protocol Buffers](https://developers.google.com/protocol-buffers/) over [GRPC](https://grpc.io/) - This is a more advanced solution that might be desirable if you already have gRPC networking configured. Use the 0.30.x version family.\n\nYou can configure the tracer to support gRPC by replacing `com.lightstep.tracer:tracer-okhttp` with `com.lightstep.tracer:tracer-grpc` when including the tracer dependency and including a grpc dependency. i.e.\n\n#### Maven\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.lightstep.tracer\u003c/groupId\u003e\n  \u003cartifactId\u003elightstep-tracer-android\u003c/artifactId\u003e\n  \u003cversion\u003e VERSION \u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003c!-- Additional dependency if using the grpc/0.3x.x family --\u003e\n\u003cdependency\u003e\n   \u003cgroupId\u003ecom.lightstep.tracer\u003c/groupId\u003e\n   \u003cartifactId\u003etracer-grpc\u003c/artifactId\u003e\n   \u003cversion\u003e VERSION \u003c/version\u003e\n\u003c/dependency\u003e\n\n```\n\n#### Gradle\n\n```\nrepositories {\n    mavenCentral() // OR jcenter()\n}\ndependencies {\n    compile 'com.lightstep.tracer:lightstep-tracer-android:VERSION'\n\n    // Additional dependency if using the grpc/0.3x.x family\n    compile 'com.lightstep.tracer:tracer-grpc:VERSION'\n}\n```\n\n## Development info\n\nSee [DEV.md](DEV.md) for information on contributing to this instrumentation library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightstep%2Flightstep-tracer-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightstep%2Flightstep-tracer-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightstep%2Flightstep-tracer-android/lists"}