{"id":13761669,"url":"https://github.com/census-ecosystem/opencensus-go-exporter-graphite","last_synced_at":"2025-05-10T14:30:32.491Z","repository":{"id":34310151,"uuid":"143785296","full_name":"census-ecosystem/opencensus-go-exporter-graphite","owner":"census-ecosystem","description":"Graphite Exporter for OpenCensus Go","archived":true,"fork":false,"pushed_at":"2023-05-02T19:08:32.000Z","size":42,"stargazers_count":3,"open_issues_count":3,"forks_count":8,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-11-16T20:30:49.719Z","etag":null,"topics":["graphite","metrics","opencensus","stats"],"latest_commit_sha":null,"homepage":"","language":"Go","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/census-ecosystem.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}},"created_at":"2018-08-06T21:29:44.000Z","updated_at":"2023-07-31T17:43:29.000Z","dependencies_parsed_at":"2024-01-17T16:58:09.058Z","dependency_job_id":"2e1e4da3-b875-417c-a4ea-c9f3bf181b99","html_url":"https://github.com/census-ecosystem/opencensus-go-exporter-graphite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/census-ecosystem%2Fopencensus-go-exporter-graphite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/census-ecosystem%2Fopencensus-go-exporter-graphite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/census-ecosystem%2Fopencensus-go-exporter-graphite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/census-ecosystem%2Fopencensus-go-exporter-graphite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/census-ecosystem","download_url":"https://codeload.github.com/census-ecosystem/opencensus-go-exporter-graphite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253428174,"owners_count":21906863,"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":["graphite","metrics","opencensus","stats"],"created_at":"2024-08-03T14:00:21.798Z","updated_at":"2025-05-10T14:30:32.216Z","avatar_url":"https://github.com/census-ecosystem.png","language":"Go","funding_links":[],"categories":["Exporters"],"sub_categories":["Go"],"readme":"\u003e **Warning**\n\u003e\n\u003e OpenCensus and OpenTracing have merged to form [OpenTelemetry](https://opentelemetry.io), which serves as the next major version of OpenCensus and OpenTracing.\n\u003e\n\u003e OpenTelemetry has now reached feature parity with OpenCensus, with tracing and metrics SDKs available in .NET, Golang, Java, NodeJS, and Python. **All OpenCensus Github repositories, except [census-instrumentation/opencensus-python](https://github.com/census-instrumentation/opencensus-python), will be archived on July 31st, 2023**. We encourage users to migrate to OpenTelemetry by this date.\n\u003e\n\u003e To help you gradually migrate your instrumentation to OpenTelemetry, bridges are available in Java, Go, Python, and JS. [**Read the full blog post to learn more**](https://opentelemetry.io/blog/2023/sunsetting-opencensus/).\n\n# OpenCensus Go Graphite Exporter\n[![Build Status][travis-image]][travis-url]\n\n[travis-image]: https://travis-ci.org/census-ecosystem/opencensus-go-exporter-graphite.svg?branch=master\n[travis-url]: https://travis-ci.org/census-ecosystem/opencensus-go-exporter-graphite\n[![Gitter chat][gitter-image]][gitter-url]\n\nThe _OpenCensus Graphite Stats Exporter for Go_ is a package that\nexports data to [Graphite](https://graphiteapp.org/), a real-time graphing system that stores and renders graphs of received numeric time-series data on demand.\n\n## Quickstart\n\n### Import\n\n```\nimport \"contrib.go.opencensus.io/exporter/graphite\"\n```\n\nThe API of this project is still evolving.\nThe use of vendoring or a dependency management tool is recommended.\n\n### Register the exporter\n\n```go\nfunc main() {\n    // Namespace is an optional part of the Options struct.\n    // Stats will be reported every second by default.\n    exporter, err := graphite.NewExporter(graphite.Options{Namespace: \"opencensus\"})\n    ...\n}\n```\n\nIt is possible to set different reporting intervals by using `SetReportingPeriod()`, for example:\n\n```go\nfunc main() {\n    graphite.NewExporter(graphite.Options{Namespace: \"opencensus\"})\n    view.RegisterExporter(exporter)\n    ....\n    view.SetReportingPeriod(5 * time.Second)\n}\n```\n\n### Options for the Graphite exporter\n\nThere are some options that can be defined when registering and creating the exporter. Those options are shown below:\n\n| Field | Description | Default Value |\n| ------ | ------ | ------ |\n| Host | Type `string`. The Host contains the host address for the graphite server | \"127.0.0.1\" |\n| Port | Type `int`. The Port in which the carbon/graphite endpoint is available | 2003\n| Namespace | Type `string`. The Namespace is a string value to build the metric path. It will be the first value on the path | None |\n| ReportingPeriod | Type `time.Duration`. The ReportingPeriod is a value to determine the buffer timeframe in which the stats data will be sent. | 1 second |\n\n\n## Implementation Details\n\nTo feed data into Graphite in Plaintext, the following format must be used: `\u003cmetric path\u003e \u003cmetric value\u003e \u003cmetric timestamp\u003e`.\n\n  - `metric_path` is the metric namespace.\n  - `value` is the value of the metric at a given time.\n  - `timestamp` is the number of seconds since unix epoch time and the time in which the data is received on Graphite.\n\n## Frequently Asked Questions\n\n### How the stats data is handled?\n\nThe stats data is aggregated into Views (which are essentially a collection of metrics, each with a different set of labels). To know more about the definition of views, check the [Opencensus docs](https://github.com/census-instrumentation/opencensus-specs/blob/master/stats/Export.md)\n\n### How the path is built?\n\nOne of the main concepts of Graphite is the `metric path`. This path is used to aggregate and organize the measurements and generate the graphs.\n\nIn this exporter, the path is built as follows:\n\n`Options.Namespace`.`View.Name`.`Tags`\n\n  - `Options.Namespace`: Defined in the `Options` object.\n  - `View.Name`: The name given to the view.\n  - `Tags`: The view tag key and values in the format `key=value`\n\n\nFor example, in a configuration where:\n\n  - `Options.Namespace`: 'opencensus'\n  - `View.Name`: 'video_size'\n  - `Tags`: { \"name\": \"video1\", \"author\": \"john\"}\n\nThe generated path will look like:\n\n`opencensus.video_size;name=video1;author=john`\n\n#### Graph visualization on Graphite\n![Graph visualization on Graphite](https://i.imgur.com/A4AExV8.png)\n\n#### Heatmap visualization on Grafana\n\nOn Grafana it's possible to generate heatmaps based on time series bucket. To do so, it's necessary to configure the Axes, setting the `Data format` to `Time series bucket` as shown in the image below:\n\n![Axes Configuration](https://i.imgur.com/nAMAMz7.png)\n\nIt's also necessary to sort the values so that Grafana displays the buckets in the correct order. For that, it's necessary to insert a `SortByName(true)` function on the metrics query as shown in the image below:\n\n![Metrics Configuration](https://i.imgur.com/UrmJ7H9.png)\n\nWith this configuration, Grafana automatically identifies the bucket boundaries in the data that's being sent and generate the correct heatmap without the need of further configuration.\n\nIn the next image, it's possible to see the heatmap created from  a gRPC client latency view, that can be found in the ocgrpc package as ClientRoundtripLatencyView.\n\nThe code for generating this example is not much different from the grpc example contained in the example folder. The main change is on line 45 of the client:\n\n```go\n...\n// Register the view to collect gRPC client stats.\nif err := view.Register(ocgrpc.ClientRoundtripLatencyView); err != nil {\n\tlog.Fatal(err)\n}\n...\n```\n\n![Heatmap example with ClientRoundtripLatencyView](https://i.imgur.com/gZc8QLf.png)\n\n[gitter-image]: https://badges.gitter.im/census-instrumentation/lobby.svg\n[gitter-url]: https://gitter.im/census-instrumentation/lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcensus-ecosystem%2Fopencensus-go-exporter-graphite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcensus-ecosystem%2Fopencensus-go-exporter-graphite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcensus-ecosystem%2Fopencensus-go-exporter-graphite/lists"}