Skip to content

Commit 0732910

Browse files
authored
Merge pull request #1 from ballerina-platform/initial-impl
Add Moesif trace provider implementation
2 parents 4fcc09d + 08455b1 commit 0732910

File tree

25 files changed

+2080
-2
lines changed

25 files changed

+2080
-2
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,15 @@
2222
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
2424
replay_pid*
25+
26+
# gradle
27+
.gradle
28+
build/
29+
30+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
31+
hs_err_pid*
32+
33+
.idea
34+
*.iml
35+
*.ipr
36+
*.iws

README.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,47 @@
1-
# module-ballerinax-moesif
2-
Ballerina Moesif Observability Extension Module
1+
# Ballerina Moesif Observability Extension
2+
3+
[![Build](https://github.com/ballerina-platform/module-ballerinax-moesif/workflows/Daily%20Build/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-moesif/actions?query=workflow%3A"Daily+Build")
4+
[![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/module-ballerinax-moesif.svg)](https://github.com/ballerina-platform/module-ballerinax-moesif/commits/main)
5+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6+
[![codecov](https://codecov.io/gh/ballerina-platform/module-ballerinax-moesif/branch/main/graph/badge.svg?token=5GCQ36HBEB)](https://codecov.io/gh/ballerina-platform/module-ballerinax-moesif)
7+
8+
## Building from the Source
9+
10+
### Setting Up the Prerequisites
11+
12+
1. Download and install Java SE Development Kit (JDK) version 21 (from one of the following locations).
13+
14+
* [Oracle](https://www.oracle.com/java/technologies/downloads/)
15+
16+
* [OpenJDK](https://adoptopenjdk.net/)
17+
18+
> **Note:** Set the JAVA_HOME environment variable to the path name of the directory into which you installed JDK.
19+
20+
### Building the Source
21+
22+
Execute the commands below to build from source.
23+
24+
1. To build the library:
25+
26+
./gradlew clean build
27+
28+
2. To run the integration tests:
29+
30+
./gradlew clean test
31+
32+
## Contributing to Ballerina
33+
34+
As an open source project, Ballerina welcomes contributions from the community.
35+
36+
For more information, go to the [contribution guidelines](https://github.com/ballerina-platform/ballerina-lang/blob/master/CONTRIBUTING.md).
37+
38+
## Code of Conduct
39+
40+
All contributors are encouraged to read the [Ballerina Code of Conduct](https://ballerina.io/code-of-conduct).
41+
42+
## Useful Links
43+
44+
* Discuss about code changes of the Ballerina project in [ballerina-dev@googlegroups.com](mailto:ballerina-dev@googlegroups.com).
45+
* Chat live with us via our [Discord server](https://discord.gg/ballerinalang).
46+
* Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
47+
* View the [Ballerina performance test results](https://github.com/ballerina-platform/ballerina-lang/blob/master/performance/benchmarks/summary.md).

ballerina/Ballerina.toml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Copyright (c) 2025, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
[package]
16+
org = "ballerinax"
17+
name = "moesif"
18+
version = "@toml.version@"
19+
distribution = "@ballerina.version@"
20+
21+
[platform.java21]
22+
graalvmCompatible = true
23+
24+
[[platform.java21.dependency]]
25+
path = "../native/build/libs/moesif-extension-native-@project.version@.jar"
26+
groupId = "ballerina"
27+
artifactId = "moesif-extension-native"
28+
version = "@project.version@"
29+
30+
[[platform.java21.dependency]]
31+
path = "./lib/opentelemetry-sdk-trace-@opentelemetrySDK.version@.jar"
32+
groupId = "io.opentelemetry"
33+
artifactId = "opentelemetry-sdk-trace"
34+
version = "@opentelemetrySDK.version@"
35+
36+
[[platform.java21.dependency]]
37+
path = "./lib/opentelemetry-sdk-common-@opentelemetrySDK.version@.jar"
38+
groupId = "io.opentelemetry"
39+
artifactId = "opentelemetry-sdk-common"
40+
version = "@opentelemetrySDK.version@"
41+
42+
[[platform.java21.dependency]]
43+
path = "./lib/opentelemetry-semconv-@opentelemetrySemconv.version@.jar"
44+
groupId = "io.opentelemetry.semconv"
45+
artifactId = "opentelemetry-semconv"
46+
version = "@opentelemetrySemconv.version@"
47+
48+
[[platform.java21.dependency]]
49+
path = "./lib/opentelemetry-exporter-otlp-http-trace-@opentelemetryExporter.version@.jar"
50+
groupId = "io.opentelemetry"
51+
artifactId = "opentelemetry-exporter-otlp-http-trace"
52+
version = "@opentelemetryExporter.version@"
53+
54+
[[platform.java21.dependency]]
55+
path = "./lib/opentelemetry-exporter-otlp-common-@opentelemetryExporter.version@.jar"
56+
groupId = "io.opentelemetry"
57+
artifactId = "opentelemetry-exporter-otlp-common"
58+
version = "@opentelemetryExporter.version@"
59+
60+
[[platform.java21.dependency]]
61+
path = "./lib/opentelemetry-extension-trace-propagators-@opentelemetry.version@.jar"
62+
groupId = "io.opentelemetry"
63+
artifactId = "opentelemetry-extension-trace-propagators"
64+
version = "@opentelemetry.version@"
65+
66+
[[platform.java21.dependency]]
67+
path = "./lib/okhttp-@okhttp.version@.jar"
68+
groupId = "com.squareup.okhttp3"
69+
artifactId = "okhttp"
70+
version = "@okhttp.version@"
71+
72+
[[platform.java21.dependency]]
73+
path = "./lib/kotlin-stdlib-@kotlin.version@.jar"
74+
groupId = "org.jetbrains.kotlin"
75+
artifactId = "kotlin-stdlib"
76+
version = "@kotlin.version@"
77+
78+
[[platform.java21.dependency]]
79+
path = "./lib/okio-jvm-@okio.version@.jar"
80+
groupId = "com.squareup.okio"
81+
artifactId = "okio"
82+
version = "@okio.version@"

ballerina/Dependencies.toml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# AUTO-GENERATED FILE. DO NOT MODIFY.
2+
3+
# This file is auto-generated by Ballerina for managing dependency versions.
4+
# It should not be modified by hand.
5+
6+
[ballerina]
7+
dependencies-toml-version = "2"
8+
distribution-version = "2201.12.6"
9+
10+
[[package]]
11+
org = "ballerina"
12+
name = "io"
13+
version = "1.8.0"
14+
dependencies = [
15+
{org = "ballerina", name = "jballerina.java"},
16+
{org = "ballerina", name = "lang.value"}
17+
]
18+
modules = [
19+
{org = "ballerina", packageName = "io", moduleName = "io"}
20+
]
21+
22+
[[package]]
23+
org = "ballerina"
24+
name = "jballerina.java"
25+
version = "0.0.0"
26+
modules = [
27+
{org = "ballerina", packageName = "jballerina.java", moduleName = "jballerina.java"}
28+
]
29+
30+
[[package]]
31+
org = "ballerina"
32+
name = "lang.value"
33+
version = "0.0.0"
34+
dependencies = [
35+
{org = "ballerina", name = "jballerina.java"}
36+
]
37+
38+
[[package]]
39+
org = "ballerina"
40+
name = "observe"
41+
version = "1.5.0"
42+
dependencies = [
43+
{org = "ballerina", name = "jballerina.java"}
44+
]
45+
modules = [
46+
{org = "ballerina", packageName = "observe", moduleName = "observe"},
47+
{org = "ballerina", packageName = "observe", moduleName = "observe.mockextension"}
48+
]
49+
50+
[[package]]
51+
org = "ballerinax"
52+
name = "moesif"
53+
version = "1.0.0"
54+
dependencies = [
55+
{org = "ballerina", name = "io"},
56+
{org = "ballerina", name = "jballerina.java"},
57+
{org = "ballerina", name = "observe"}
58+
]
59+
modules = [
60+
{org = "ballerinax", packageName = "moesif", moduleName = "moesif"}
61+
]
62+

ballerina/Package.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## Package Overview
2+
3+
The Moesif Observability Extension is one of the tracing extensions of the<a target="_blank" href="https://ballerina.io/"> Ballerina</a> language.
4+
5+
It provides an implementation for tracing and publishing traces to a Moesif application.
6+
7+
## Enabling Moesif Extension
8+
9+
To package the Moesif extension into the Jar, follow the below steps.
10+
11+
1. Add the following import to your program.
12+
```ballerina
13+
import ballerinax/moesif as _;
14+
```
15+
16+
2. Add the following to the `Ballerina.toml` when building your program.
17+
```toml
18+
[package]
19+
org = "my_org"
20+
name = "my_package"
21+
version = "1.0.0"
22+
23+
[build-options]
24+
observabilityIncluded=true
25+
```
26+
27+
3. To enable the extension and publish traces to Moesif, add the following to the `Config.toml` when running your program.
28+
```toml
29+
[ballerina.observe]
30+
tracingEnabled=true
31+
tracingProvider="moesif"
32+
33+
[ballerinax.moesif]
34+
applicationId = "xxxxx" # Mandatory configuration. Get the application ID via the Moesif portal
35+
reporterBaseUrl = "xxxxx" # Optional Configuration. Default value is https://api.moesif.net
36+
```
37+
38+
Follow the below steps to get the `applicationId`.
39+
- Log into <a target="_blank" href="https://www.moesif.com/wrap/">Moesif Portal</a>.
40+
- Select the account icon to bring up the settings menu.
41+
- Select Installation or API Keys.
42+
- Copy your Moesif Application ID from the Collector Application ID field.

0 commit comments

Comments
 (0)