{"id":15137828,"url":"https://github.com/newrelic/newrelic-telemetry-sdk-java","last_synced_at":"2025-05-16T13:06:00.369Z","repository":{"id":39090520,"uuid":"201301880","full_name":"newrelic/newrelic-telemetry-sdk-java","owner":"newrelic","description":"Java library for sending telemetry data to New Relic","archived":false,"fork":false,"pushed_at":"2024-10-22T00:01:40.000Z","size":1273,"stargazers_count":44,"open_issues_count":8,"forks_count":36,"subscribers_count":26,"default_branch":"main","last_synced_at":"2025-05-15T16:07:15.904Z","etag":null,"topics":["java","monitoring","newrelic","open-source","open-telemetry","open-telemetry-java","telemetry","telemetry-java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/newrelic.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-08T17:00:57.000Z","updated_at":"2024-12-31T07:26:47.000Z","dependencies_parsed_at":"2022-07-12T19:30:31.033Z","dependency_job_id":"614f1cab-aeb5-464c-b285-c614d428f546","html_url":"https://github.com/newrelic/newrelic-telemetry-sdk-java","commit_stats":{"total_commits":606,"total_committers":39,"mean_commits":"15.538461538461538","dds":0.6749174917491749,"last_synced_commit":"c72d6ebc0e756efeb4bb59c34e6a22a5173c4998"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic%2Fnewrelic-telemetry-sdk-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic%2Fnewrelic-telemetry-sdk-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic%2Fnewrelic-telemetry-sdk-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic%2Fnewrelic-telemetry-sdk-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/newrelic","download_url":"https://codeload.github.com/newrelic/newrelic-telemetry-sdk-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254535827,"owners_count":22087399,"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":["java","monitoring","newrelic","open-source","open-telemetry","open-telemetry-java","telemetry","telemetry-java"],"created_at":"2024-09-26T07:02:29.053Z","updated_at":"2025-05-16T13:06:00.350Z","avatar_url":"https://github.com/newrelic.png","language":"Java","readme":"\u003ca href=\"https://opensource.newrelic.com/oss-category/#community-project\"\u003e\u003cpicture\u003e\u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/newrelic/opensource-website/raw/main/src/images/categories/dark/Community_Project.png\"\u003e\u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Project.png\"\u003e\u003cimg alt=\"New Relic Open Source community project banner.\" src=\"https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Project.png\"\u003e\u003c/picture\u003e\u003c/a\u003e\n\n# New Relic Java Telemetry SDK \nThe New Relic Java Telemetry SDK is an easy way to send data to New Relic.\nThe SDK currently supports sending the MELT telemetry data types \n(Metrics, Events, Logs, and Traces) \nvia the following APIs:\n\n* [Metric API](https://docs.newrelic.com/docs/data-ingest-apis/get-data-new-relic/metric-api/report-metrics-metric-api) - for dimensional metrics \n* [Trace API](https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/trace-api/introduction-trace-api) - for building up traces with spans\n* [Events API](https://docs.newrelic.com/docs/insights/insights-data-sources/custom-data/introduction-event-api) - for custom events\n* [Log API](https://docs.newrelic.com/docs/logs/new-relic-logs/log-api/introduction-log-api) - for log data\n\nWhy is this cool?\n\nSend data to New Relic! No agent required. \n\nOur [Telemetry SDK](https://docs.newrelic.com/docs/data-ingest-apis/get-data-new-relic/new-relic-sdks/telemetry-sdks-send-custom-telemetry-data-new-relic) tries to be helpful, so your job of sending telemetry data to New Relic can be done in the right way, easily. We've covered all of the basics for you so you can focus on writing feature code directly related to your business need or interest.\n\nWhy would you want to use the telemetry SDK?\n\nWe imagine you (or your customers) are interested in the telemetry data, generated by your tool, framework, or code, in New Relic. You can write an exporter to do so! Check out the [telemetry_examples](telemetry_examples) module to get started.\n\nFor the most recently published version, see [Releases](https://github.com/newrelic/newrelic-telemetry-sdk-java/releases)\n\n## Installation\n\nIn order to send metrics or spans to New Relic, you will need a New Relic [license key](https://docs.newrelic.com/docs/apis/getting-started/intro-apis/understand-new-relic-api-keys#ingest-license-key) for the account to which you want to send data. \n\nMaven dependencies:\n\n```\n    \u003cdependency\u003e\n      \u003cgroupId\u003ecom.newrelic.telemetry\u003c/groupId\u003e\n      \u003cartifactId\u003etelemetry-core\u003c/artifactId\u003e\n      \u003cversion\u003e0.16.0\u003c/version\u003e\n    \u003c/dependency\u003e\n    \u003cdependency\u003e\n      \u003cgroupId\u003ecom.newrelic.telemetry\u003c/groupId\u003e\n      \u003cartifactId\u003etelemetry-http-okhttp\u003c/artifactId\u003e\n      \u003cversion\u003e0.16.0\u003c/version\u003e\n    \u003c/dependency\u003e\n```\n\nGradle dependencies: \n\n```\nimplementation(\"com.newrelic.telemetry:telemetry-core:0.16.0\")\nimplementation(\"com.newrelic.telemetry:telemetry-http-okhttp:0.16.0\")\n```\n\nTake a look at the example code in the [telemetry_examples](telemetry_examples) module. \nWe recommend looking at the [TelemetryClientExample](telemetry_examples/src/main/java/com/newrelic/telemetry/examples/TelemetryClientExample.java)\nfirst.\n\nNote: If you do not want to include `okhttp` as a transitive dependency, you will need to provide a custom implementation of the\n`com.newrelic.telemetry.http.HttpPoster` interface, rather than using the `com.newrelic.telemetry:telemetry-http-okhttp` library.\n\n## Usage\n\n### Logging\nThe Telemetry SDK uses slf4j for all logging. Having a slf4j implementation in your application is required in order to see log information.\nSee [the slf4j documentation](http://www.slf4j.org/manual.html#swapping) for details.\n\n#### Enabling audit logging\nThe various builders for the Telemetry SDK components include an option to `enableAuditLogging`. Enabling this option will cause the\nSDK to product additional logging at `DEBUG` level. This logging includes the details of every payload sent to the New Relic APIs, and the responses from those APIs.\n\n*WARNING*: If you enable audit logging, all the data in your spans and metrics will be sent to your logging system. It is recommended that you only enable\naudit logging when absolutely necessary.\n\n#### Use license key\nThe various builders for the Telemetry SDK components include an option to `useLicenseKey`. Enabling this option will cause the SDK to inform the API endpoints the key you provided is a New Relic [license key](https://docs.newrelic.com/docs/apis/getting-started/intro-apis/understand-new-relic-api-keys#ingest-license-key).\n\n### For developers: \n#### Requirements\n\n* Java 11 or greater\n* For IDEA:\n* Docker \u0026 docker-compose must be installed for integration testing\n\n### Find and use your data\n\nTips on how to find and query your data in New Relic:\n- [Find metric data](https://docs.newrelic.com/docs/data-ingest-apis/get-data-new-relic/metric-api/introduction-metric-api#find-data)\n- [Find trace/span data](https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/trace-api/introduction-trace-api#view-data)\n\nFor general querying information, see:\n- [Query New Relic data](https://docs.newrelic.com/docs/using-new-relic/data/understand-data/query-new-relic-data)\n- [Intro to NRQL](https://docs.newrelic.com/docs/query-data/nrql-new-relic-query-language/getting-started/introduction-nrql)\n\n## Building\nCI builds are run on Github Actions: \n![build badge](https://github.com/newrelic/newrelic-telemetry-sdk-java/workflows/main%20build/badge.svg)\n\nThe project uses Java 11 and gradle 6 for building, and the gradle wrapper is provided.\n\nTo compile, run the tests and build the jars:\n\n`$ ./gradlew build`\n\n## Testing\n\nEnd-to-end integration tests are included. \nThey are implemented with the testcontainers library; [mock-server](https://github.com/jamesdbloom/mockserver) provides the backend.\n\nThere are two modes to run the integration tests.\n* Run with gradle: `$ ./gradlew integration_test:test`\n* Run the integration test classes in IDEA directly. It should \"just work\".\n\n## Code style\nThis project uses the [google-java-format](https://github.com/google/google-java-format) code style, and it is \neasily applied via an included [gradle plugin](https://github.com/sherter/google-java-format-gradle-plugin):\n\n`$ ./gradlew googleJavaFormat verifyGoogleJavaFormat`\n\nPlease be sure to run the formatter before committing any changes. There is a `pre-commit-hook.sh` which can \nbe applied automatically before commits by moving it into `.git/hooks/pre-commit`.\n\n### Module structure:\n\n#### `telemetry_core`\nThis is the core module for sending dimensional metrics and spans to New Relic. It contains low level APIs as well as\n higher level \"best practice\" implementations that compose interactions with the lower level modules. The library is \n published under maven coordinates:\n\n`com.newrelic.telemetry:telemetry-core`\n\nIn order to send metrics and spans to New Relic, you will also need a New Relic [license key](https://docs.newrelic.com/docs/apis/getting-started/intro-apis/understand-new-relic-api-keys#ingest-license-key) for the account to which you want to send data. \n\n#### `telemetry-http-java11`\nThis is an implementation of the required http client interface using Java 11 JDK classes as the underlying library.\nThe `telemetry-http-java11` library is published under the maven coordinates:\n\n`com.newrelic.telemetry:telemetry-http-java11`\n\n#### `telemetry-http-okhttp`\nThis is an implementation of the required http client interface using okhttp as the underlying library.\nThe `telemetry-http-okhttp` library is published under the maven coordinates:\n\n`com.newrelic.telemetry:telemetry-http-okhttp`\n\n#### `telemetry_examples`\nExample code for using the metrics and telemetry APIs.\n\n#### `integration_test`\nIntegration test module. Uses docker-compose based tests to test the SDK end-to-end.\n\n### Retries\n\nAs [described here](https://github.com/newrelic/newrelic-telemetry-sdk-specs/blob/master/communication.md#graceful-degradation),\nthe `TelemetryClient` makes use of a default backoff strategy when it encounters data ingest errors.\nSpecifically, this strategy tries again after 1 second, then doubles the wait after each attempt\nuntil a max wait of 15 seconds is reached.  After 10 failed attempts, data is dropped and a message\nis logged. \n\nThe backoff strategy is not currently pluggable.  Please file an issue or submit a pull request \nif you need greater control over this behavior.\n\n## Support\n\nNew Relic hosts and moderates an online forum where customers can interact with New Relic employees as well as other customers to get help and share best practices. Like all official New Relic open source projects, there's a related Community topic in the New Relic Explorers Hub: [Java Agent Forum Topics](https://forum.newrelic.com/s/hubtopic/Topic__c/Default?c__categories=%5B%7B%22icon%22%3A%22standard%3Adefault%22%2C%22id%22%3A%22a6c8W000000EesiQAC%22%2C%22sObjectType%22%3A%22Category__c%22%2C%22title%22%3A%22Java%20Agent%22%2C%22titleFormatted%22%3A%22Java%20Agent%22%7D%5D).\n\n## Contribute\n\nWe encourage your contributions to improve New Relic Java Telemetry SDK! Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.\n\nIf you have any questions, or to execute our corporate CLA (which is required if your contribution is on behalf of a company), drop us an email at opensource@newrelic.com.\n\n**A note about vulnerabilities**\n\nAs noted in our [security policy](../../security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.\n\nIf you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through [HackerOne](https://hackerone.com/newrelic).\n\nIf you would like to contribute to this project, review [these guidelines](./CONTRIBUTING.md).\n\nTo [all contributors](https://github.com/newrelic/newrelic-telemetry-sdk-java/graphs/contributors), we thank you!  Without your contribution, this project would not be what it is today.  We also host a community project page dedicated to [New Relic Telemetry SDK (Java)](https://opensource.newrelic.com/projects/newrelic/newrelic-telemetry-sdk-java).\n \n[javadoc-image]: https://www.javadoc.io/badge/com.newrelic.telemetry/telemetry.svg\n[javadoc-url]: https://www.javadoc.io/doc/com.newrelic.telemetry/telemetry\n\n### Limitations\nThe New Relic Telemetry APIs are rate limited. Please reference the documentation for [New Relic Metric API](https://docs.newrelic.com/docs/introduction-new-relic-metric-api) and [New Relic Trace API requirements and limits](https://docs.newrelic.com/docs/apm/distributed-tracing/trace-api/trace-api-general-requirements-limits) on the specifics of the rate limits.\n\n## License\nThe New Relic Java Telemetry SDK is licensed under the Apache 2.0 License.\n\nThe New Relic Java Telemetry SDK also uses source code from third party libraries. \nFull details on which libraries are used and the terms under which they are licensed can be found in the \nthird party notices document.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewrelic%2Fnewrelic-telemetry-sdk-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnewrelic%2Fnewrelic-telemetry-sdk-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewrelic%2Fnewrelic-telemetry-sdk-java/lists"}