Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit acc2d42

Browse files
committed
Bump version to 0.1.10
Pick up #369 to replace hardcoded version with __version__ file and bump the version number.
1 parent fd2f4f2 commit acc2d42

File tree

6 files changed

+46
-32
lines changed

6 files changed

+46
-32
lines changed

opencensus/__version__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2018, OpenCensus Authors
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+
__version__ = '0.1.10'

opencensus/trace/exporters/ocagent/trace_exporter.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,29 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
1514
"""Export opencensus spans to ocagent"""
1615

16+
from threading import Lock
1717
import datetime
1818
import grpc
1919
import os
2020
import socket
21-
from threading import Lock
21+
22+
from opencensus.__version__ import __version__
2223
from opencensus.trace.exporters import base
23-
from opencensus.trace.exporters.gen.opencensus.agent.common.v1 import (
24-
common_pb2
25-
)
26-
from opencensus.trace.exporters.gen.opencensus.agent.trace.v1 import (
27-
trace_service_pb2,
28-
trace_service_pb2_grpc
29-
)
24+
from opencensus.trace.exporters.gen.opencensus.agent.common.v1 \
25+
import common_pb2
26+
from opencensus.trace.exporters.gen.opencensus.agent.trace.v1 \
27+
import trace_service_pb2
28+
from opencensus.trace.exporters.gen.opencensus.agent.trace.v1 \
29+
import trace_service_pb2_grpc
3030
from opencensus.trace.exporters.ocagent import utils
3131
from opencensus.trace.exporters.transports import sync
3232

3333
# Default agent endpoint
3434
DEFAULT_ENDPOINT = 'localhost:55678'
3535

36-
# OpenCensus Version
37-
# TODO: https://github.com/census-instrumentation/opencensus-python/issues/296
38-
CORE_LIBRARY_VERSION = '0.1.6'
36+
# OCAgent exporter version
3937
EXPORTER_VERSION = '0.0.1'
4038

4139

@@ -91,7 +89,7 @@ def __init__(
9189
library_info=common_pb2.LibraryInfo(
9290
language=common_pb2.LibraryInfo.Language.Value('PYTHON'),
9391
exporter_version=EXPORTER_VERSION,
94-
core_library_version=CORE_LIBRARY_VERSION
92+
core_library_version=__version__
9593
),
9694
service_info=common_pb2.ServiceInfo(name=self.service_name))
9795

opencensus/trace/exporters/stackdriver_exporter.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
1615
from collections import defaultdict
16+
import os
17+
1718
from google.cloud.trace.client import Client
1819

20+
from opencensus.__version__ import __version__
21+
from opencensus.common.monitored_resource_util.monitored_resource_util \
22+
import MonitoredResourceUtil
1923
from opencensus.trace import attributes_helper
2024
from opencensus.trace import span_data
2125
from opencensus.trace.attributes import Attributes
2226
from opencensus.trace.exporters import base
2327
from opencensus.trace.exporters.transports import sync
24-
from opencensus.common.monitored_resource_util.monitored_resource_util \
25-
import MonitoredResourceUtil
2628

27-
# OpenCensus Version
28-
VERSION = '0.1.9'
2929

3030
# Agent
31-
AGENT = 'opencensus-python [{}]'.format(VERSION)
31+
AGENT = 'opencensus-python [{}]'.format(__version__)
3232

3333
# Environment variable set in App Engine when vm:true is set.
3434
_APPENGINE_FLEXIBLE_ENV_VM = 'GAE_APPENGINE_HOSTNAME'

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
'google-api-core >= 1.0.0, < 2.0.0',
2626
]
2727

