{"id":19749493,"url":"https://github.com/mskcc/smile-commons","last_synced_at":"2025-12-11T20:03:16.756Z","repository":{"id":39852148,"uuid":"320041228","full_name":"mskcc/smile-commons","owner":"mskcc","description":"Centralized configurations for checkstyle plugin and dependency management. ","archived":false,"fork":false,"pushed_at":"2024-03-12T21:10:23.000Z","size":192,"stargazers_count":1,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-21T15:38:08.656Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mskcc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-12-09T18:13:38.000Z","updated_at":"2022-07-08T19:29:28.000Z","dependencies_parsed_at":"2024-06-21T14:18:26.037Z","dependency_job_id":"e5841318-f194-4606-a3a0-c712ac7ca1bd","html_url":"https://github.com/mskcc/smile-commons","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mskcc%2Fsmile-commons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mskcc%2Fsmile-commons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mskcc%2Fsmile-commons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mskcc%2Fsmile-commons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mskcc","download_url":"https://codeload.github.com/mskcc/smile-commons/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224204819,"owners_count":17273190,"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":[],"created_at":"2024-11-12T02:26:45.616Z","updated_at":"2025-12-11T20:03:16.716Z","avatar_url":"https://github.com/mskcc.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SMILE Commons\n\nCentralized configurations for checkstyle plugin and dependency management.\n\n## OpenTelemetryUtils\n\nThis common library contains utilities to supoprt [Distributed Tracing](https://lightstep.com/opentelemetry/tracing) - [Context Propagation](https://lightstep.com/opentelemetry/context-propagation) via OpenTelemetry.\n\n### Basic Usage for application\n\n```java\n// required imports\nimport org.mskcc.smile.commons.OpenTelemetryUtils;\nimport org.mskcc.smile.commons.OpenTelemetryUtils.TraceMetadata;\n\n// inject\n@Autowired\nOpenTelemetryUtils openTelemetryUtils;\n\n// OpenTelemetry Tracer\nprivate static final Tracer tracer = GlobalOpenTelemetry.get().getTracer(\"org.mskcc.cmo.Classname\");\n\n// Upstream service propagating context to downstream service via a Nats Message\nSpan testJetstreamPubSpan = tracer.spanBuilder(\"testJetStreamPubSpan\").startSpan();\nScope scope = testJetstreamPubSpan.makeCurrent();\nSpan.current().addEvent(\"testJetstreamPubEvent: publishing to jetstream topic\" + JETSTREAM_PUBLISH_TOPIC);\nTraceMetadata tmd = openTelemetryUtils.getTraceMetadata();\nmessagingGateway.publishWithTrace(JETSTREAM_PUBLISH_TOPIC, \"\u003cthis is test message body\u003e\", tmd);\ntestJetstreamPubSpan.end();\n\n// Downstream service receiving context via onMessage subscription and continuing tracing using the same span\n@Override\npublic void onMessage(Message msg, Object message)\n{\n    try {\n        // In production code, the following statement should check if TraceMetadata exists before usin it.\n        String traceId = msg.getHeaders().get(TraceMetadata.getHeaderKey()).get(0);\n        TraceMetadata tmd = new TraceMetadata(traceId);\n        Span testJetstreamSubOnMessageSpan = openTelemetryUtils.getSpan(tmd, \"testJetStreamSubOnMessageSpan\");\n\n        Scope scope = testJetstreamSubOnMessageSpan.makeCurrent();\n        String receivedMessageContent = new String(msg.getData(), StandardCharsets.UTF_8);\n        Attributes eventAttributes = Attributes.of(AttributeKey.stringKey(\"receivedMessageSubject\"), msg.getSubject(),\n                                                   AttributeKey.stringKey(\"receivedMessageBody\"), receivedMessageContent);\n        Span.current().addEvent(\"testJetstreamSubOnMessageEvent: messageReceived\", eventAttributes);\n        testJetstreamSubOnMessageSpan.end();\n    }\n    catch (Exception e) {\n        System.out.println(\"Exception: \" + e.getMessage());\n    }\n}\n```\n## Updating Java Code Generated from Protobuf Files\n\nJava classes inside `./src/main/java/org/mskcc/smile/commons/generated/` are manually generated.\n\nTo update existing or create new classes, follow these steps:\n- Obtain or construct the `.proto` file\n- Ensure that the correct `protoc` version is installed (see more in notes below)\n- Run `$ protoc [path to .proto file] --java_out=[directory to write the Java generated code to]`\n- Ensure the newly generated Java classes are saved at `./src/main/java/org/mskcc/smile/commons/generated/`\n- Update `pom.xml` if there are changes to the Protobuf Java version\n\n### Version of `protoc` to Use\nPer the [Protobuf docs](https://protobuf.dev/support/version-support/#java):\n\u003e The protoc version can be inferred from the Protobuf Java minor version number. Example: Protobuf Java version 3.**25**.x uses protoc version **25**.x.\".\n\nBased on this, follow these steps to determine the correct `protoc` version to use:\n- Note the Java version of the Java application needing the Protobuf Java classes (e.g. Java 21)\n- Find the Protobuf Java version that is compatible with the Java application (e.g. Protobuf Java 4.29.3 supports Java 21)\n- Determine the protoc version needed from the Protobuf Java minor version number (e.g. Protobuf Java 4.**29**.3 uses protoc **29**.x)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmskcc%2Fsmile-commons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmskcc%2Fsmile-commons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmskcc%2Fsmile-commons/lists"}