28+
exec(open("opencensus/__version__.py").read())
2829
setup(
2930
name='opencensus',
30-
version='0.1.9',
31+
version=__version__, # noqa
3132
author='OpenCensus Authors',
3233
author_email='[email protected]',
3334
classifiers=[

tests/unit/trace/exporters/ocagent/test_trace_exporter.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@
1919
import socket
2020
import unittest
2121

22-
from google.protobuf.timestamp_pb2 import Timestamp
23-
22+
from opencensus.__version__ import __version__
2423
from opencensus.trace import span_context as span_context_module
2524
from opencensus.trace import span_data as span_data_module
26-
from opencensus.trace.exporters.ocagent.trace_exporter import TraceExporter
27-
from opencensus.trace.exporters.gen.opencensus.agent.trace.v1 import trace_service_pb2
2825
from opencensus.trace.exporters.gen.opencensus.trace.v1 import trace_config_pb2
26+
from opencensus.trace.exporters.ocagent.trace_exporter import TraceExporter
2927

3028

3129
SERVICE_NAME = 'my-service'
@@ -79,7 +77,8 @@ def test_constructor_node(self):
7977
self.assertEqual(exporter.node.service_info.name, SERVICE_NAME)
8078
self.assertEqual(exporter.node.library_info.language, 8)
8179
self.assertIsNotNone(exporter.node.library_info.exporter_version)
82-
self.assertIsNotNone(exporter.node.library_info.core_library_version)
80+
self.assertEqual(exporter.node.library_info.core_library_version,
81+
__version__)
8382

8483
self.assertEqual(exporter.node.identifier.host_name,
8584
socket.gethostname())

tests/unit/trace/exporters/test_stackdriver_exporter.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import mock
1818

19+
from opencensus.__version__ import __version__
1920
from opencensus.trace import span_context
2021
from opencensus.trace import span_data as span_data_module
2122
from opencensus.trace.exporters import stackdriver_exporter
@@ -106,7 +107,7 @@ def test_emit(self, monitor_resource_mock):
106107
'string_value': {
107108
'truncated_byte_count': 0,
108109
'value': 'opencensus-python [{}]'.format(
109-
stackdriver_exporter.VERSION
110+
__version__
110111
)
111112
}
112113
}
@@ -211,7 +212,7 @@ def test_translate_to_stackdriver(self, monitor_resource_mock):
211212
'string_value': {
212213
'truncated_byte_count': 0,
213214
'value': 'opencensus-python [{}]'.format(
214-
stackdriver_exporter.VERSION
215+
__version__
215216
)
216217
}
217218
},
@@ -569,7 +570,7 @@ def test_set_attributes_gae(self, monitor_resource_mock):
569570
'string_value': {
570571
'truncated_byte_count': 0,
571572
'value': 'opencensus-python [{}]'.format(
572-
stackdriver_exporter.VERSION
573+
__version__
573574
)
574575
}
575576
},
@@ -635,7 +636,7 @@ def test_monitored_resource_attributes_gke(self, gke_monitor_resource_mock):
635636
'string_value': {
636637
'truncated_byte_count': 0,
637638
'value': 'opencensus-python [{}]'.format(
638-
stackdriver_exporter.VERSION
639+
__version__
639640
)
640641
}
641642
},
@@ -720,7 +721,7 @@ def test_monitored_resource_attributes_gce(self, gce_monitor_resource_mock):
720721
'string_value': {
721722
'truncated_byte_count': 0,
722723
'value': 'opencensus-python [{}]'.format(
723-
stackdriver_exporter.VERSION
724+
__version__
724725
)
725726
}
726727
},
@@ -773,7 +774,7 @@ def test_monitored_resource_attributes_aws(self, aws_monitor_resource_mock):
773774
'string_value': {
774775
'truncated_byte_count': 0,
775776
'value': 'opencensus-python [{}]'.format(
776-
stackdriver_exporter.VERSION
777+
__version__
777778
)
778779
}
779780
},
@@ -820,7 +821,7 @@ def test_monitored_resource_attributes_None(self, monitor_resource_mock):
820821
'string_value': {
821822
'truncated_byte_count': 0,
822823
'value': 'opencensus-python [{}]'.format(
823-
stackdriver_exporter.VERSION
824+
__version__
824825
)
825826
}
826827
}

0 commit comments

Comments
 (0)